Subagent-Driven Development
Overview
Execute implementation plans using fresh subagents for each task, with mandatory reviews between tasks. Three-phase cycle: implement → spec review → code quality review.
Core principle: Fresh context per task, skeptical reviews, fast iteration within session.
When to Use
- •You have a completed implementation plan (from @writing-plans)
- •Tasks are independent enough to be executed by fresh subagents
- •You want fast iteration with quality gates in current session
The Three-Phase Cycle
For each task in the plan:
Phase 1: Implement
- •Dispatch fresh subagent with
implementer-prompt.mdtemplate - •Subagent reads plan, detects mode (TDD/Non-TDD), implements task
- •Subagent verifies work using plan's verification method
- •Subagent commits only after verification passes (using @committing)
- •Subagent returns completion report
Phase 2: Spec Review
- •Dispatch fresh subagent with
spec-reviewer-prompt.mdtemplate - •Subagent verifies implementation matches plan specs
- •Subagent re-runs the verification method from the plan
- •Returns PASS or FAIL with details
- •If FAIL: Loop back to Phase 1 with fixes
Phase 3: Code Quality Review
- •Only runs after Phase 2 PASS
- •Dispatch fresh subagent with
code-quality-reviewer-prompt.mdtemplate - •REQUIRED SKILLS:
- •Use code-review-excellence for quality assessment
- •Use code-simplifier to simplify and clean up code
- •Returns quality assessment with simplification suggestions
- •If issues found: Address before next task
Process Flow
code
┌─────────────────────────────────────────────────────────┐ │ For Each Task │ ├─────────────────────────────────────────────────────────┤ │ │ │ ┌──────────────┐ │ │ │ Phase 1: │ │ │ │ Implement │──────────────────────┐ │ │ └──────────────┘ │ │ │ │ │ │ │ ▼ │ │ │ ┌──────────────┐ │ │ │ │ Phase 2: │ FAIL │ │ │ │ Spec Review │──────────────────────┘ │ │ └──────────────┘ │ │ │ PASS │ │ ▼ │ │ ┌──────────────┐ │ │ │ Phase 3: │ │ │ │ Code Review │ │ │ └──────────────┘ │ │ │ │ │ ▼ │ │ Next Task │ └─────────────────────────────────────────────────────────┘
TodoWrite Integration
Create TodoWrite at start with structure:
code
Task 1: [Name from plan] - [ ] Phase 1: Implement - [ ] Phase 2: Spec Review - [ ] Phase 3: Code Quality Review Task 2: [Name from plan] - [ ] Phase 1: Implement ...
Update after each phase completion.
Orchestrator Responsibilities
As the orchestrator (main agent), you:
- •Create TodoWrite from plan tasks
- •Dispatch subagents using Task tool with appropriate prompts
- •Review subagent reports between phases
- •Handle failures - dispatch fix attempts, escalate if stuck
- •Track progress - update TodoWrite after each phase
- •Report to user after each task cycle completes
Subagent Dispatch Pattern
code
Task tool call: - subagent_type: "general-purpose" - prompt: [Load and fill template from prompt file] - Include: plan file path, task number, relevant context
Remember
- •Fresh subagent = fresh context (no accumulated confusion)
- •Spec review is skeptical - verify code, not claims
- •REQUIRED SKILLS: Use code-review-excellence + code-simplifier for code quality reviews
- •@committing for all commits
- •Stop and escalate if spec review fails 3 times
- •User can intervene between any phases