Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Execute approved plans by dispatching focused subagents with review loops, checkpoints, and parallelized implementation flow.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: subagent-driven-development3description: Use when executing implementation plans with independent tasks in the current session4---56# Subagent-Driven Development78Execute plan by dispatching fresh subagent per task, with two-stage review after each: spec compliance review first, then code quality review.910**Why subagents:** You delegate tasks to specialized agents with isolated context. By precisely crafting their instructions and context, you ensure they stay focused and succeed at their task. They should never inherit your session's context or history — you construct exactly what they need. This also preserves your own context for coordination work.1112**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration1314## When to Use1516```dot17digraph when_to_use {18"Have implementation plan?" [shape=diamond];19"Tasks mostly independent?" [shape=diamond];20"Stay in this session?" [shape=diamond];21"subagent-driven-development" [shape=box];22"executing-plans" [shape=box];23"Manual execution or brainstorm first" [shape=box];2425"Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];26"Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];27"Tasks mostly independent?" -> "Stay in this session?" [label="yes"];28"Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];29"Stay in this session?" -> "subagent-driven-development" [label="yes"];30"Stay in this session?" -> "executing-plans" [label="no - parallel session"];31}32```3334**vs. Executing Plans (parallel session):**35- Same session (no context switch)36- Fresh subagent per task (no context pollution)37- Two-stage review after each task: spec compliance first, then code quality38- Faster iteration (no human-in-loop between tasks)3940## The Process4142```dot43digraph process {44rankdir=TB;4546subgraph cluster_per_task {47label="Per Task";48"Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];49"Implementer subagent asks questions?" [shape=diamond];50"Answer questions, provide context" [shape=box];51"Implementer subagent implements, tests, commits, self-reviews" [shape=box];52"Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" [shape=box];53"Spec reviewer subagent confirms code matches spec?" [shape=diamond];54"Implementer subagent fixes spec gaps" [shape=box];55"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [shape=box];56"Code quality reviewer subagent approves?" [shape=diamond];57"Implementer subagent fixes quality issues" [shape=box];58"Mark task complete in TodoWrite" [shape=box];59}6061"Read plan, extract all tasks with full text, note context, create TodoWrite" [shape=box];62"More tasks remain?" [shape=diamond];63"Dispatch final code reviewer subagent for entire implementation" [shape=box];64"Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];6566"Read plan, extract all tasks with full text, note context, create TodoWrite" -> "Dispatch implementer subagent (./implementer-prompt.md)";67"Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";68"Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];69"Answer questions, provide context" -> "Dispatch implementer subagent (./implementer-prompt.md)";70"Implementer subagent asks questions?" -> "Implementer subagent implements, tests, commits, self-reviews" [label="no"];71"Implementer subagent implements, tests, commits, self-reviews" -> "Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)";72"Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" -> "Spec reviewer subagent confirms code matches spec?";73"Spec reviewer subagent confirms code matches spec?" -> "Implementer subagent fixes spec gaps" [label="no"];74"Implementer subagent fixes spec gaps" -> "Dispatch spec reviewer subagent (./spec-reviewer-prompt.md)" [label="re-review"];75"Spec reviewer subagent confirms code matches spec?" -> "Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [label="yes"];76"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" -> "Code quality reviewer subagent approves?";77"Code quality reviewer subagent approves?" -> "Implementer subagent fixes quality issues" [label="no"];78"Implementer subagent fixes quality issues" -> "Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [label="re-review"];79"Code quality reviewer subagent approves?" -> "Mark task complete in TodoWrite" [label="yes"];80"Mark task complete in TodoWrite" -> "More tasks remain?";81"More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];82"More tasks remain?" -> "Dispatch final code reviewer subagent for entire implementation" [label="no"];83"Dispatch final code reviewer subagent for entire implementation" -> "Use superpowers:finishing-a-development-branch";84}85```8687## Model Selection8889Use the least powerful model that can handle each role to conserve cost and increase speed.9091**Mechanical implementation tasks** (isolated functions, clear specs, 1-2 files): use a fast, cheap model. Most implementation tasks are mechanical when the plan is well-specified.9293**Integration and judgment tasks** (multi-file coordination, pattern matching, debugging): use a standard model.9495**Architecture, design, and review tasks**: use the most capable available model.9697**Task complexity signals:**98- Touches 1-2 files with a complete spec → cheap model99- Touches multiple files with integration concerns → standard model100- Requires design judgment or broad codebase understanding → most capable model101102## Handling Implementer Status103104Implementer subagents report one of four statuses. Handle each appropriately:105106**DONE:** Proceed to spec compliance review.107108**DONE_WITH_CONCERNS:** The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns are about correctness or scope, address them before review. If they're observations (e.g., "this file is getting large"), note them and proceed to review.109110**NEEDS_CONTEXT:** The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.111112**BLOCKED:** The implementer cannot complete the task. Assess the blocker:1131. If it's a context problem, provide more context and re-dispatch with the same model1142. If the task requires more reasoning, re-dispatch with a more capable model1153. If the task is too large, break it into smaller pieces1164. If the plan itself is wrong, escalate to the human117118**Never** ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.119120## Prompt Templates121122- `./implementer-prompt.md` - Dispatch implementer subagent123- `./spec-reviewer-prompt.md` - Dispatch spec compliance reviewer subagent124- `./code-quality-reviewer-prompt.md` - Dispatch code quality reviewer subagent125126## Example Workflow127128```129You: I'm using Subagent-Driven Development to execute this plan.130131[Read plan file once: docs/superpowers/plans/feature-plan.md]132[Extract all 5 tasks with full text and context]133[Create TodoWrite with all tasks]134135Task 1: Hook installation script136137[Get Task 1 text and context (already extracted)]138[Dispatch implementation subagent with full task text + context]139140Implementer: "Before I begin - should the hook be installed at user or system level?"141142You: "User level (~/.config/superpowers/hooks/)"143144Implementer: "Got it. Implementing now..."145[Later] Implementer:146- Implemented install-hook command147- Added tests, 5/5 passing148- Self-review: Found I missed --force flag, added it149- Committed150151[Dispatch spec compliance reviewer]152Spec reviewer: ✅ Spec compliant - all requirements met, nothing extra153154[Get git SHAs, dispatch code quality reviewer]155Code reviewer: Strengths: Good test coverage, clean. Issues: None. Approved.156157[Mark Task 1 complete]158159Task 2: Recovery modes160161[Get Task 2 text and context (already extracted)]162[Dispatch implementation subagent with full task text + context]163164Implementer: [No questions, proceeds]165Implementer:166- Added verify/repair modes167- 8/8 tests passing168- Self-review: All good169- Committed170171[Dispatch spec compliance reviewer]172Spec reviewer: ❌ Issues:173- Missing: Progress reporting (spec says "report every 100 items")174- Extra: Added --json flag (not requested)175176[Implementer fixes issues]177Implementer: Removed --json flag, added progress reporting178179[Spec reviewer reviews again]180Spec reviewer: ✅ Spec compliant now181182[Dispatch code quality reviewer]183Code reviewer: Strengths: Solid. Issues (Important): Magic number (100)184185[Implementer fixes]186Implementer: Extracted PROGRESS_INTERVAL constant187188[Code reviewer reviews again]189Code reviewer: ✅ Approved190191[Mark Task 2 complete]192193...194195[After all tasks]196[Dispatch final code-reviewer]197Final reviewer: All requirements met, ready to merge198199Done!200```201202## Advantages203204**vs. Manual execution:**205- Subagents follow TDD naturally206- Fresh context per task (no confusion)207- Parallel-safe (subagents don't interfere)208- Subagent can ask questions (before AND during work)209210**vs. Executing Plans:**211- Same session (no handoff)212- Continuous progress (no waiting)213- Review checkpoints automatic214215**Efficiency gains:**216- No file reading overhead (controller provides full text)217- Controller curates exactly what context is needed218- Subagent gets complete information upfront219- Questions surfaced before work begins (not after)220221**Quality gates:**222- Self-review catches issues before handoff223- Two-stage review: spec compliance, then code quality224- Review loops ensure fixes actually work225- Spec compliance prevents over/under-building226- Code quality ensures implementation is well-built227228**Cost:**229- More subagent invocations (implementer + 2 reviewers per task)230- Controller does more prep work (extracting all tasks upfront)231- Review loops add iterations232- But catches issues early (cheaper than debugging later)233234## Red Flags235236**Never:**237- Start implementation on main/master branch without explicit user consent238- Skip reviews (spec compliance OR code quality)239- Proceed with unfixed issues240- Dispatch multiple implementation subagents in parallel (conflicts)241- Make subagent read plan file (provide full text instead)242- Skip scene-setting context (subagent needs to understand where task fits)243- Ignore subagent questions (answer before letting them proceed)244- Accept "close enough" on spec compliance (spec reviewer found issues = not done)245- Skip review loops (reviewer found issues = implementer fixes = review again)246- Let implementer self-review replace actual review (both are needed)247- **Start code quality review before spec compliance is ✅** (wrong order)248- Move to next task while either review has open issues249250**If subagent asks questions:**251- Answer clearly and completely252- Provide additional context if needed253- Don't rush them into implementation254255**If reviewer finds issues:**256- Implementer (same subagent) fixes them257- Reviewer reviews again258- Repeat until approved259- Don't skip the re-review260261**If subagent fails task:**262- Dispatch fix subagent with specific instructions263- Don't try to fix manually (context pollution)264265## Integration266267**Required workflow skills:**268- **superpowers:using-git-worktrees** - REQUIRED: Set up isolated workspace before starting269- **superpowers:writing-plans** - Creates the plan this skill executes270- **superpowers:requesting-code-review** - Code review template for reviewer subagents271- **superpowers:finishing-a-development-branch** - Complete development after all tasks272273**Subagents should use:**274- **superpowers:test-driven-development** - Subagents follow TDD for each task275276**Alternative workflow:**277- **superpowers:executing-plans** - Use for parallel session instead of same-session execution278