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
    /review
    (Step 4), OR one-sentence scope / hotfix (no plan)
  • Working in a linked worktree (not primary)
  • 计划已通过
    /review
    (步骤4)审批,或为单句范围需求/热修复(无计划)
  • 在关联工作树中操作(而非主工作树)

With Plan

有计划场景

1. Load

1. 加载

Read
ai-workspace/plans/<name>.md
. Extract tasks into ordered batches:
  • 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 structureAgentNotes
Separate "write test" + "implement" tasks
test-writer
(RED) then
implementer
(GREEN)
Sequential within the pair
Combined task ("implement X with tests")
implementer
Handles TDD internally
Docs-only task
doc-writer
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说明
拆分的「编写测试」+「实现」任务
test-writer
(RED) then
implementer
(GREEN)
任务对内部按顺序执行
合并任务(「实现X并编写测试」)
implementer
内部处理TDD流程
仅文档类任务
doc-writer
并行安全性: 仅当任务涉及不同文件时,才并行调度任务。
子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 test

3. Validate (Hard Gate)

3. 验证(硬性关卡)

After ALL batches complete:
bash
pnpm validate
Read the output. Never claim success without evidence. If it fails:
  1. Diagnose the failure
  2. Fix (dispatch subagent or fix directly for small issues)
  3. Re-run
    pnpm validate
  4. Max 3 fix-validate cycles. If still failing, stop and report.
Step 6 (
/review
) CANNOT begin until validate passes.
所有批次完成后:
bash
pnpm validate
读取输出结果。无证据绝不宣称成功。若验证失败:
  1. 诊断失败原因
  2. 修复(调度子Agent或直接修复小问题)
  3. 重新运行
    pnpm validate
  4. 最多进行3次修复-验证循环。若仍失败,停止并报告。
验证通过前,不得启动步骤6(
/review
)。

4. Report

4. 报告

Build complete.
Tasks: <completed>/<total>
Validate: PASS
Next step: /review (Step 6)
Include any DONE_WITH_CONCERNS notes. Update
.branch-context.md
with decisions made during build.
Build complete.
Tasks: <completed>/<total>
Validate: PASS
Next step: /review (Step 6)
包含所有DONE_WITH_CONCERNS的问题记录。将构建过程中做出的决策更新至
.branch-context.md
文件。

Without Plan (Hotfix / One-Sentence Scope)

无计划场景(热修复/单句范围需求)

Implement directly — no subagent orchestration for small scope.
  1. TDD: write failing test (RED), implement fix (GREEN), refactor
  2. Minimal change: fix the defect, nothing else (hotfixes)
  3. Root cause: document in commit message body (hotfixes)
  4. Validate:
    pnpm validate
    — same hard gate, same 3-attempt max
直接实现——小范围需求无需子Agent编排。
  1. TDD: 编写失败测试(RED阶段),实现修复(GREEN阶段),重构
  2. 最小改动: 仅修复缺陷,不做其他修改(热修复场景)
  3. 根本原因: 在提交信息正文中记录(热修复场景)
  4. 验证:
    pnpm validate
    — 同样的硬性关卡,最多尝试3次

Codex / Cursor Fallback

Codex / Cursor 降级方案

No subagent dispatch. Execute tasks sequentially in main session. Same validation gate applies.
不调度子Agent。在主会话中按顺序执行任务。同样适用验证关卡。

Integration

集成关系

RelationSkill
Called by
/task
(Step 5)
Depends on
/plan
(Step 3) +
/review
plan approval (Step 4)
Followed by
/review
build review (Step 6)
Replaces
executing-plans
,
subagent-driven-development
(superpowers)
关系技能
被调用方
/task
(Step 5)
依赖项
/plan
(Step 3) +
/review
计划审批 (Step 4)
后续步骤
/review
构建评审 (Step 6)
替代项
executing-plans
,
subagent-driven-development
(superpowers)