plugins/tools/task/skills/explore/SKILL.md
项目上下文探索。当用户需要了解项目结构、分析代码架构或为任务收集上下文时触发,定位相关模块和文件,推断代码风格与工具链,输出 context.json
npx skillsauth add lazygophers/ccplugin plugins/tools/task/skills/exploreInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
目标导向的渐进式探索,聚焦任务相关上下文。只读分析,不修改项目代码。
项目范围:所有文件搜索和读取必须限定在 project_root 目录内(由 flow 传入,独立调用时为 $(pwd))。
当用户直接调用 /task:explore 时(无 flow 上下文):
task update {task_id} --status=explore 创建任务.lazygophers/tasks/{task_id}/context.json当由 flow 调用时:直接使用传入的 task_id 和 environment 参数。
按优先级依次执行,每个阶段完成后评估是否已有足够信息:
从用户输入(user_prompt 或 align_feedback)中提取关键术语(模块名、函数名、技术概念),使用以下工具定位相关代码:
output_mode="files_with_matches")src/**/*.py、lib/**/*.ts)产出:相关模块列表、关键文件路径列表
对阶段1发现的文件,分析其上下游关系:
产出:依赖关系图(哪些模块依赖哪些模块)、调用链关键节点
从阶段1的文件中采样 3-5 个代表性文件,推断项目约定:
| 维度 | 检测方法 | 示例输出 |
|------|---------|---------|
| 命名约定 | 观察函数/变量/类的命名模式 | snake_case for functions, PascalCase for classes |
| 缩进风格 | 观察缩进字符和宽度 | 4 spaces |
| 导入模式 | 观察 import 语句的组织方式 | absolute imports, stdlib → third-party → local |
| 错误处理 | 观察 try/except 和异常类型 | custom exceptions in errors.py, logging on catch |
| 测试风格 | 观察测试文件的组织和命名 | pytest, test_ prefix, fixtures in conftest.py |
| 文档风格 | 观察注释和 docstring 格式 | Google style docstrings |
产出:code_style 字典
快速扫描项目根目录的配置文件:
package.json、pyproject.toml、Makefile、Cargo.toml 等.eslintrc、ruff.toml、.prettierrc 等pytest.ini、jest.config.*、vitest.config.* 等.github/workflows/、.gitlab-ci.yml 等产出:可用的验证命令(lint、test、build)
探索完成后,必须写入 context.json,结构如下:
{
"task_related": {
"modules": ["模块A", "模块B"],
"files": ["src/auth/login.py", "src/auth/middleware.py"],
"dependencies": {"login.py": ["middleware.py", "models/user.py"]},
"entry_points": ["src/main.py:app"],
"patterns": ["认证使用 JWT", "所有路由经过 middleware"]
},
"code_style": {
"naming": "snake_case for functions, PascalCase for classes",
"indentation": "4 spaces",
"imports": "absolute imports, isort grouping",
"error_handling": "custom AppError hierarchy, logging on catch",
"testing": "pytest, fixtures in conftest.py",
"documentation": "Google style docstrings"
},
"toolchain": {
"language": "Python 3.11",
"package_manager": "uv",
"lint_command": "ruff check .",
"test_command": "pytest",
"build_command": "uv build"
},
"last_updated": "2026-04-13T10:00:00"
}
| 字段 | 要求 |
|------|------|
| task_related.modules | ≥1 个相关模块 |
| task_related.files | ≥1 个关键文件路径 |
| code_style.naming | 非空,明确的命名约定 |
| code_style.indentation | 非空,明确的缩进风格 |
| last_updated | ISO 8601 时间戳 |
dependencies、entry_points、patterns、toolchain — 有则填,无则省略。
如果已有 context.json(从之前的探索中),执行增量更新:
tools
UI/UX 与布局设计——做界面布局/结构/导航/组件/交互的设计决策。触发:做UI/UX/布局/排版/导航/组件/交互/栅格/响应式/图表选型/字体配对。按媒介路由 HTML/Web、原生 App(iOS/Android/桌面)、CLI、TUI。需后端动态系统不适用;配色/主题/色板走姊妹 skill design-color。
tools
主题与配色设计——做颜色搭配/调色板/主题/品牌色阶/暗模式的设计决策。触发:选配色/调色/主题/色板/品牌色/暗模式/对比度/色盲/UI风格。按媒介路由 HTML/Web(CSS变量)、原生App(平台token)、CLI(ANSI)、TUI(真彩/256/16降级)。保证可访问性(对比度/色盲安全)。需后端动态系统不适用;UI/UX 布局/组件/交互走姊妹 skill design-uiux。
tools
跨任意组件(plugin/skill/agent/command)的验证驱动优化循环纪律 skill。当用户要优化某个已有组件却无明确方向、或要防止改了反而更差(自评乐观偏差 / 多维同改归因失效 / 为凑分加废话膨胀)、或要把一套通用「评分→单变量改→改后验证严格更好才留否则回滚→触顶停」的纪律套到任意组件上时使用。管优化过程本身的纪律(validation gate / ratchet / 独立验证 / 触顶停),不评单组件深度(交 skill-dev),不查插件接线(交 plugin-dev)。仅手动 /optimize-any 触发。
data-ai
两层规则记忆 (基于 .skein/spec)。planning 时 recall 召回相关规则、task finish 后 sediment 沉淀学习 + prune 自动精简过期/重复/断链规则。core 常驻硬规 + recall 按需召回, 经判定门自动写盘 (不逐次问用户)。产出 .skein/spec 下 core/recall 规则文件 + index。另支持空仓 bootstrap 播种规则基线、记忆大面积失效 (大重构/换栈) 时 reconstruct 可逆归档后按项目类型分型重建、maintain 手动体检 (超预算/stale/断链/重复/废弃, --apply 自动修复)、auto-fix (Stop hook 写 .pending-fix 标记 → main 派 skein-specer bg 跑 maintain --apply 全自动修, 断链只报告)。