build
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/build
/build
Execute plan tasks via subagents, validate, report.
Announce: "Starting /build — executing plan with subagent dispatch."
通过子Agent执行计划任务,进行验证并生成报告。
公告: "开始执行/build——通过子Agent调度执行计划。"
Prerequisites
前置条件
- Plan approved by (Step 4), OR one-sentence scope / hotfix (no plan)
/review - Working in a linked worktree (not primary)
- 计划已通过(步骤4)审批,或为单句范围需求/热修复(无计划)
/review - 在关联工作树中操作(而非主工作树)
With Plan
有计划场景
1. Load
1. 加载
Read . Extract tasks into ordered batches:
ai-workspace/plans/<name>.md- Tasks under the same step or marked parallel = one batch
- Tasks with dependencies on prior tasks = separate sequential batch
- Note file paths, test expectations, and acceptance criteria per task
读取文件。将任务提取为有序批次:
ai-workspace/plans/<name>.md- 同一步骤下的任务或标记为并行的任务 = 一个批次
- 依赖于前置任务的任务 = 单独的顺序批次
- 记录每个任务的文件路径、测试预期和验收标准
2. Execute Batches
2. 执行批次
Batches run sequentially. Tasks within a batch dispatch in parallel via subagents.
Agent selection per task:
| Plan structure | Agent | Notes |
|---|---|---|
| Separate "write test" + "implement" tasks | | Sequential within the pair |
| Combined task ("implement X with tests") | | Handles TDD internally |
| Docs-only task | |
Parallel safety: only dispatch tasks in parallel when they touch different files.
Subagent prompt — provide each agent:
You are implementing Task N: [task name]批次按顺序运行。批次内的任务通过子Agent并行调度。
按任务选择Agent:
| 计划结构 | Agent | 说明 |
|---|---|---|
| 拆分的「编写测试」+「实现」任务 | | 任务对内部按顺序执行 |
| 合并任务(「实现X并编写测试」) | | 内部处理TDD流程 |
| 仅文档类任务 | |
并行安全性: 仅当任务涉及不同文件时,才并行调度任务。
子Agent提示词——为每个Agent提供:
You are implementing Task N: [task name]Task Description
Task Description
[FULL TEXT from plan — paste it, don't make the subagent read the file]
[FULL TEXT from plan — paste it, don't make the subagent read the file]
Context
Context
[Where this fits, what earlier batches produced, architectural decisions]
[Where this fits, what earlier batches produced, architectural decisions]
Working Directory
Working Directory
[Absolute path to worktree]
[Absolute path to worktree]
Project Conventions
Project Conventions
- TDD: write failing test first, make it pass, refactor
- Commit after task completes (conventional commits)
- TypeScript strict, ESM, Biome, Vitest, Pino logger, no barrel exports
- Self-review before reporting back
- TDD: write failing test first, make it pass, refactor
- Commit after task completes (conventional commits)
- TypeScript strict, ESM, Biome, Vitest, Pino logger, no barrel exports
- Self-review before reporting back
Report: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
Report: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
**Handle responses:**
| Status | Action |
|---|---|
| DONE | Mark task complete |
| DONE_WITH_CONCERNS | Read concerns — if correctness/scope, address before continuing |
| NEEDS_CONTEXT | Provide missing context, re-dispatch |
| BLOCKED | Assess: more context? more capable model? break smaller? escalate to human? |
| Task touches protected file | Stop immediately — never dispatch |
Never retry BLOCKED without changing something.
**Inter-batch check** — after each batch, verify no regressions before starting the next:
```bash
pnpm typecheck && pnpm test
**响应处理:**
| 状态 | 操作 |
|---|---|
| DONE | 标记任务完成 |
| DONE_WITH_CONCERNS | 查看问题——若涉及正确性/范围,需解决后再继续 |
| NEEDS_CONTEXT | 补充缺失的上下文,重新调度 |
| BLOCKED | 评估:是否需要更多上下文?更换更强大的模型?拆分为更小任务?升级给人工处理? |
| 任务涉及受保护文件 | 立即停止——绝不调度 |
未做出调整前,请勿重试BLOCKED状态的任务。
**批次间检查** — 每个批次完成后,在启动下一批次前验证无回归问题:
```bash
pnpm typecheck && pnpm test3. Validate (Hard Gate)
3. 验证(硬性关卡)
After ALL batches complete:
bash
pnpm validateRead the output. Never claim success without evidence. If it fails:
- Diagnose the failure
- Fix (dispatch subagent or fix directly for small issues)
- Re-run
pnpm validate - Max 3 fix-validate cycles. If still failing, stop and report.
Step 6 () CANNOT begin until validate passes.
/review所有批次完成后:
bash
pnpm validate读取输出结果。无证据绝不宣称成功。若验证失败:
- 诊断失败原因
- 修复(调度子Agent或直接修复小问题)
- 重新运行
pnpm validate - 最多进行3次修复-验证循环。若仍失败,停止并报告。
验证通过前,不得启动步骤6()。
/review4. Report
4. 报告
Build complete.
Tasks: <completed>/<total>
Validate: PASS
Next step: /review (Step 6)Include any DONE_WITH_CONCERNS notes. Update with decisions made during build.
.branch-context.mdBuild complete.
Tasks: <completed>/<total>
Validate: PASS
Next step: /review (Step 6)包含所有DONE_WITH_CONCERNS的问题记录。将构建过程中做出的决策更新至文件。
.branch-context.mdWithout Plan (Hotfix / One-Sentence Scope)
无计划场景(热修复/单句范围需求)
Implement directly — no subagent orchestration for small scope.
- TDD: write failing test (RED), implement fix (GREEN), refactor
- Minimal change: fix the defect, nothing else (hotfixes)
- Root cause: document in commit message body (hotfixes)
- Validate: — same hard gate, same 3-attempt max
pnpm validate
直接实现——小范围需求无需子Agent编排。
- TDD: 编写失败测试(RED阶段),实现修复(GREEN阶段),重构
- 最小改动: 仅修复缺陷,不做其他修改(热修复场景)
- 根本原因: 在提交信息正文中记录(热修复场景)
- 验证: — 同样的硬性关卡,最多尝试3次
pnpm validate
Codex / Cursor Fallback
Codex / Cursor 降级方案
No subagent dispatch. Execute tasks sequentially in main session. Same validation gate applies.
不调度子Agent。在主会话中按顺序执行任务。同样适用验证关卡。
Integration
集成关系
| Relation | Skill |
|---|---|
| Called by | |
| Depends on | |
| Followed by | |
| Replaces | |
| 关系 | 技能 |
|---|---|
| 被调用方 | |
| 依赖项 | |
| 后续步骤 | |
| 替代项 | |