mcpField
D
do

do

github.com/stellarlinkco开发2.8k89 次安装26 周前更新
代码仓库

关于 do

do 是面向开发者的功能开发编排技能,通过五阶段流程协调 Agent,并将 worktree 决策推迟到实现阶段,要求代码修改交由 Agent 完成。

主要功能

  1. 01五阶段功能开发流程
  2. 02并行编排多个 Agent
  3. 03任务状态与阶段跟踪
  4. 04实现时可选 worktree
  5. 05实现与审查由不同 Agent 执行

适用场景

  1. 01编码前评估需求
  2. 02结合代码探索制定变更计划
  3. 03委派功能实现与审查

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/stellarlinkco/myclaude --skill do

安装后在 Claude Code 中输入/do确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

install.py
README.md
agents/
code-architect.md
code-explorer.md
code-reviewer.md
hooks/
hooks.json
stop-hook.py
verify-loop.py
scripts/
get-context.py
setup-do.py
task.py

详细介绍

do - 功能开发编排器

用于系统化功能开发的编排器。通过 codeagent-wrapper 调用 Agent,切勿直接编写代码。

循环初始化(必需)

通过 /do <task> 触发时,立即初始化任务目录,无需询问是否使用 worktree:

python3 "$HOME/.claude/skills/do/scripts/setup-do.py" "<task description>"

这会在 .claude/do-tasks/ 下创建任务目录,其中包含:

  • task.md:单个文件,包含 YAML 前置元数据和 Markdown 正文(需求/上下文)

Worktree 决策延后到第 4 阶段(实施)。 第 1 至第 3 阶段均为只读,无需隔离 worktree。

任务目录管理

使用 task.py 管理任务状态:

# Update phase
python3 "$HOME/.claude/skills/do/scripts/task.py" update-phase 2

# Check status
python3 "$HOME/.claude/skills/do/scripts/task.py" status

# List all tasks
python3 "$HOME/.claude/skills/do/scripts/task.py" list

Worktree 模式

仅在需要时(紧邻第 4 阶段:实施之前)创建 worktree。如果用户选择 worktree 模式:

  1. 使用 --worktree 标志运行 setup,以创建 worktree:

    python3 "$HOME/.claude/skills/do/scripts/setup-do.py" --worktree "<task description>"
    
  2. 使用 DO_WORKTREE_DIR 环境变量,将 codeagent-wrapper 的 develop Agent 指向 worktree。后续调用不要传入 --worktree——否则每次都会创建新的 worktree。

# Save the worktree path from setup output, then prefix all develop calls:
DO_WORKTREE_DIR=<worktree_dir> codeagent-wrapper --agent develop - . <<'EOF'
...
EOF

只读 Agent(code-explorer、code-architect、code-reviewer)不需要 DO_WORKTREE_DIR。

严格约束

  1. 切勿直接编写代码。 将所有代码更改委托给 codeagent-wrapper Agent。
  2. 优先并行处理。 通过 codeagent-wrapper --parallel 执行相互独立的任务。
  3. 每个阶段结束后更新阶段状态。 使用 task.py update-phase <N>。
  4. 预计 codeagent-wrapper 调用会长时间运行。 高推理模式可能需要很长时间。
  5. 超时不是逃避手段。 如果调用超时,请缩小范围后重试。
  6. 将 worktree 决策延后到第 4 阶段。 仅在实施前询问是否使用 worktree 模式。若启用,在 develop Agent 调用前加上 DO_WORKTREE_DIR=<path>。初始化后切勿传入 --worktree。

Agent

Agent用途需要 --worktree
code-explorer跟踪代码、梳理架构、查找模式否(只读)
code-architect设计方案、文件计划、构建顺序否(只读)
code-reviewer检查错误、简洁性和惯例否(只读)
develop实现代码、运行测试是——使用 DO_WORKTREE_DIR 环境变量前缀

问题严重程度定义

阻塞问题(需要用户输入):

  • 影响核心功能或正确性
  • 安全漏洞
  • 与现有模式存在架构冲突
  • 需求存在歧义,且有多种合理解释

次要问题(无需询问,自动修复):

  • 代码风格不一致
  • 命名改进
  • 缺少文档
  • 非关键的测试覆盖缺口

5 阶段工作流

第 1 阶段:了解(并行,无需交互)

目标: 同时了解需求并梳理代码库。

操作: 并行运行 code-architect 和 2 至 3 个 code-explorer 任务。

codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p1_requirements
agent: code-architect
workdir: .
---CONTENT---
Analyze requirements completeness (score 1-10):
1. Extract explicit requirements, constraints, acceptance criteria
2. Identify blocking questions (issues that prevent implementation)
3. Identify minor clarifications (nice-to-have but can proceed without)

