Internal skill invoked by /programming chain. Use when you have an implementation plan to execute, dispatching subagents per task - triggers on plan execution, task dispatch, subagent workflow
Execute plan by dispatching fresh subagent per task, with two-stage review after each: spec compliance first, then code quality. Every step commits, so session interruption loses at most one task's work.
Core principles:
Read plan → Extract all tasks with full text → Create TodoWrite → Record base SHA
For each task:
1. Dispatch implementer subagent (worktree-isolated)
- Subagent loads /implement + appropriate language skill
- /implement runs TDD loop: tests → code → validate → /audit-code (4 agents) → repeat
- Loop continues until /audit-code returns clean
2. Answer questions if asked
3. Merge worktree branch back to feature branch
4. Mark task complete in TodoWrite
After all tasks:
5. Dispatch /audit-code across entire implementation (cross-task integration audit)
6. Verify all tests pass
7. Present branch completion options
get_plan (brain-mcp tool) using the plan:// URL. If given a file path instead, read the file — but plans should be stored in the graph.git rev-parse HEAD — this is the recovery checkpointRecovery detection: If the plan exists (via get_plan) and TodoWrite has tasks marked complete, this is a resumed session. Verify completed tasks by checking git log for their commits, then continue from the first incomplete task. Update task statuses in the plan via update_plan as work progresses.
Dispatch implementer subagent with isolation: "worktree":
/implement + the appropriate language skill from the dispatch table in /programmingImplement Task N: [name]
Context: [brief description of where this fits]
[Full task text from plan, verbatim]
Requirements:
- Load /implement and follow its TDD loop
- Load [language skill] for patterns and conventions
- The /implement loop will dispatch /audit-code after each round
- Loop continues until the auditor returns a clean report
- Commit when audit passes with message: "feat(task-N): [description]"
- Write implementation decisions to statement-mcp as handoff messages
- Return summary of what you built, audit rounds needed, and the commit SHA
Worktree isolation: Each implementer runs in its own worktree. This means:
After subagent returns: Merge its worktree branch back to the feature branch. This is the durable checkpoint — if the session dies after this merge, the task's work is preserved.
If implementer asks questions: Answer clearly and completely. Provide additional context. Don't rush them into implementation.
After merge: Mark task complete in TodoWrite immediately. The /implement loop already ran /audit-code until clean — no additional review dispatch needed per task.
If the session is interrupted at any point, the next session can recover:
| Interrupted during... | State on disk | Recovery action |
|---|---|---|
| Subagent implementing | Worktree has partial work, feature branch clean | Discard worktree, re-run task |
| Merge back to feature branch | Feature branch has commit, TodoWrite not updated | Check git log, mark task complete, continue |
| Spec/quality review | Feature branch has commit, task incomplete | Re-run review only |
| Fix subagent after review | Worktree has partial fix | Discard worktree, re-run fix |
| Between tasks | TodoWrite accurate, all commits on feature branch | Continue from next incomplete task |
Key invariant: The feature branch only receives complete, tested, committed work. Partial work lives in worktrees that can be safely discarded.
After all tasks complete:
/audit-code across the ENTIRE implementation (all tasks combined). This catches interaction effects between independently-implemented tasks that per-task audits couldn't see.Present exactly these options:
Implementation complete. What would you like to do?
1. Merge back to <base-branch> locally
2. Push and create a Pull Request
3. Keep the branch as-is (I'll handle it later)
4. Discard this work
Option 1 — Merge locally: checkout base, pull latest, merge feature, verify tests on merged result, delete feature branch.
Option 2 — Create PR: push branch, gh pr create with summary and test plan.
Option 3 — Keep as-is: report branch name and path, preserve everything.
Option 4 — Discard: require typed "discard" confirmation. Show what will be deleted (branch, commits, worktree). Only then delete.
When receiving review feedback from any source:
Never:
If subagent asks questions: Answer before letting them proceed.
If subagent fails: Dispatch fix subagent with specific instructions. Don't fix manually (context pollution). Use worktree isolation.
If cross-task audit finds issues: Dispatch fix subagent (worktree-isolated) → fix subagent commits → merge back → re-audit. Don't skip re-audit.
If session may be interrupted: Every commit on the feature branch is a recovery checkpoint. TodoWrite state plus git log are sufficient to resume from any point.
plan:// node)From production sessions: 18 tasks across 3 projects (xnn, OnShape, focus_stacking) executed via this workflow. Spec compliance review caught over-building (extra flags not in spec) and under-building (missing progress reporting). Code quality review caught magic numbers and duplicate code. Two-stage review found issues that single-pass review missed — spec compliance ensures correctness, quality review ensures craftsmanship.