do

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

do - Feature Development Orchestrator

do - 功能开发编排器

An orchestrator for systematic feature development. Invoke agents via
codeagent-wrapper
, never write code directly.
一个用于系统化功能开发的编排器。通过
codeagent-wrapper
调用agents,切勿直接编写代码。

Loop Initialization (REQUIRED)

循环初始化(必填)

When triggered via
/do <task>
, follow these steps:
当通过
/do <task>
触发时,请遵循以下步骤:

Step 1: Ask about worktree mode

步骤1:询问工作树模式

Use AskUserQuestion to ask:
Develop in a separate worktree? (Isolates changes from main branch)
- Yes (Recommended for larger changes)
- No (Work directly in current directory)
使用AskUserQuestion询问:
是否在独立工作树中开发?(将变更与主分支隔离)
- 是(推荐用于较大变更)
- 否(直接在当前目录工作)

Step 2: Initialize state

步骤2:初始化状态

bash
undefined
bash
undefined

If worktree mode selected:

若选择工作树模式:

python3 "${SKILL_DIR}/scripts/setup-do.py" --worktree "<task description>"
python3 "${SKILL_DIR}/scripts/setup-do.py" --worktree "<task description>"

If no worktree:

若不使用工作树:

python3 "${SKILL_DIR}/scripts/setup-do.py" "<task description>"

This creates `.claude/do.{task_id}.local.md` with:
- `active: true`
- `current_phase: 1`
- `max_phases: 5`
- `completion_promise: "<promise>DO_COMPLETE</promise>"`
- `use_worktree: true/false`
python3 "${SKILL_DIR}/scripts/setup-do.py" "<task description>"

此命令会创建`.claude/do.{task_id}.local.md`文件,包含以下内容:
- `active: true`
- `current_phase: 1`
- `max_phases: 5`
- `completion_promise: "<promise>DO_COMPLETE</promise>"`
- `use_worktree: true/false`

Worktree Mode

工作树模式

When
use_worktree: true
in state file, ALL
codeagent-wrapper
calls that modify code MUST include
--worktree
:
bash
undefined
当状态文件中
use_worktree: true
时,所有会修改代码的
codeagent-wrapper
调用必须包含
--worktree
参数:
bash
undefined

With worktree mode enabled

启用工作树模式时

codeagent-wrapper --worktree --agent develop - . <<'EOF' ... EOF
codeagent-wrapper --worktree --agent develop - . <<'EOF' ... EOF

Parallel tasks with worktree

工作树模式下的并行任务

codeagent-wrapper --worktree --parallel <<'EOF' ---TASK--- id: task1 agent: develop workdir: . ---CONTENT--- ... EOF

The `--worktree` flag tells codeagent-wrapper to create/use a worktree internally. Read-only agents (code-explorer, code-architect, code-reviewer) do NOT need `--worktree`.
codeagent-wrapper --worktree --parallel <<'EOF' ---TASK--- id: task1 agent: develop workdir: . ---CONTENT--- ... EOF

`--worktree`参数用于告知codeagent-wrapper在内部创建/使用工作树。只读agents(code-explorer、code-architect、code-reviewer)无需使用`--worktree`。

Loop State Management

循环状态管理

After each phase, update
.claude/do.{task_id}.local.md
frontmatter:
yaml
current_phase: <next phase number>
phase_name: "<next phase name>"
When all 5 phases complete, output the completion signal:
<promise>DO_COMPLETE</promise>
To abort early, set
active: false
in the state file.
每个阶段完成后,更新
.claude/do.{task_id}.local.md
的前置内容:
yaml
current_phase: <下一阶段编号>
phase_name: "<下一阶段名称>"
当所有5个阶段完成后,输出完成信号:
<promise>DO_COMPLETE</promise>
若要提前终止,将状态文件中的
active: false

Hard Constraints