Output format:
- Completeness score: X/10
- Requirements: [list]
- Non-goals: [list]
- Blocking questions: [list, if any]

---TASK---
id: p1_similar_features
agent: code-explorer
workdir: .
---CONTENT---
Find 1-3 similar features, trace end-to-end. Return: key files with line numbers, call flow, extension points.

---TASK---
id: p1_architecture
agent: code-explorer
workdir: .
---CONTENT---
Map architecture for relevant subsystem. Return: module map + 5-10 key files.

---TASK---
id: p1_conventions
agent: code-explorer
workdir: .
---CONTENT---
Identify testing patterns, conventions, config. Return: test commands + file locations.
EOF
第 2 阶段:澄清(有条件)

目标: 仅解决阻塞性歧义。

操作:

  1. 查看 p1_requirements 输出中的阻塞问题
  2. 如果存在阻塞问题 → 使用 AskUserQuestion
  3. 如果不存在阻塞问题(完整度 >= 8) → 跳至第 3 阶段
第 3 阶段:设计(无需交互)

目标: 制定改动最少的实施计划。

codeagent-wrapper --agent code-architect - . <<'EOF'
Design minimal-change implementation:
- Reuse existing abstractions
- Minimize new files
- Follow established patterns from Phase 1 exploration

Output:
- File touch list with specific changes
- Build sequence
- Test plan
- Risks and mitigations
EOF
阶段 4:实现 + 审查

目标: 在一个阶段中构建功能并进行审查。

步骤 1:决定是否使用 worktree 模式(仅限现在)

使用 AskUserQuestion 询问:

Develop in a separate worktree? (Isolates changes from main branch)
- Yes (Recommended for larger changes)
- No (Work directly in current directory)

如果用户选择使用 worktree:

python3 "$HOME/.claude/skills/do/scripts/setup-do.py" --worktree "<task description>"
# Save the worktree path from output for DO_WORKTREE_DIR

步骤 2:调用 develop Agent

对于全栈项目,将任务拆分为后端和前端任务,并为每项任务注入 skills:。如果任务可以拆分,则使用 --parallel;如果改动较小或仅涉及单一领域,则使用单个 Agent。

单一领域示例(如果启用了 worktree,请在前面加上 DO_WORKTREE_DIR):

# With worktree:
DO_WORKTREE_DIR=<worktree_dir> codeagent-wrapper --agent develop --skills golang-base-practices - . <<'EOF'
Implement with minimal change set following the Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan
- Run narrowest relevant tests
EOF

# Without worktree:
codeagent-wrapper --agent develop --skills golang-base-practices - . <<'EOF'
Implement with minimal change set following the Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan
- Run narrowest relevant tests
EOF

全栈并行示例(根据阶段 3 的设计调整任务 ID、技能和内容):

# With worktree:
DO_WORKTREE_DIR=<worktree_dir> codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p4_backend
agent: develop
workdir: .
skills: golang-base-practices
---CONTENT---
Implement backend changes following Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan

---TASK---
id: p4_frontend
agent: develop
workdir: .
skills: frontend-design,vercel-react-best-practices
dependencies: p4_backend
---CONTENT---
Implement frontend changes following Phase 3 blueprint.
- Follow Phase 1 patterns
- Add/adjust tests per Phase 3 plan
EOF

# Without worktree: remove DO_WORKTREE_DIR prefix

注意:根据阶段 3 的设计输出选择要注入的技能。仅注入与各任务领域相关的技能。

步骤 3:审查

步骤 3:审查

并行运行审查:

codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p4_correctness
agent: code-reviewer
workdir: .
---CONTENT---
Review for correctness, edge cases, failure modes.
Classify each issue as BLOCKING or MINOR.

---TASK---
id: p4_simplicity
agent: code-reviewer
workdir: .
---CONTENT---
Review for KISS: remove bloat, collapse needless abstractions.
Classify each issue as BLOCKING or MINOR.
EOF

步骤 4:处理审查结果

  • 仅存在轻微问题 → 通过 develop 自动修复,无需与用户交互
  • 存在阻塞问题 → 使用 AskUserQuestion:“立即修复 / 按现状继续”
阶段 5:完成(无需交互)

目标: 记录已构建的内容。

codeagent-wrapper --agent code-reviewer - . <<'EOF'
Write completion summary:
- What was built
- Key decisions/tradeoffs
- Files modified (paths)
- How to verify (commands)
- Follow-ups (optional)
EOF

输出完成信号:

<promise>DO_COMPLETE</promise>

评论

支持 Markdown