|
|
|
|
@@ -1,17 +1,17 @@
|
|
|
|
|
---
|
|
|
|
|
name: subagent-driven-development
|
|
|
|
|
description: Use when executing implementation plans with independent tasks in the current session
|
|
|
|
|
description: Manual-only skill. Activate only after an explicit user request for superpowers-lite:subagent-driven-development.
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# Subagent-Driven Development
|
|
|
|
|
|
|
|
|
|
Execute plan by dispatching fresh subagent per task, with two-stage review after each: spec compliance review first, then code quality review.
|
|
|
|
|
Execute plan by dispatching fresh subagent per phase, where a phase may contain one or more related tasks. Run a two-stage review after each phase: spec compliance review first, then code quality review.
|
|
|
|
|
|
|
|
|
|
**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.
|
|
|
|
|
|
|
|
|
|
**Core principle:** Fresh subagent per task + two-stage review (spec then quality) = high quality, fast iteration
|
|
|
|
|
**Core principle:** Fresh subagent per coherent phase + two-stage review (spec then quality) = high quality without review overhead on every tiny task
|
|
|
|
|
|
|
|
|
|
**Continuous execution:** Do not pause to check in with your human partner between tasks. Execute all tasks from the plan without stopping. The only reasons to stop are: BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
|
|
|
|
|
**Continuous execution:** Do not pause to check in with your human partner between phases unless blocked. Execute all tasks from the plan in the current branch without stopping. The only reasons to stop are: current branch is `main` or `master`, BLOCKED status you cannot resolve, ambiguity that genuinely prevents progress, or all tasks complete. "Should I continue?" prompts and progress summaries waste their time — they asked you to execute the plan, so execute it.
|
|
|
|
|
|
|
|
|
|
## When to Use
|
|
|
|
|
|
|
|
|
|
@@ -35,18 +35,29 @@ digraph when_to_use {
|
|
|
|
|
|
|
|
|
|
**vs. Executing Plans (parallel session):**
|
|
|
|
|
- Same session (no context switch)
|
|
|
|
|
- Fresh subagent per task (no context pollution)
|
|
|
|
|
- Two-stage review after each task: spec compliance first, then code quality
|
|
|
|
|
- Fresh subagent per phase (no context pollution)
|
|
|
|
|
- Two-stage review after each phase: spec compliance first, then code quality
|
|
|
|
|
- Faster iteration (no human-in-loop between tasks)
|
|
|
|
|
|
|
|
|
|
## Phase Grouping
|
|
|
|
|
|
|
|
|
|
Before grouping phases, confirm the current git branch is not `main` or `master` with `git branch --show-current`. If it is, stop and ask the user to switch or create a feature branch. Do not create or switch to a worktree unless the user explicitly asks.
|
|
|
|
|
|
|
|
|
|
Before dispatching implementers, group tasks into phases:
|
|
|
|
|
|
|
|
|
|
- Group adjacent tasks when they touch the same files, complete one coherent behavior, or would create review churn if split
|
|
|
|
|
- Keep a task as its own phase when it is risky, broad, independent, or likely to need a focused review
|
|
|
|
|
- Never group tasks just to hide uncertainty; if grouping makes requirements harder to verify, split the phase
|
|
|
|
|
- Record phase membership in TodoWrite so progress is visible at both phase and task level
|
|
|
|
|
|
|
|
|
|
## The Process
|
|
|
|
|
|
|
|
|
|
```dot
|
|
|
|
|
digraph process {
|
|
|
|
|
rankdir=TB;
|
|
|
|
|
|
|
|
|
|
subgraph cluster_per_task {
|
|
|
|
|
label="Per Task";
|
|
|
|
|
subgraph cluster_per_phase {
|
|
|
|
|
label="Per Phase";
|
|
|
|
|
"Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
|
|
|
|
|
"Implementer subagent asks questions?" [shape=diamond];
|
|
|
|
|
"Answer questions, provide context" [shape=box];
|
|
|
|
|
@@ -57,15 +68,15 @@ digraph process {
|
|
|
|
|
"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [shape=box];
|
|
|
|
|
"Code quality reviewer subagent approves?" [shape=diamond];
|
|
|
|
|
"Implementer subagent fixes quality issues" [shape=box];
|
|
|
|
|
"Mark task complete in TodoWrite" [shape=box];
|
|
|
|
|
"Mark phase tasks complete in TodoWrite" [shape=box];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
"Read plan, extract all tasks with full text, note context, create TodoWrite" [shape=box];
|
|
|
|
|
"More tasks remain?" [shape=diamond];
|
|
|
|
|
"Read plan, extract all tasks with full text, group into phases, note context, create TodoWrite" [shape=box];
|
|
|
|
|
"More phases remain?" [shape=diamond];
|
|
|
|
|
"Dispatch final code reviewer subagent for entire implementation" [shape=box];
|
|
|
|
|
"Use superpowers:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
|
|
|
|
|
"Use superpowers-lite:finishing-a-development-branch" [shape=box style=filled fillcolor=lightgreen];
|
|
|
|
|
|
|
|
|
|
"Read plan, extract all tasks with full text, note context, create TodoWrite" -> "Dispatch implementer subagent (./implementer-prompt.md)";
|
|
|
|
|
"Read plan, extract all tasks with full text, group into phases, note context, create TodoWrite" -> "Dispatch implementer subagent (./implementer-prompt.md)";
|
|
|
|
|
"Dispatch implementer subagent (./implementer-prompt.md)" -> "Implementer subagent asks questions?";
|
|
|
|
|
"Implementer subagent asks questions?" -> "Answer questions, provide context" [label="yes"];
|
|
|
|
|
"Answer questions, provide context" -> "Dispatch implementer subagent (./implementer-prompt.md)";
|
|
|
|
|
@@ -78,11 +89,11 @@ digraph process {
|
|
|
|
|
"Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" -> "Code quality reviewer subagent approves?";
|
|
|
|
|
"Code quality reviewer subagent approves?" -> "Implementer subagent fixes quality issues" [label="no"];
|
|
|
|
|
"Implementer subagent fixes quality issues" -> "Dispatch code quality reviewer subagent (./code-quality-reviewer-prompt.md)" [label="re-review"];
|
|
|
|
|
"Code quality reviewer subagent approves?" -> "Mark task complete in TodoWrite" [label="yes"];
|
|
|
|
|
"Mark task complete in TodoWrite" -> "More tasks remain?";
|
|
|
|
|
"More tasks remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
|
|
|
|
|
"More tasks remain?" -> "Dispatch final code reviewer subagent for entire implementation" [label="no"];
|
|
|
|
|
"Dispatch final code reviewer subagent for entire implementation" -> "Use superpowers:finishing-a-development-branch";
|
|
|
|
|
"Code quality reviewer subagent approves?" -> "Mark phase tasks complete in TodoWrite" [label="yes"];
|
|
|
|
|
"Mark phase tasks complete in TodoWrite" -> "More phases remain?";
|
|
|
|
|
"More phases remain?" -> "Dispatch implementer subagent (./implementer-prompt.md)" [label="yes"];
|
|
|
|
|
"More phases remain?" -> "Dispatch final code reviewer subagent for entire implementation" [label="no"];
|
|
|
|
|
"Dispatch final code reviewer subagent for entire implementation" -> "Use superpowers-lite:finishing-a-development-branch";
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
@@ -130,14 +141,15 @@ Implementer subagents report one of four statuses. Handle each appropriately:
|
|
|
|
|
```
|
|
|
|
|
You: I'm using Subagent-Driven Development to execute this plan.
|
|
|
|
|
|
|
|
|
|
[Read plan file once: docs/superpowers/plans/feature-plan.md]
|
|
|
|
|
[Read plan file once: .superpowers-lite/plans/feature-plan.md]
|
|
|
|
|
[Extract all 5 tasks with full text and context]
|
|
|
|
|
[Create TodoWrite with all tasks]
|
|
|
|
|
[Group into 3 phases: Phase 1 = Task 1, Phase 2 = Tasks 2-3, Phase 3 = Tasks 4-5]
|
|
|
|
|
[Create TodoWrite with all phases and tasks]
|
|
|
|
|
|
|
|
|
|
Task 1: Hook installation script
|
|
|
|
|
Phase 1: Hook installation script
|
|
|
|
|
|
|
|
|
|
[Get Task 1 text and context (already extracted)]
|
|
|
|
|
[Dispatch implementation subagent with full task text + context]
|
|
|
|
|
[Dispatch implementation subagent with full phase text + context]
|
|
|
|
|
|
|
|
|
|
Implementer: "Before I begin - should the hook be installed at user or system level?"
|
|
|
|
|
|
|
|
|
|
@@ -156,12 +168,12 @@ Spec reviewer: ✅ Spec compliant - all requirements met, nothing extra
|
|
|
|
|
[Get git SHAs, dispatch code quality reviewer]
|
|
|
|
|
Code reviewer: Strengths: Good test coverage, clean. Issues: None. Approved.
|
|
|
|
|
|
|
|
|
|
[Mark Task 1 complete]
|
|
|
|
|
[Mark Phase 1 tasks complete]
|
|
|
|
|
|
|
|
|
|
Task 2: Recovery modes
|
|
|
|
|
Phase 2: Recovery modes and CLI wiring
|
|
|
|
|
|
|
|
|
|
[Get Task 2 text and context (already extracted)]
|
|
|
|
|
[Dispatch implementation subagent with full task text + context]
|
|
|
|
|
[Get Task 2 and Task 3 text and context (already extracted)]
|
|
|
|
|
[Dispatch implementation subagent with full phase text + context]
|
|
|
|
|
|
|
|
|
|
Implementer: [No questions, proceeds]
|
|
|
|
|
Implementer:
|
|
|
|
|
@@ -190,7 +202,7 @@ Implementer: Extracted PROGRESS_INTERVAL constant
|
|
|
|
|
[Code reviewer reviews again]
|
|
|
|
|
Code reviewer: ✅ Approved
|
|
|
|
|
|
|
|
|
|
[Mark Task 2 complete]
|
|
|
|
|
[Mark Phase 2 tasks complete]
|
|
|
|
|
|
|
|
|
|
...
|
|
|
|
|
|
|
|
|
|
@@ -205,8 +217,8 @@ Done!
|
|
|
|
|
|
|
|
|
|
**vs. Manual execution:**
|
|
|
|
|
- Subagents follow TDD naturally
|
|
|
|
|
- Fresh context per task (no confusion)
|
|
|
|
|
- Parallel-safe (subagents don't interfere)
|
|
|
|
|
- Fresh context per phase (less confusion)
|
|
|
|
|
- Parallel-safe when phases do not share files (subagents do not interfere)
|
|
|
|
|
- Subagent can ask questions (before AND during work)
|
|
|
|
|
|
|
|
|
|
**vs. Executing Plans:**
|
|
|
|
|
@@ -228,7 +240,7 @@ Done!
|
|
|
|
|
- Code quality ensures implementation is well-built
|
|
|
|
|
|
|
|
|
|
**Cost:**
|
|
|
|
|
- More subagent invocations (implementer + 2 reviewers per task)
|
|
|
|
|
- More subagent invocations than inline work (implementer + 2 reviewers per phase)
|
|
|
|
|
- Controller does more prep work (extracting all tasks upfront)
|
|
|
|
|
- Review loops add iterations
|
|
|
|
|
- But catches issues early (cheaper than debugging later)
|
|
|
|
|
@@ -236,10 +248,10 @@ Done!
|
|
|
|
|
## Red Flags
|
|
|
|
|
|
|
|
|
|
**Never:**
|
|
|
|
|
- Start implementation on main/master branch without explicit user consent
|
|
|
|
|
- Skip reviews (spec compliance OR code quality)
|
|
|
|
|
- Start implementation on `main` or `master`
|
|
|
|
|
- Skip phase reviews (spec compliance OR code quality)
|
|
|
|
|
- Proceed with unfixed issues
|
|
|
|
|
- Dispatch multiple implementation subagents in parallel (conflicts)
|
|
|
|
|
- Dispatch multiple implementation subagents in parallel when phases share files or state
|
|
|
|
|
- Make subagent read plan file (provide full text instead)
|
|
|
|
|
- Skip scene-setting context (subagent needs to understand where task fits)
|
|
|
|
|
- Ignore subagent questions (answer before letting them proceed)
|
|
|
|
|
@@ -247,7 +259,7 @@ Done!
|
|
|
|
|
- Skip review loops (reviewer found issues = implementer fixes = review again)
|
|
|
|
|
- Let implementer self-review replace actual review (both are needed)
|
|
|
|
|
- **Start code quality review before spec compliance is ✅** (wrong order)
|
|
|
|
|
- Move to next task while either review has open issues
|
|
|
|
|
- Move to next phase while either review has open issues
|
|
|
|
|
|
|
|
|
|
**If subagent asks questions:**
|
|
|
|
|
- Answer clearly and completely
|
|
|
|
|
@@ -260,20 +272,22 @@ Done!
|
|
|
|
|
- Repeat until approved
|
|
|
|
|
- Don't skip the re-review
|
|
|
|
|
|
|
|
|
|
**If subagent fails task:**
|
|
|
|
|
**If subagent fails a phase:**
|
|
|
|
|
- Dispatch fix subagent with specific instructions
|
|
|
|
|
- Don't try to fix manually (context pollution)
|
|
|
|
|
|
|
|
|
|
## Integration
|
|
|
|
|
|
|
|
|
|
**Required workflow skills:**
|
|
|
|
|
- **superpowers:using-git-worktrees** - Ensures isolated workspace (creates one or verifies existing)
|
|
|
|
|
- **superpowers:writing-plans** - Creates the plan this skill executes
|
|
|
|
|
- **superpowers:requesting-code-review** - Code review template for reviewer subagents
|
|
|
|
|
- **superpowers:finishing-a-development-branch** - Complete development after all tasks
|
|
|
|
|
- **superpowers-lite:writing-plans** - Creates the plan this skill executes
|
|
|
|
|
- **superpowers-lite:requesting-code-review** - Code review template for reviewer subagents
|
|
|
|
|
- **superpowers-lite:finishing-a-development-branch** - Complete development after all tasks
|
|
|
|
|
|
|
|
|
|
**Optional workflow skills:**
|
|
|
|
|
- **superpowers-lite:using-git-worktrees** - Use only when the user explicitly asks for an isolated workspace
|
|
|
|
|
|
|
|
|
|
**Subagents should use:**
|
|
|
|
|
- **superpowers:test-driven-development** - Subagents follow TDD for each task
|
|
|
|
|
- **superpowers-lite:test-driven-development** - Subagents follow TDD for each task
|
|
|
|
|
|
|
|
|
|
**Alternative workflow:**
|
|
|
|
|
- **superpowers:executing-plans** - Use for parallel session instead of same-session execution
|
|
|
|
|
- **superpowers-lite:executing-plans** - Use for parallel session instead of same-session execution
|
|
|
|
|
|