硬性约束

  1. Never write code directly. Delegate all code changes to
    codeagent-wrapper
    agents.
  2. Pass complete context forward. Every agent invocation includes the Context Pack.
  3. Parallel-first. Run independent tasks via
    codeagent-wrapper --parallel
    .
  4. Update state after each phase. Keep
    .claude/do.{task_id}.local.md
    current.
  5. Expect long-running
    codeagent-wrapper
    calls.
    High-reasoning modes can take a long time; stay in the orchestrator role and wait for agents to complete.
  6. Timeouts are not an escape hatch. If a
    codeagent-wrapper
    invocation times out/errors, retry (split/narrow the task if needed); never switch to direct implementation.
  7. Respect worktree setting. If
    use_worktree: true
    , always pass
    --worktree
    to develop agent calls.
  1. 切勿直接编写代码。 所有代码变更都需委托给
    codeagent-wrapper
    agents处理。
  2. 完整传递上下文。 每次调用agent时都需包含上下文包。
  3. 优先并行处理。 通过
    codeagent-wrapper --parallel
    运行独立任务。
  4. 每个阶段后更新状态。 保持
    .claude/do.{task_id}.local.md
    为最新状态。
  5. codeagent-wrapper调用可能耗时较长。 高推理模式可能需要较长时间;请保持编排器角色,等待agents完成任务。
  6. 超时不是逃避手段。
    codeagent-wrapper
    调用超时/出错,请重试(必要时拆分/缩小任务范围);切勿切换为直接实现。
  7. 遵守工作树设置。
    use_worktree: true
    ,调用develop agent时务必传递
    --worktree
    参数。

Agents

Agents

AgentPurposeNeeds --worktree
code-explorer
Trace code, map architecture, find patternsNo (read-only)
code-architect
Design approaches, file plans, build sequencesNo (read-only)
code-reviewer
Review for bugs, simplicity, conventionsNo (read-only)
develop
Implement code, run testsYes (if worktree enabled)
Agent用途是否需要--worktree
code-explorer
追踪代码、绘制架构图、发现模式否(只读)
code-architect
设计实现方案、文件规划、构建序列否(只读)
code-reviewer
检查Bug、简洁性、编码规范否(只读)
develop
实现代码、运行测试(若启用工作树)

Issue Severity Definitions

问题严重程度定义

Blocking issues (require user input):
  • Impacts core functionality or correctness
  • Security vulnerabilities
  • Architectural conflicts with existing patterns
  • Ambiguous requirements with multiple valid interpretations
Minor issues (auto-fix without asking):
  • Code style inconsistencies
  • Naming improvements
  • Missing documentation
  • Non-critical test coverage gaps
阻塞性问题(需要用户输入):
  • 影响核心功能或正确性
  • 安全漏洞
  • 与现有模式存在架构冲突
  • 需求模糊,存在多种有效解读
次要问题(无需询问,自动修复):
  • 代码风格不一致
  • 命名优化
  • 缺少文档
  • 非关键测试覆盖缺口

Context Pack Template

上下文包模板

text
undefined
text
undefined

Original User Request

原始用户请求

<verbatim request>
<原始请求内容>

Context Pack

上下文包

  • Phase: <1-5 name>
  • Decisions: <requirements/constraints/choices>
  • Code-explorer output: <paste or "None">
  • Code-architect output: <paste or "None">
  • Code-reviewer output: <paste or "None">
  • Develop output: <paste or "None">
  • Open questions: <list or "None">
  • 阶段:<1-5 阶段名称>
  • 决策:<需求/约束/选择>
  • Code-explorer输出:<粘贴内容或"无">
  • Code-architect输出:<粘贴内容或"无">
  • Code-reviewer输出:<粘贴内容或"无">
  • Develop输出:<粘贴内容或"无">
  • 待解决问题:<列表或"无">

Current Task

当前任务

<specific task>
<具体任务>

Acceptance Criteria

验收标准

