/superpowers-optimized:subagent-driven-developmentfrom superpowers-optimized
Executes plans by dispatching parallel subagents per task with staged review gates. Useful for large plans with independent tasks.
Ships in superpowers-optimized. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Execute a plan with fresh subagents per task and strict review gates.
Announce: I'm using subagent-driven-development to execute this plan.
digraph sdd_process {
rankdir=TB;
subgraph cluster_per_task {
label="Per Task (or batch)";
"Dispatch implementer subagent" [shape=box];
"Implementer asks questions?" [shape=diamond];
"Answer questions, provide context" [shape=box];
"Implementer implements, tests, self-reviews" [shape=box];
"Dispatch ONE task reviewer\n(spec verdict + quality verdict)" [shape=box];
"Resolve any 'cannot verify from diff' items yourself" [shape=box];
"Both verdicts pass?" [shape=diamond];
"Fix round R of 5" [shape=box];
"R = 5?" [shape=diamond];
"Adjudicate open findings, record each decision" [shape=box];
"Mark task complete" [shape=box];
}
"Read plan + spec + Global Constraints, create tracking" [shape=box];
"Pre-flight interface scan" [shape=box];
"Group into waves; batch same-shape tasks" [shape=box];
"More tasks?" [shape=diamond];
"Final whole-branch review" [shape=box];
"Invoke finishing-a-development-branch" [shape=doublecircle];
"Read plan + spec + Global Constraints, create tracking" -> "Pre-flight interface scan";
"Pre-flight interface scan" -> "Group into waves; batch same-shape tasks";
"Group into waves; batch same-shape tasks" -> "Dispatch implementer subagent";
"Dispatch implementer subagent" -> "Implementer asks questions?";
"Implementer asks questions?" -> "Answer questions, provide context" [label="yes"];
"Answer questions, provide context" -> "Dispatch implementer subagent";
"Implementer asks questions?" -> "Implementer implements, tests, self-reviews" [label="no"];
"Implementer implements, tests, self-reviews" -> "Dispatch ONE task reviewer\n(spec verdict + quality verdict)";
"Dispatch ONE task reviewer\n(spec verdict + quality verdict)" -> "Resolve any 'cannot verify from diff' items yourself";
"Resolve any 'cannot verify from diff' items yourself" -> "Both verdicts pass?";
"Both verdicts pass?" -> "Mark task complete" [label="yes"];
"Both verdicts pass?" -> "Fix round R of 5" [label="no"];
"Fix round R of 5" -> "R = 5?";
"R = 5?" -> "Dispatch ONE task reviewer\n(spec verdict + quality verdict)" [label="no - re-review"];
"R = 5?" -> "Adjudicate open findings, record each decision" [label="yes - breaker trips"];
"Adjudicate open findings, record each decision" -> "Mark task complete";
"Mark task complete" -> "More tasks?";
"More tasks?" -> "Dispatch implementer subagent" [label="yes"];
"More tasks?" -> "Final whole-branch review" [label="no"];
"Final whole-branch review" -> "Invoke finishing-a-development-branch";
}
Consumes list names something, confirm an earlier task's Produces list defines it with the same name and shape. Mismatches found here cost one edit to the plan; the same mismatch found mid-run costs a failed task, a fix round, and a re-review. Raise everything you find in one pass rather than stumbling into it task by task. A plan whose tasks share no interfaces needs no scan — say so and move on.bash scripts/task-brief PLAN_FILE N and dispatch the implementer with the brief path it prints — not the pasted task text (see Handing Work Over as Files).bash scripts/review-package PLAN_FILE BASE HEAD, then dispatch one task review with the package path — both a spec verdict and a quality verdict (see Task Review below).- [ ] to - [x]. If state.md exists with a plan status section, update it to reflect the completed task.
frontend-design standards to guide structure, styling, and accessibility.bash scripts/review-package PLAN_FILE $(git merge-base origin/main HEAD) HEAD, then dispatch requesting-code-review with that package path and the plan's Review Focus section verbatim. Name the model explicitly — an omitted model silently inherits the session's.finishing-a-development-branch.When tasks are independent and touch disjoint files, dispatch them as a wave — this is the preferred mode, not a special case. Sequential execution is the fallback for dependent tasks, not the default.
Decision rule: Before starting execution, group tasks into waves based on file overlap and state dependencies. Tasks with no shared files and no sequential dependency belong in the same wave.
- [ ] → - [x]) and sync state.md if present.If any overlap or shared-state risk exists within a wave, move the conflicting task to the next sequential wave.
Why single-message dispatch matters for cost: All subagents share the same cached system prompt prefix. Dispatching them simultaneously in one message means every agent gets a cache hit on that prefix and only pays for its small unique task prompt. Staggered dispatch provides no additional benefit and wastes wall-clock time.
When the plan lists several tasks that are each a small, independent edit of the same kind — the same one-line fix, the same constant change, the same field added across several files — do not dispatch one subagent per task.
Compose one brief listing every file and its change, dispatch it to a single subagent, and review the resulting diff as one unit.
Batch when all of these hold:
Do not batch work that needs its own judgment, its own tests, or its own review surface. A task that earns a real test cycle earns its own dispatch.
Batching is distinct from a parallel wave: a wave runs N subagents at once, a batch runs one subagent doing N small things. For micro-task plans the batch is dramatically cheaper — N dispatches each rebuild the same context from zero. When a batch review finds a problem, verify every file named in the brief actually appears in the diff before accepting it; a batched implementer that silently skips one file is the batch's characteristic failure.
One reviewer per task, two mandatory verdicts. A single reviewer reads the task's diff once and returns both:
Both are required. A review returning only one verdict is incomplete — send it back. Two separate reviewers were previously dispatched here; they read the same diff and the same task text, rebuilt the same context twice, and split findings across two fix round-trips that one reviewer surfaces in one. The reviewer template's Spec Alignment section already covers what the separate spec reviewer was asked to do.
The third verdict: "cannot verify from diff." Some requirements live in code the task did not touch, or span several tasks. The reviewer lists these rather than guessing. They do not block the review, but you resolve each one before marking the task complete — you hold the plan and the cross-task context the reviewer lacks. A "cannot verify" item you confirm as a real gap becomes a failed spec verdict and enters the fix loop with everything else.
Never coach the reviewer. Do not tell it to ignore a finding, skip an area, or treat something as "Minor at most." If you believe a finding would be a false positive, let it be raised and resolve it in the fix loop. If the prompt you are writing contains "do not flag", "don't treat X as a defect", or "the plan chose this" — stop. You are pre-judging to spare yourself a review round.
Hand the reviewer its diff as a file. Run bash scripts/review-package PLAN_FILE BASE HEAD and pass the path it prints. The reviewer then makes one Read call instead of composing three git commands, and the script has already refused the two ranges that cannot mean what they claim — empty, and spanning a branch point. Never dispatch a reviewer without a package.
Template: ./task-reviewer-prompt.md
A fix round is one fix dispatch plus one re-review. Five rounds maximum per task.
When round 5 still leaves findings open, stop dispatching and decide each one yourself:
Adjudicate only at the cap. Adjudicating early to end a loop is pre-judging under another name. Every adjudication gets written down — a silent discard is forbidden. Surface all of them in your final report: these are decisions you took on the user's behalf, and the report is the only place they see them.
When dispatching subagents that start background services (servers, databases, queues):
Subagents are stateless — they do not know about processes started by previous subagents. Accumulated background processes cause port conflicts, stale responses, and false test results.
Include in the subagent prompt for any E2E or service-dependent task:
Unix/macOS:
Before starting any service:
1. Kill existing instances: pkill -f "<service-pattern>" 2>/dev/null || true
2. Verify the port is free: lsof -i :<port> && echo "ERROR: port still in use" || echo "Port free"
After tests complete:
1. Kill the service you started.
2. Verify cleanup: pgrep -f "<service-pattern>" && echo "WARNING: still running" || echo "Cleanup verified"
Windows:
Before starting any service:
1. Kill existing instances: taskkill /F /IM "<process-name>" 2>nul || echo "No existing process"
2. Verify the port is free: netstat -ano | findstr :<port> && echo "ERROR: port still in use" || echo "Port free"
After tests complete:
1. Kill the service you started.
2. Verify cleanup: tasklist | findstr "<process-name>" && echo "WARNING: still running" || echo "Cleanup verified"
Exception: persistent dev servers the user explicitly keeps running — document them in state.md.
Implementer subagents report one of four statuses. Handle each appropriately:
DONE: Proceed to spec compliance review.
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.
NEEDS_CONTEXT: The implementer needs information that wasn't provided. Provide the missing context and re-dispatch.
BLOCKED: The implementer cannot complete the task. Assess the blocker:
state.md and advance to the next independent task.Never ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change. Never silently skip or mark a blocked task complete.
The user follows the run through your messages between dispatches, and every task notification prompts one. Keep each to what just changed, in one or two lines — "Task 3 implemented; review found 2 issues, fix round 1 dispatched." Do not restate the plan, earlier tasks, or upcoming steps each time. The full account — adjudications, deferred findings, what was verified — belongs in the final report.
main/master without explicit user permission.scripts/task-brief is for.Never forward parent session context or history to subagents. Construct each subagent's prompt from scratch using only:
Exclude unrelated prior assistant analysis and old failed hypotheses. Subagents must not receive conversation history, prior reasoning chains, or context from other subagent runs.
Why this is also the cache-optimal approach: All subagents share the same system prompt prefix, which the API caches. Keeping each subagent's input as [cached system prompt] + [small unique task prompt] means every agent hits the cache for the heavy shared prefix and only pays full input token price for its small task-specific tail. Forwarding parent conversation history would make each subagent's prefix unique, breaking cache sharing and multiplying input costs across the wave.
Note what that argument does not license: the cached part is the system prefix, and the unique tail is uncached either way. Pasting a task's full text into the prompt makes that tail bigger, so the same reasoning that bans forwarding history also argues for passing a path instead of a paste. A brief path is the smallest possible tail.
Everything you paste into a dispatch prompt, and everything a subagent prints back, stays in your context for the rest of the session and is re-read on every later turn. Hand artifacts over as files.
The controller has already read the plan. Pasting a task into a dispatch puts a second copy in your context, and an inline report puts a third block beside it. Measured against a real 18-task plan in this repo: ~605 tokens per task pasted versus ~75 passed as paths — about 9,500 tokens of permanent, repeatedly re-read context across the run.
Per task:
bash scripts/task-brief PLAN_FILE N — writes a self-contained brief (plan identity, Spec pointer, Global Constraints, the task body) and prints its path. The task id matches exactly: 3 never matches Task 3.1 or Task 10.task-N-brief.md → task-N-report.md, in the same directory — and put that path in the dispatch. The implementer writes its full report there and returns only status, commits, a one-line test summary, and concerns.bash scripts/review-package PLAN_FILE BASE HEAD.Exact values — numbers, magic strings, signatures, test cases — live in the brief and nowhere else. A dispatch prompt describes one task; it never carries the session's history. Do not paste "state after Tasks 1–3" summaries into later dispatches: a fresh subagent needs its brief, the interfaces it touches, and the global constraints. Nothing else.
The workspace lives at <repo-root>/.superpowers/sdd/<plan-name>/ and ignores itself, so briefs and reports never reach a commit. It is scratch: git clean -fdx will delete it, and git log is the durable record. Each plan owns its own directory — another plan's directory is never yours to read or write.
Two separate leaks, one instruction block. Every subagent prompt MUST carry both.
Skill leakage. Subagents can discover superpowers-optimized skills via filesystem access and invoke them, turning a focused implementer into a workflow orchestrator.
Dispatch leakage. A subagent that spawns its own subagents is spending your budget without your knowledge. The common case is an implementer dispatching a reviewer "to be safe" — which duplicates the task review you dispatch anyway, at a full extra review seat per task, and whose verdict counts for nothing because you never see it. A reviewer spawning a second reviewer for a "second opinion" is the same defect. Review arrives from the controller, after the report.
Every subagent prompt MUST include this instruction:
You are a focused subagent. Do NOT invoke any skills from the superpowers-optimized plugin. Do NOT use the Skill tool. Do NOT dispatch, spawn, or delegate to any subagent of your own — not helpers, not reviewers, not a second opinion. Do all of this work yourself. If the job feels too large for one pass, do it in several passes yourself and say so in your report. Your only job is the task described below.
An implementer or reviewer that spawned a subagent anyway is reporting a defect, not extra rigor — note it and do not count its nested verdict.
Choose model based on task type when dispatching subagents via the Agent tool:
| Model | Use for |
|---|---|
haiku | File reads, summarization, log scanning, patch verification — output is data, not decisions |
sonnet | Default for all implementation tasks |
opus | Architecture analysis, complex spec review, multi-system debugging, any task requiring reasoning across many constraints at once |
Apply via the model parameter in Agent tool calls. Default to sonnet when uncertain. Only upgrade to opus when the task is genuinely reasoning-heavy — not just large.
Use:
./implementer-prompt.md — per task or per batch./task-reviewer-prompt.md — one per task, returns both verdictsbash scripts/task-brief PLAN_FILE TASK_ID — writes the task's self-contained brief and prints its path. Exit 2 means no task with that id exists; it lists the ids it found. Never dispatch on a brief you did not get a path back for.bash scripts/review-package PLAN_FILE BASE HEAD — writes the commit list, stat, and full diff to one file and prints its path. Exit 3 means the range is empty or BASE is not an ancestor of HEAD — do not review, and do not work around it. An empty range hands a reviewer nothing and gets back "no issues found"; that is a review of nothing, and the task would be marked reviewed. Fix the range instead: BASE is the commit recorded before the implementer was dispatched, or git merge-base origin/main HEAD for the whole branch.Invoke bundled scripts through their interpreter (bash scripts/task-brief …) rather than executing them directly. Some plugin packagers strip executable bits, and a direct call then fails with Permission denied.
Every review needs a base commit. Getting this wrong silently reviews the wrong thing.
git rev-parse HEAD before dispatching the implementer and use that as BASE_SHA. Never HEAD~1 — a task that made several commits would have all but the last silently dropped from the diff.git merge-base origin/main HEAD (substitute your default branch). Never a bare origin/main: once main moves past your branch point, main's newer files show up in the diff as phantom deletions your branch never made, and the reviewer spends the review on them.origin/main is not fetched or the repo has no remote, use git merge-base main HEAD.using-git-worktrees../task-reviewer-prompt.md; the final whole-branch review uses requesting-code-review.finishing-a-development-branch.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
24 skills in this plugin
/brainstormingUse when the user wants new features, behavior changes, refactoring with new capabilities, or architecture decisions and no approved design exists yet. Produces a design before any code is written — in the conversation for small changes, as an approved spec document for larger work. Triggers on: "build this", "add a feature", "I want to change", "how should we", "design", "architect", "new project", "refactor", "we need to add/build/create", "implement a new". Routed by using-superpowers, or invoke directly via /brainstorming.
/claude-md-creatorCreates minimal, high-signal CLAUDE.md and AGENTS.md context files based on empirical best practices. Invoke on /init command, "create CLAUDE.md", "update CLAUDE.md", "write AGENTS.md", or "set up Claude Code for this project". Also invoked by brainstorming when repo lacks a context file. tools: Read, Glob, Grep, Bash, Edit
/context-managementUse in long or noisy sessions to persist durable state across session boundaries via state.md. Also generates project-map.md when asked to map the project. Triggers on: user explicitly asks to "save state", "compress context", "map this project", "generate project map", "create project map", cross-session handoff needed, or repeated failures indicate context is getting stale.
/deliberationUse BEFORE brainstorming when facing a complex architectural, technology, or design decision where the options are not yet well-defined or the problem itself may need reframing. Assembles named stakeholder perspectives that each speak once without debate, then surfaces where they converge and where real tension remains — without forcing a premature choice. Triggers on: "should we use X or Y", "not sure which approach", "evaluate these options", "what are the trade-offs between", "help me think through this decision", "architecture decision", "technology choice". Routed by using-superpowers before brainstorming when the decision space is unclear.
/dependency-managementUse when updating, migrating, or auditing project dependencies: upgrading packages, fixing security vulnerabilities (CVEs), resolving breaking changes, migrating to new major versions, or auditing outdated dependencies. Enforces incremental updates with verification at each step. Distinct from systematic-debugging (which fixes application bugs) and refactoring (which restructures application code). Triggers on: "update dependencies", "upgrade packages", "npm update", "pip upgrade", "outdated", "vulnerability", "CVE", "security advisory", "breaking change", "migration guide", "dependency conflict", "peer dependency", "update to latest", "audit dependencies", "npm audit", "dependabot". Routed by using-superpowers, or invoke directly via /dependency-management.
/dispatching-parallel-agentsUse when 2+ tasks are independent and can run concurrently without file or state conflicts or sequential dependencies. Triggers on: "run these in parallel", "do these at the same time", plans with independent tasks, when subagent-driven-development identifies parallelizable work.
npx claudepluginhub repozy/superpowers-optimized --plugin superpowers-optimizedOther plugins' skills for the same job