Build-Guard
Plan in isolation, implement with guardrails. Fully autonomous after approval.
Phase 1 — PLAN (read-only)
- Enter plan mode — call
EnterPlanMode. No code changes until Phase 2
- Explore — use Read, Grep, Glob to understand every file related to the task, plus their direct callers and dependents
- Write a numbered plan:
- Each file to change and what changes are needed
- Dependencies between changes (order matters)
- Potential regression risks per change
- Estimated complexity: small (1-2 files), medium (3-5 files), large (6+ files)
- Present the plan for user approval
digraph plan_decision {
"Plan approved" [shape=diamond];
"Small (1-2 files)" [shape=diamond];
"Exit plan mode, implement inline" [shape=box];
"Exit plan mode, dispatch subagents" [shape=box];
"Context heavy?" [shape=diamond];
"Handoff plan, clear context, resume" [shape=box];
"Plan approved" -> "Small (1-2 files)";
"Small (1-2 files)" -> "Exit plan mode, implement inline" [label="yes"];
"Small (1-2 files)" -> "Context heavy?" [label="no"];
"Context heavy?" -> "Handoff plan, clear context, resume" [label="yes"];
"Context heavy?" -> "Exit plan mode, dispatch subagents" [label="no"];
}
If context is heavy after planning (exploration consumed significant context): run /handoff to save the plan, then the user can clear context and resume with full budget for implementation. If remembrall is not installed, save the plan to docs/plans/ as a file instead.
Phase 2 — IMPLEMENT
- Exit plan mode — call
ExitPlanMode
Small plans (1-2 files): implement directly, one file at a time.
Medium/large plans: dispatch subagents.
- One subagent per file or logical chunk (files that must change together)
- Each subagent receives: the plan, its specific task, and relevant file context
- Use
Agent tool with a clear prompt describing exactly what to change and why
- After each file/subagent completes:
- Review the changes (read the modified files)
- Run the project's type checker — fix errors before moving on
- After every 3 completed files, or sooner if a change touches a shared interface:
- Run the full test suite
- If any test breaks: stop immediately, analyze root cause, explain before continuing
- If the approach is fundamentally wrong: revise the plan, inform the user
- After all changes: run the full test suite and type checker one final time
Phase 3 — VERIFY
- Invoke
review-gate — execute the review-gate skill now. Do not declare done until review-gate has completed and all findings are resolved
Rules
- Never skip the plan phase
- Never batch multiple file changes between verification steps
- If no test suite exists: state this, verify manually by reading affected code paths
- If no type checker exists: skip type checking, proceed with tests
- If patrol plugin is active: comply with its warnings. Read files before editing
- If remembrall nudges about context: run
/handoff before continuing
- Never declare done without completing review-gate — non-negotiable
1---2name: build-guard3description: Use when implementing features, refactors, or multi-file changes. Orchestrated plan-then-execute with subagent dispatch and regression checkpoints.4---56# Build-Guard78Plan in isolation, implement with guardrails. Fully autonomous after approval.910## Phase 1 — PLAN (read-only)11121. **Enter plan mode** — call `EnterPlanMode`. No code changes until Phase 2132. **Explore** — use Read, Grep, Glob to understand every file related to the task, plus their direct callers and dependents143. **Write a numbered plan:**15 - Each file to change and what changes are needed16 - Dependencies between changes (order matters)17 - Potential regression risks per change18 - Estimated complexity: **small** (1-2 files), **medium** (3-5 files), **large** (6+ files)194. **Present the plan** for user approval2021```dot22digraph plan_decision {23 "Plan approved" [shape=diamond];24 "Small (1-2 files)" [shape=diamond];25 "Exit plan mode, implement inline" [shape=box];26 "Exit plan mode, dispatch subagents" [shape=box];27 "Context heavy?" [shape=diamond];28 "Handoff plan, clear context, resume" [shape=box];2930 "Plan approved" -> "Small (1-2 files)";31 "Small (1-2 files)" -> "Exit plan mode, implement inline" [label="yes"];32 "Small (1-2 files)" -> "Context heavy?" [label="no"];33 "Context heavy?" -> "Handoff plan, clear context, resume" [label="yes"];34 "Context heavy?" -> "Exit plan mode, dispatch subagents" [label="no"];35}36```3738**If context is heavy after planning** (exploration consumed significant context): run `/handoff` to save the plan, then the user can clear context and resume with full budget for implementation. If remembrall is not installed, save the plan to `docs/plans/` as a file instead.3940## Phase 2 — IMPLEMENT41425. **Exit plan mode** — call `ExitPlanMode`4344**Small plans (1-2 files):** implement directly, one file at a time.4546**Medium/large plans:** dispatch subagents.47- One subagent per file or logical chunk (files that must change together)48- Each subagent receives: the plan, its specific task, and relevant file context49- Use `Agent` tool with a clear prompt describing exactly what to change and why50516. **After each file/subagent completes:**52 - Review the changes (read the modified files)53 - Run the project's type checker — fix errors before moving on547. **After every 3 completed files**, or sooner if a change touches a shared interface:55 - Run the full test suite56 - If any test breaks: **stop immediately**, analyze root cause, explain before continuing57 - If the approach is fundamentally wrong: revise the plan, inform the user588. **After all changes:** run the full test suite and type checker one final time5960## Phase 3 — VERIFY61629. **Invoke `review-gate`** — execute the review-gate skill now. Do not declare done until review-gate has completed and all findings are resolved6364## Rules6566- Never skip the plan phase67- Never batch multiple file changes between verification steps68- If no test suite exists: state this, verify manually by reading affected code paths69- If no type checker exists: skip type checking, proceed with tests70- If patrol plugin is active: comply with its warnings. Read files before editing71- If remembrall nudges about context: run `/handoff` before continuing72- Never declare done without completing review-gate — non-negotiable