<checkable outputs> ```
<可检查的输出项>
undefined

5-Phase Workflow

5阶段工作流

Phase 1: Understand (Parallel, No Interaction)

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

Goal: Understand requirements and map codebase simultaneously.
Actions: Run
code-architect
and 2-3
code-explorer
tasks in parallel.
bash
codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p1_requirements
agent: code-architect
workdir: .
---CONTENT---
目标: 同时理解需求并绘制代码库映射。
操作: 并行运行
code-architect
和2-3个
code-explorer
任务。
bash
codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p1_requirements
agent: code-architect
workdir: .
---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-explorer output: None
  • Code-architect output: None
  • Code-explorer输出:无
  • Code-architect输出:无

Current Task

当前任务

  1. Analyze requirements completeness (score 1-10)
  2. Extract explicit requirements, constraints, acceptance criteria
  3. Identify blocking questions (issues that prevent implementation)
  4. 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]
  • Minor clarifications: [list, if any]
  1. 分析需求完整性(评分1-10)
  2. 提取明确需求、约束条件、验收标准
  3. 识别阻塞性问题(阻碍实现的问题)
  4. 识别次要澄清点(有则更好,但不影响推进)
输出格式:
  • 完整性评分:X/10
  • 需求:[列表]
  • 非目标:[列表]
  • 阻塞性问题:[列表,如有]
  • 次要澄清点:[列表,如有]

Acceptance Criteria

验收标准

Concrete checklist; blocking vs minor questions clearly separated.
---TASK--- id: p1_similar_features agent: code-explorer workdir: . ---CONTENT---
具体检查清单;明确区分阻塞性与次要问题。
---TASK--- id: p1_similar_features agent: code-explorer workdir: . ---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Current Task

当前任务

Find 1-3 similar features, trace end-to-end. Return: key files with line numbers, call flow, extension points.
查找1-3个类似功能,进行端到端追踪。返回:带行号的关键文件、调用流程、扩展点。

Acceptance Criteria

验收标准

Concrete file:line map + reuse points.
---TASK--- id: p1_architecture agent: code-explorer workdir: . ---CONTENT---
具体的文件:行号映射 + 可复用点。
---TASK--- id: p1_architecture agent: code-explorer workdir: . ---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Current Task

当前任务

Map architecture for relevant subsystem. Return: module map + 5-10 key files.
绘制相关子系统的架构图。返回:模块映射 + 5-10个关键文件。

Acceptance Criteria

验收标准

Clear boundaries; file:line references.
---TASK--- id: p1_conventions agent: code-explorer workdir: . ---CONTENT---
清晰的边界;包含文件:行号引用。
---TASK--- id: p1_conventions agent: code-explorer workdir: . ---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Current Task

当前任务

Identify testing patterns, conventions, config. Return: test commands + file locations.
识别测试模式、编码规范、配置。返回:测试命令 + 文件位置。

Acceptance Criteria

验收标准

Test commands + relevant test file paths. EOF
undefined
测试命令 + 相关测试文件路径。 EOF
undefined

Phase 2: Clarify (Conditional)

阶段2:澄清(条件性步骤)

Goal: Resolve blocking ambiguities only.
Actions:
  1. Review
    p1_requirements
    output for blocking questions
  2. IF blocking questions exist → Use AskUserQuestion
  3. IF no blocking questions (completeness >= 8) → Skip to Phase 3, log "Requirements clear, proceeding"
bash
undefined
目标: 仅解决阻塞性歧义。
操作:
  1. 查看
    p1_requirements
    输出中的阻塞性问题
  2. 若存在阻塞性问题 → 使用AskUserQuestion询问用户
  3. 若没有阻塞性问题(完整性评分≥8) → 跳过至阶段3,记录“需求明确,继续推进”
bash
undefined

Only if blocking questions exist:

仅当存在阻塞性问题时执行:

Use AskUserQuestion with the blocking questions from Phase 1

使用AskUserQuestion询问阶段1中识别的阻塞性问题

undefined
undefined

Phase 3: Design (No Interaction)

阶段3:设计(无需交互)

Goal: Produce minimal-change implementation plan.
Actions: Invoke
code-architect
with all Phase 1 context to generate a single implementation plan.
bash
codeagent-wrapper --agent code-architect - . <<'EOF'
目标: 生成最小变更的实现方案。
操作: 调用
code-architect
并传入阶段1的所有上下文,生成单一实现方案。
bash
codeagent-wrapper --agent code-architect - . <<'EOF'

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-explorer output: <ALL Phase 1 explorer outputs>
  • Code-architect output: <Phase 1 requirements + Phase 2 answers if any>
  • Code-explorer输出:<阶段1所有explorer输出>
  • Code-architect输出:<阶段1需求 + 阶段2答案(如有)>

Current Task

当前任务

Design minimal-change implementation:
  • Reuse existing abstractions
  • Minimize new files
  • Follow established patterns from code-explorer output
Output:
  • File touch list with specific changes
  • Build sequence
  • Test plan
  • Risks and mitigations
设计最小变更的实现方案:
  • 复用现有抽象
  • 最小化新增文件
  • 遵循code-explorer输出中的既定模式
输出:
  • 需修改的文件列表及具体变更内容
  • 构建序列
  • 测试方案
  • 风险及缓解措施

Acceptance Criteria

验收标准

Concrete, implementable blueprint with minimal moving parts. EOF
undefined
具体、可实现的蓝图,尽可能减少变动点。 EOF
undefined

Phase 4: Implement + Review (Single Interaction Point)

阶段4:实现 + 评审(单一交互点)

Goal: Build feature and review in one phase.
Actions:
  1. Invoke
    develop
    to implement (add
    --worktree
    if
    use_worktree: true
    ):
bash
undefined
目标: 完成功能构建并在本阶段内完成评审。
操作:
  1. 调用
    develop
    进行实现(若
    use_worktree: true
    则添加
    --worktree
    参数):
bash
undefined

Check use_worktree from state file, add --worktree if true

检查状态文件中的use_worktree设置,若为true则添加--worktree参数

codeagent-wrapper --worktree --agent develop - . <<'EOF'
codeagent-wrapper --worktree --agent develop - . <<'EOF'

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-explorer output: <ALL Phase 1 outputs>
  • Code-architect output: <Phase 3 blueprint>
  • Code-explorer输出:<阶段1所有输出>
  • Code-architect输出:<阶段3蓝图>

Current Task

当前任务

Implement with minimal change set following the blueprint.
  • Follow Phase 1 patterns
  • Add/adjust tests per Phase 3 plan
  • Run narrowest relevant tests
遵循蓝图,以最小变更集实现功能。
  • 遵循阶段1识别的模式
  • 根据阶段3的测试方案添加/调整测试
  • 运行最相关的窄范围测试

Acceptance Criteria

验收标准

Feature works end-to-end; tests pass; diff is minimal. EOF

2. Run parallel reviews (no --worktree needed, read-only):

```bash
codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p4_correctness
agent: code-reviewer
workdir: .
---CONTENT---
功能端到端可用;测试通过;代码差异最小。 EOF

