基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/CoyoteLeo/superspec --skill ss-subagent-driven-development命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Use before creating features, building components, adding functionality, or modifying behavior to explore user intent, requirements, and design before implementation
Use when starting a new session to understand how superspec skills work and when to invoke them
Use when you have a spec or requirements for a multi-step task, before touching code
| name | ss-subagent-driven-development |
| description | Use when executing implementation plans with independent tasks in the current session |
Execute plan by dispatching a fresh subagent per task, with one task review after each that returns two verdicts: spec compliance and code quality.
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 + one task review carrying both verdicts = high quality, fast iteration
You DO drive the branch → commit → push → open-PR → rebase-the-stack → clean-up flow yourself (see *Worktrees and Stacked PRs*).Allowed, and expected:
git push --force-with-lease, but ONLY on a branch belonging to a PR you opened in this session. Maintaining a stack is impossible without it.Never:
git push --force. --force-with-lease or nothing; the lease is what stops you from silently discarding someone else's push.main/master/develop), a shared branch, or somebody else's PR branch. Not even to "fix" it.git merge into a base branch nor merging the PR itself. The user merges. After you open a PR, you wait.Read-only git (status, log, diff, rev-parse) is always fine. If the flow seems to need something outside these boundaries, stop and ask instead of finding a way around it.
digraph when_to_use {
"Have implementation plan?" [shape=diamond];
"Tasks mostly independent?" [shape=diamond];
"ss-subagent-driven-development" [shape=box];
"Manual execution or brainstorm first" [shape=box];
"Have implementation plan?" -> "Tasks mostly independent?" [label="yes"];
"Have implementation plan?" -> "Manual execution or brainstorm first" [label="no"];
"Tasks mostly independent?" -> "ss-subagent-driven-development" [label="yes"];
"Tasks mostly independent?" -> "Manual execution or brainstorm first" [label="no - tightly coupled"];
}
This is the only execution mode. Tightly-coupled work that can't be split into independent tasks doesn't get executed inline as a fallback — it goes back to the plan, because "one subagent can't do this alone" usually means the tasks were cut wrong.
What you get:
digraph process {
rankdir=TB;
subgraph cluster_per_task {
label="Per Task";
"Dispatch implementer subagent (./implementer-prompt.md)" [shape=box];
"Implementer subagent asks questions?" [shape=diamond];
"Answer questions, provide context" [shape=box];
"Implementer subagent implements, tests, self-reviews, commits" [shape=box];
"Write review package for BASE..HEAD to a file" [shape=box];
"Dispatch task reviewer subagent (./task-reviewer-prompt.md)" [shape=box];
"Spec compliant AND quality approved?" [shape=diamond];
"Implementer subagent fixes findings" [shape=box];
"Mark task complete in TodoWrite AND tasks.md" [shape=box];
}
"Read plan from change dir, extract all tasks, create TodoWrite, locate tasks.md" [shape=box];
"More tasks remain?" [shape=diamond];
"Dispatch final code reviewer subagent for entire implementation" [shape=box];
"Open PR per group; CI green + every review comment answered inline" [shape=box];
"Suggest ss-archive" [shape=box style=filled fillcolor=lightgreen];
"Read plan from change dir, extract all tasks, create TodoWrite, locate tasks.md" -> "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)";
"Implementer subagent asks questions?" -> "Implementer subagent implements, tests, self-reviews, commits" [label="no"];
"Implementer subagent implements, tests, self-reviews, commits" -> "Write review package for BASE..HEAD to a file";
"Write review package for BASE..HEAD to a file" -> "Dispatch task reviewer subagent (./task-reviewer-prompt.md)";
"Dispatch task reviewer subagent (./task-reviewer-prompt.md)" -> "Spec compliant AND quality approved?";
"Spec compliant AND quality approved?" -> "Implementer subagent fixes findings" [label="no"];
"Implementer subagent fixes findings" -> "Write review package for BASE..HEAD to a file" [label="re-review"];
"Spec compliant AND quality approved?" -> "Mark task complete in TodoWrite AND tasks.md" [label="yes"];
"Mark task complete in TodoWrite AND tasks.md" -> "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" -> "Open PR per group; CI green + every review comment answered inline";
"Open PR per group; CI green + every review comment answered inline" -> "Suggest ss-archive";
}
Use both tracking mechanisms:
changes/YYYY-MM-DD-<topic>/tasks.md). Survives across conversations, and survives compaction.When marking a task complete, always do both: update TodoWrite AND edit tasks.md.
tasks.md is the record of what happened, not just what is left. Your own memory of this session does not survive compaction; a controller that has lost its place will happily re-dispatch a task sequence it already finished. Write state down as it happens:
- [ ] → - [x] when the task's review comes back clean.commits <base7>..<head7> · review clean (or · 2 findings fixed).PR #123 feat/a → develop (tasks 1-3) · CI green · 4 comments answered. After a restack, append what moved: feat/b rebased --onto origin/develop feat/a · force-pushed.After a compaction, trust tasks.md and git log over your own recollection. The commits it names exist in git whether or not you remember making them. Resuming a partially-completed plan works the same way: read tasks.md first, resume at the first task without an - [x].
Do not create a second progress file. One record per change; a sibling ledger duplicates the task list and the two drift apart.
Each implementer commits its own task's work before reporting. This is what makes the review real: the task reviewer reviews a diff, and a task that left nothing committed produces an empty diff and a review that approves nothing at all — silently, and marked green.
git rev-parse HEAD in the worktree and keep it. That is the task's base.HEAD~1. A task that took three commits would silently review only the last one.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. A task's full text pasted N times is that text sitting in your context N times.
So hand over paths, not contents:
plan.md plus "implement Task N only — do not touch any other task". The subagent spends one Read; its context is disposable, yours is not. Do not paste the task body.changes/YYYY-MM-DD-<topic>/task-N-report.md and returns only status, commit range, a one-line test summary, and concerns. Reports belong to the change packet — they are part of its decision trail and get archived with it.mkdir -p "$TMPDIR/superspec/<topic>"
{ git log --oneline BASE..HEAD; git diff --stat BASE..HEAD; git diff -U10 BASE..HEAD; } \
> "$TMPDIR/superspec/<topic>/task-N-review.diff"
Review packages are scratch, not artifacts — keep them outside the repo. A diff committed into the change directory duplicates what git already stores, bloats the packet, and gets dragged into the archive forever.What you still compose yourself is the part no file can carry: one line on where this task fits, the interfaces and decisions earlier tasks established, and your resolution of any ambiguity you spotted. A dispatch prompt describes one task — never paste accumulated "state after Tasks 1-3" summaries into later dispatches.
Use the least powerful model that can handle each role to conserve cost and increase speed.
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.
Integration and judgment tasks (multi-file coordination, pattern matching, debugging): use a standard model.
Architecture, design, and review tasks: use the most capable available model.
Task complexity signals:
Implementer subagents report one of four statuses. Handle each appropriately:
DONE: Write the review package for BASE..HEAD to a file, then dispatch the task reviewer with its path.
DONE_WITH_CONCERNS: The implementer completed the work but flagged doubts. Read the concerns before proceeding. If the concerns indicate a design mismatch (plan assumptions vs reality), handle as a design deviation (see below). If they're 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:
Never ignore an escalation or force the same model to retry without changes. If the implementer said it's stuck, something needs to change.
Artifacts (design.md, plan.md, tasks.md) are mutable throughout implementation, not frozen at handoff. Implementation will surface things the design didn't anticipate — that's normal, not an exception. Treat updating an artifact as a routine part of the workflow.
Two paths:
Inline adjustments — no escalation needed. Implementer or controller can adjust without pausing:
Just do it, note the change in tasks.md as a brief comment if it would surprise a future reader.
Design deviation — surface and let the user decide. When the implementer hits something that changes design intent:
The protocol:
design.md and/or plan.md, add note > Updated during implementation: [reason], review and adjust remaining tasks, then resumetasks.md as a comment below the task checkboxAfter the user decides and any artifact updates are made, resume the normal per-task flow from where it was paused.
The split is about user-decision-worthiness, not severity. Anything that would change how the user would have designed the system needs their input. Anything that doesn't is just implementation work — adjust and keep going.
./implementer-prompt.md - Dispatch implementer subagent./task-reviewer-prompt.md - Dispatch task reviewer subagent (spec compliance + code quality, one dispatch)./code-reviewer.md - The broad reviewer, used once for the final whole-implementation reviewYou: I'm using Subagent-Driven Development to execute this plan.
[Worktree ready; read plan once: /abs/.../changes/2026-08-09-hooks/plan.md — 5 tasks]
[Locate tasks.md in same directory; Execution State block is empty — fresh start]
[Create TodoWrite with all tasks]
Task 1: Hook installation script
[git rev-parse HEAD → BASE=a1b2c3d]
[Dispatch implementer: plan.md path, "Task 1 only", scene-setting, report-file path]
Implementer: "Before I begin - should the hook be installed at user or system level?"
You: "User level (~/.config/superpowers/hooks/)"
Implementer: [Later] DONE — commits a1b2c3d..d4e5f6a, 5/5 passing, report written.
Self-review found a missing --force flag; added it.
[Write review package a1b2c3d..d4e5f6a to $TMPDIR/superspec/hooks/task-1-review.diff]
[Dispatch task reviewer with brief context + report path + diff path]
Task reviewer: Spec ✅ — all requirements met, nothing extra.
Strengths: good test coverage, clean. Issues: none. Task quality: Approved.
[tasks.md: - [x] Task 1 … / commits a1b2c3d..d4e5f6a · review clean]
Task 2: Recovery modes
[git rev-parse HEAD → BASE=d4e5f6a]
[Dispatch implementer: plan.md path, "Task 2 only", interfaces Task 1 established]
Implementer: DONE — commits d4e5f6a..b7c8d9e, 8/8 passing, report written.
[Write review package d4e5f6a..b7c8d9e to task-2-review.diff; dispatch task reviewer]
Task reviewer: Spec ❌ — missing progress reporting (spec says "report every 100 items");
extra --json flag not requested.
Issues (Important): magic number 100. Task quality: Needs fixes.
[Implementer fixes both, re-runs the covering tests, appends to its report file]
Implementer: Removed --json, added progress reporting, extracted PROGRESS_INTERVAL. 10/10 passing.
[Write review package b7c8d9e..e1f2a3b (the fix range only); re-dispatch]
Task reviewer: Spec ✅. Both findings addressed (recovery.js:41, recovery.js:7). Approved.
[tasks.md: - [x] Task 2 … / commits d4e5f6a..e1f2a3b · 2 findings fixed]
...
[After all tasks: dispatch final code reviewer over the whole implementation]
Final reviewer: All requirements met, ready to merge
[Open the PR for this group; tasks.md Execution State gets the PR line]
Done!
vs. Manual execution:
vs. Executing Plans:
Efficiency gains:
Quality gates:
Cost:
Never:
plan.md and name the taskHEAD~1 instead of the BASE you recorded before dispatchinggit diff output land in your own context instead of a fileIf subagent asks questions:
If reviewer finds issues:
If subagent fails task:
This is the default shipping shape, not an opt-in. The plan already says which tasks belong to which PR; this section says how those groups reach GitHub.
Work in a git worktree, not the main checkout — the user very likely has other sessions and other branches in flight, and a shared checkout makes two agents fight over one index.
git fetch origin and branch from origin/<base> directly. Do not git pull the current branch..worktrees/<kebab-topic>/ inside the repo..env*, .npmrc, …) — they are absent in a fresh worktree by definition, and their absence usually surfaces as a confusing runtime error, not a missing-file error.CLAUDE.md / AGENTS.md / CONTRIBUTING.md) for a worktree recipe and prefer it over these steps.One worktree serves a whole stack. Stacked PRs are sequential by construction, so reuse the same worktree and create each next branch inside it — that also keeps the base relationships obvious and saves repeated dependency installs.
Each PR's branch is based on the previous PR's branch, not on the base branch:
feat/a → base developfeat/b → base feat/afeat/c → base feat/bOpen each PR with its real base and say in the body which PR it is stacked on and in what order they should merge.
A stack is maintained by rebasing, and rebasing a pushed branch means force-pushing it. That is allowed here — see the guardrail for the exact boundary — and it is the right tool: the alternative (merging the base forward) leaves a merge commit in every downstream branch and, after a squash merge, produces a guaranteed conflict on every single PR in the stack.
Always --force-with-lease, never bare --force. The lease is what turns "I am rewriting my own branch" into "I am rewriting my own branch and nobody else pushed to it while I wasn't looking".
After the user merges PR1, the branch below is NOT rebased with a plain git rebase origin/develop. A squash merge collapsed PR1 into one new commit on the base; a plain rebase would try to replay PR1's original commits on top of it and conflict with itself. Cut them off explicitly with the old base branch as the upstream:
git fetch origin
git checkout feat/b
git rebase --onto origin/develop feat/a # replay ONLY feat/a..feat/b onto the new base
git push --force-with-lease
Then repeat down the stack (--onto origin/develop feat/b for feat/c, and so on).
Sequencing constraint: rebase the whole stack before deleting the merged branch. feat/a is the ref that tells --onto where PR2's own commits begin. Delete it first and you have to hunt for the SHA by hand.
If you fixed something in PR1 while PR2 already existed, same move: rebase feat/b onto the updated feat/a and force-push with a lease.
A rebase can still conflict. When it does, resolving it is usually "keep our side", but verify that mechanically instead of trusting it — check that nothing which existed on the other side got dropped (for a test file, compare the list of test names on both sides; for source, list the lines that exist only on the other side and account for each one). A conflict resolved by taking one side wholesale is exactly where a silently-duplicated declaration or a lost test hides.
Opening the PR is not the end of the task. Finish these before reporting the PR as done:
Then hand back to the user: they merge. If CI is red for a reason you cannot attribute to your change (a known flake, an unrelated job), say that explicitly and say what evidence you have — never report red CI as green, and never re-run a job repeatedly hoping it turns.
"merged" is a trigger, not just news. Do all of this without being asked again:
git fetch origin, confirm the PR reads MERGED, then read the change back out of origin/<base> (e.g. grep git show origin/<base>:<path> for something the change introduced). A green PR page and landed content are two different claims, and a squash or rebase merge rewrites the SHA, so you cannot match commits by hash.-D rather than -d, because a squash or rebase merge leaves the branch at a different SHA than what landed and git therefore does not consider it merged. That is precisely why step 1 exists — -D discards git's own safety check, so the evidence has to come from the read-back instead.If several PRs merge at once, do steps 1–3 in stack order, bottom-up.