2. 并行运行评审任务(无需--worktree,只读):

```bash
codeagent-wrapper --parallel <<'EOF'
---TASK---
id: p4_correctness
agent: code-reviewer
workdir: .
---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-architect output: <Phase 3 blueprint>
  • Develop output: <implementation output>
  • Code-architect输出:<阶段3蓝图>
  • Develop输出:<实现输出>

Current Task

当前任务

Review for correctness, edge cases, failure modes. Classify each issue as BLOCKING or MINOR.
评审正确性、边缘情况、故障模式。 将每个问题分类为阻塞性或次要问题。

Acceptance Criteria

验收标准

Issues with file:line references, severity, and concrete fixes.
---TASK--- id: p4_simplicity agent: code-reviewer workdir: . ---CONTENT---
问题需包含文件:行号引用、严重程度及具体修复方案。
---TASK--- id: p4_simplicity agent: code-reviewer workdir: . ---CONTENT---

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-architect output: <Phase 3 blueprint>
  • Develop output: <implementation output>
  • Code-architect输出:<阶段3蓝图>
  • Develop输出:<实现输出>

Current Task

当前任务

Review for KISS: remove bloat, collapse needless abstractions. Classify each issue as BLOCKING or MINOR.
基于KISS原则评审:移除冗余代码、合并不必要的抽象。 将每个问题分类为阻塞性或次要问题。

Acceptance Criteria

验收标准

Actionable simplifications with severity and justification. EOF

3. Handle review results:
   - **MINOR issues only** → Auto-fix via `develop` (with `--worktree` if enabled), no user interaction
   - **BLOCKING issues** → Use AskUserQuestion: "Fix now / Proceed as-is"
可操作的简化建议,包含严重程度及理由。 EOF

3. 处理评审结果:
   - **仅存在次要问题** → 通过`develop`自动修复(若启用工作树则添加`--worktree`),无需用户交互
   - **存在阻塞性问题** → 使用AskUserQuestion询问:“立即修复/保持现状继续推进”

Phase 5: Complete (No Interaction)

阶段5:完成(无需交互)

Goal: Document what was built.
Actions: Invoke
code-reviewer
to produce summary:
bash
codeagent-wrapper --agent code-reviewer - . <<'EOF'
目标: 记录已构建的内容。
操作: 调用
code-reviewer
生成总结:
bash
codeagent-wrapper --agent code-reviewer - . <<'EOF'

Original User Request

原始用户请求

/do <request>
/do <request>

Context Pack

上下文包

  • Code-architect output: <Phase 3 blueprint>
  • Code-reviewer output: <Phase 4 review outcomes>
  • Develop output: <Phase 4 implementation + fixes>
  • Code-architect输出:<阶段3蓝图>
  • Code-reviewer输出:<阶段4评审结果>
  • Develop输出:<阶段4实现 + 修复内容>

Current Task

当前任务

Write completion summary:
  • What was built
  • Key decisions/tradeoffs
  • Files modified (paths)
  • How to verify (commands)
  • Follow-ups (optional)
编写完成总结:
  • 已构建的内容
  • 关键决策/权衡
  • 修改的文件(路径)
  • 验证方法(命令)
  • 后续工作(可选)

Acceptance Criteria

验收标准

Short, technical, actionable summary. EOF

Output the completion signal:
<promise>DO_COMPLETE</promise>
undefined
简短、技术化、可执行的总结。 EOF

输出完成信号:
<promise>DO_COMPLETE</promise>
undefined