subagent-driven-development
Use when executing an approved implementation plan in the current session and the harness can launch subagents.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when executing an approved implementation plan in the current session and the harness can launch subagents.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when the user says "ask grok", "get grok's take", "grok review", "have grok look at this", "delegate to grok", or any variation naming Grok/xAI as the perspective they want.
Use when starting any creative work - creating a feature, building a component, adding functionality, or changing designed behavior - before writing code or invoking any implementation skill. Small defect repairs and tweaks triage through razorback:fixing-small-issues first.
Use when a design question resists discussion — a state model with more edge cases than fit in your head, a UI the user keeps flip-flopping on because nobody can picture it, or behavior only knowable by running it — before writing a design doc or implementation plan for that question.
Use when the user says "ask claude", "fresh claude review", "second opinion from another claude", "have another claude look at this", "delegate to a fresh claude", or any variation naming Claude as the second perspective they want.
Use when the user says "ask codex", "get codex's take", "codex review", "have codex look at this", "delegate to codex", or any variation naming Codex/OpenAI as the perspective they want. Also use for a generic "second opinion from a different model" when no other model is named.
Use when planning or reviewing non-trivial code changes, refactoring architecture, evaluating module boundaries, repeated findings reveal coupling, tests are hard to write because interfaces are unclear, or the user asks for codebase design improvements, complexity reduction, deduplication, or cleanup of existing code.
| name | subagent-driven-development |
| description | Use when executing an approved implementation plan in the current session and the harness can launch subagents. |
Execute a plan by dispatching fresh subagents per task, with the lead doing inline review (spec compliance + code quality) after each task. Independent tasks can be dispatched in parallel; tightly coupled tasks run sequentially. Commit mode decides whether the worker commits directly or hands the approved diff back to the lead.
Core principle: Fresh subagent per task + inline review by lead + parallel fan-out when tasks are independent = high quality without wasted ceremony.
Dispatch mechanism:
Agent tool (one call per subagent; multiple calls in one turn run in parallel).Task tool (one call per subagent; multiple calls in one turn run in parallel). The built-in general subagent is suitable for most implementer work; @mention also works for manual invocation.spawn_agent(task_name="task-N-<slug>", message=<filled prompt>) (one call per subagent; multiple calls in one turn run in parallel). Keep the returned agent ID, followup_task(target=<agent-id>, message=...) feeds follow-ups (the closest thing to Claude Code's resume), and wait_agent(timeout_ms=...) blocks until agent completion. Surface verified on codex 0.144.3 — trust the live tool list over these names (see ../using-razorback/references/codex-tools.md).razorback:cursor-agent, which owns the Cursor CLI invocation. The current lead still owns planning, review, fix routing, and final verification; Cursor Agent is only the implementation worker.Use the harness default model unless the user, environment, or lead explicitly selects another model for this run. Razorback does not require a model table before dispatch.
digraph when_to_use {
"Have implementation plan?" [shape=diamond];
"Same session + can dispatch subagents?" [shape=diamond];
"Tasks mostly independent?" [shape=diamond];
"subagent-driven-development (parallel batches)" [shape=box style=filled fillcolor=lightgreen];
"subagent-driven-development (serialized lanes)" [shape=box style=filled fillcolor=lightgreen];
"executing-plans" [shape=box];
"Brainstorm / write the plan first" [shape=box];
"Have implementation plan?" -> "Same session + can dispatch subagents?" [label="yes"];
"Have implementation plan?" -> "Brainstorm / write the plan first" [label="no"];
"Same session + can dispatch subagents?" -> "Tasks mostly independent?" [label="yes"];
"Same session + can dispatch subagents?" -> "executing-plans" [label="no - separate session or no delegation"];
"Tasks mostly independent?" -> "subagent-driven-development (parallel batches)" [label="yes"];
"Tasks mostly independent?" -> "subagent-driven-development (serialized lanes)" [label="no - tightly coupled: dispatch one at a time"];
}
Fix-round follow-up mechanics are per-harness — see Step 4.
Read the plan file once. Extract every task with its full text and surrounding context. Create tracking tasks via TaskCreate so progress is visible.
Check for durable progress before dispatching:
cat "$(git rev-parse --show-toplevel)/.razorback/sdd/progress.md" 2>/dev/null || true
Tasks listed there as complete with a named commit are DONE. Do not re-dispatch them; verify the named commit with git log if needed, then resume at the first incomplete task.
Treat any completion line whose commit SHA is missing, pending, or absent from git log as INCOMPLETE — this is the parallel-lead-commit crash window. Run git status, inspect the working tree for that task's owned files, and either re-review and commit the approved edits (staging per the Commit Mode Contract) or re-dispatch the task. Never skip a task whose completion record has no verifiable commit.
Before dispatching, orient yourself on the codebase with Miller:
contextinspect, so you can spot later drift during reviewRead ## Parallel Execution Contract before dispatching and validate every task row:
Serialization required: No.Serialization required: Yes plus a Dependency reason naming the real dependency or tool limitation.Use the template at ./implementer-prompt.md. The spawn prompt MUST include:
razorback:test-driven-development)serial-worker-commit or parallel-lead-commit)No Architecture Impact note, and the plan mismatch rule).razorback/sdd, so the worker writes the full report to a file and returns only status, commits, test summary, and concernsRazorback is language-agnostic. The target repo supplies concrete commands through its docs and the plan's Verification Strategy.
Use these scope labels in worker prompts and reports:
| Scope | Owner | When |
|---|---|---|
worker-red-green | Implementer | Prove the new or changed behavior during TDD with the lowest-cost repo-defined command |
worker-ceiling | Implementer | Maximum scope a worker may run without lead assignment |
affected-change | Lead | Check touched files, changed subsystem, or repo-defined affected area after a coherent batch |
branch-gate | Lead | Broad confidence before handoff, push, or PR |
expensive-specialist | Lead | Slow domain gates only when touched areas or failures require them |
Workers do not own affected-change, branch-gate, or expensive-specialist
scopes. The lead owns those gates and the ledger entries for them. If the lead
asks a worker to run a broad command for diagnostic output, the worker must
label it diagnostic, not acceptance evidence.
Workers stop and report when assigned verification fails unless the plan explicitly says to update that gate. A failing assigned gate is not acceptance evidence.
For each assigned gate, the worker report must state the invariant the gate proves. For replay or metric evidence, it must also identify hard-gate metrics and report-only metrics.
Maintain a verification ledger during execution:
| Scope | Invariant | Command | Commit | Result | Time |
|-------|-----------|---------|--------|--------|------|
If the same HEAD already has a passing ledger entry for the required scope, reuse that evidence instead of rerunning the same expensive command. If HEAD changed, the affected scopes are stale.
Every dispatch chooses one commit mode and copies it into the worker prompt:
serial-worker-commit: the task is single-threaded from Git's perspective
(single task or deliberately serialized lane). The worker may commit only owned
files after assigned verification passes.parallel-lead-commit: the task belongs to a safe batch with 2+ eligible
tasks. The worker edits only owned files, writes the report, and does not run
git add or git commit. The lead stages and commits after inline review to
avoid Git index races between concurrent workers.Lead staging (parallel-lead-commit): this is the one statement of the staging rule — every other mention in this skill points here.
Tick the task's acceptance-criteria checkboxes before staging, then stage the reviewed task's owned files plus the plan file — git add <owned paths> <plan file> then commit. Never git add -A, git add ., or git commit -a: sibling workers in the same batch may have unreviewed, in-flight edits in the shared working tree, and a broad stage would sweep them into the wrong commit and bypass inline review.
Commit before you record: create the commit first, then write the durable-progress line with the real commit SHA (see Durable Progress). Never mark a parallel-lead-commit task complete while its commit is still pending — that record has no verifiable commit and a crash in that window strands the approved work.
Fix rounds keep the same commit mode unless the lead explicitly changes it.
Large task text, reports, and diffs should move as files instead of pasted prompt content. This keeps the lead context small and makes recovery after compaction concrete.
The helper scripts live in this skill's own scripts/ directory — NOT in the target repository. Resolve them from the skill's base directory (announced when the skill loads), e.g. "$SKILL_DIR/scripts/task-brief".
"$SKILL_DIR/scripts/task-brief" PLAN_FILE N. It writes task-N-brief.md under .razorback/sdd (in the target repo) and prints the path. The dispatch prompt should point the implementer at that brief as the source of requirements.task-N-report.md) and put it under .razorback/sdd. The implementer writes the full report there, then returns only status, commits, one-line test summary, and concerns."$SKILL_DIR/scripts/review-package" BASE HEAD. The lead reads the generated package; do not dispatch a reviewer subagent. No reviewer subagents means the lead still owns spec compliance and code quality.Conversation memory does not survive every long run. Track task completion in .razorback/sdd/progress.md in addition to TaskList state and plan checkboxes.
.razorback/sdd/progress.md if it exists. Trust it with git log over stale recollection after compaction or resume.serial-worker-commit: after the worker commit, Task N: complete (commits <base7>..<head7>, Lead inline review clean).parallel-lead-commit: after the lead stages the owned files and commits, Task N: complete (parallel-lead-commit, Lead inline review clean, lead commit <sha7>). Do not write this line while the commit is still pending; the lead commits first, then records the SHA.git clean -fdx deletes it; if that happens, recover from git log and checked plan boxes.Save the agent ID (or name) returned by every dispatch. Step 4 needs it to route fixes back to the worker that holds the orientation context. On opencode there is nothing to save — the Task tool exposes no persistent resume.
Dispatch a safe batch (Step 1's Parallel Execution Contract) as one dispatch call per task in a single turn, using that harness's Dispatch mechanism (top of this skill).
Parallel-specific semantics:
session_child_* keybinds.wait_agent(timeout_ms=...) blocks until completion; list_agents shows per-agent state when you need a given implementer's output before proceeding with its review.Assign file ownership per subagent to prevent collisions. Tightly coupled tasks
(same files, shared state, ordering dependency) dispatch sequentially instead —
one subagent at a time, lead reviews, then next — with the dependency or tool
limitation recorded in the plan's Dependency reason.
Reviews still happen inline per-task. Do not batch reviews — a failing task shouldn't block review of the ones that passed.
When the implementer reports completion, the lead does a single inline review covering both spec compliance and code quality. No reviewer subagents — the lead does this directly.
Spec compliance:
inspect.architecture-quality review:
Code quality:
inspect(target, depth=overview) — escalate to depth=full for the symbols the task centers on.trace.Review cap: 3 iterations. This is the one statement of the cap — every other mention in this skill points here. Three fix attempts per task (routing mechanism per harness: Step 4). If the 3rd iteration still fails:
./fix-prompt.md's "Reframed-Context Attempt" section — different framing (different ownership, explicit plan disambiguation, simpler decomposition, or a prior-commit pointer so the fresh agent can read what was tried without rediscovering it). The 4th attempt's value is the reframing, not the freshness.Spec compliance checking earns its keep when the plan leaves room for misinterpretation. When the plan is concrete, the review can focus on quality:
Lighter (quality-focused) review when:
Full (spec + quality) review when:
Either way, the review is a single pass by the lead. Never collapse the loop to skip re-reviewing after a fix.
When the review passes (approved): for parallel-lead-commit, the lead stages and commits per the Commit Mode Contract's lead-staging rule (the approved worker report shows commit SHA: none - parallel-lead-commit). For either mode, mark the task complete (TaskUpdate) so the plan document records progress alongside the TaskList. This is fast bookkeeping — never a stop or a review gate; move straight to the next task or parallel dispatch.
When review finds issues, route the fix back to an implementer with the reviewer findings. This is the one statement of fix-round routing — every other mention in this skill points here.
Claude Code (prefer resume): Send the filled ./fix-prompt.md to the stored implementer via SendMessage (agent ID or name); on older builds this was Agent(resume: "<agent-id>") — use whichever continuation mechanism the harness exposes. The resumed subagent keeps its orientation context — files read, decisions made, tests written — and goes straight to the fix instead of re-reading the codebase.
opencode (dispatch fresh with context): The Task tool doesn't expose persistent resume. Dispatch a fresh implementer via the Task tool (or @mention general) using ./fix-prompt.md plus:
git show or read the files instead of rediscovering them)Codex (prefer followup_task): Call followup_task(target=<stored agent-id>, message=<filled fix-prompt.md>) on the existing worker. The worker keeps its orientation context and behaves like a Claude Code resume; for iteration 4, spawn_agent(task_name="task-N-retry", message=<filled fix-prompt.md with the Reframed-Context Attempt section + prior-commit SHAs>).
Prefer the context-preserving path (resume / followup_task) for iterations 1-3; the 4th attempt is a fresh dispatch with reframed context. Dispatch fresh earlier only when the subagent is unreachable (session error, context limit, stored ID lost to a session restart), the prior implementer's context is genuinely stale (another task modified the same files), or the fix needs a fundamentally different approach — always with the prior-commit pointer.
Re-review after every fix. The iteration cap is stated in Step 3 ("Review cap"); the commit mode is unchanged by a fix round (Commit Mode Contract).
If the reviewer choice propagated from writing-plans (via the execution handoff) is codex or claude:
First, ensure the verification ledger has a passing branch-gate entry for the current HEAD. If it does not, run the branch-gate scope now and record the result. pre-merge-review requires this as a precondition; do not skip it.
Then invoke razorback:pre-merge-review, passing:
If the choice is none (or absent), skip Step 4a.
Pre-merge-review builds the full branch diff, dispatches the chosen reviewer in adversarial read-only mode, classifies findings (real-bug / real-improvement / false-positive / out-of-scope), dispatches fresh implementer subagents for verified fixes, runs the required verification scope for the resulting HEAD, and emits a summary block for the morning report. Single pass; no round-two review.
After pre-merge-review returns, proceed to Step 5 (Complete → razorback:finishing-a-development-branch).
When all tasks are approved and marked complete:
branch-gate scope, or reuse a passing verification-ledger entry for the same HEAD and scope. Add any expensive-specialist scopes required by touched areas.razorback:finishing-a-development-branch.The authoritative taxonomy is ../using-razorback/references/blocker-taxonomy.md (in the razorback plugin). Consult it before stopping.
Bias rules:
Real blockers (stop and report):
Anything else: pick the plan-consistent option, note the choice in your report, continue. Full definitions in the taxonomy.
The lead writes a goldfish:checkpoint at four points during the run. This persists phase-level progress and decisions across auto-compaction and session restarts.
finishing-a-development-branch creates the PR: final state.Checkpoint at phase granularity, not per task or per subagent dispatch. Per-task checkpoints are noise; per-phase is enough to recover.
A checkpoint is a fast, non-blocking memory write — never a stop, a review gate, or a reason to ask the user anything. A phase boundary is a checkpoint trigger, not a stop: finishing a phase never means pausing for confirmation. Write the checkpoint and immediately continue.
On detecting a resumed run (post-compaction note, mismatch between expected and actual conversation state, or the user says "resume"), the lead follows this fixed orientation sequence before continuing:
goldfish:recall — retrieve the active brief and recent checkpoints.[x].git log --oneline <base>..HEAD — verify what is actually committed.parallel-lead-commit gaps: for any progress line marked complete whose commit SHA is missing, pending, or absent from git log, run git status and inspect the working tree for that task's owned files. If approved edits are uncommitted, re-review and commit them (staging per the Commit Mode Contract) before advancing; if nothing is there, treat the task as incomplete and re-dispatch. Do not trust a completion record that has no verifiable commit.This sequence runs only on resumed runs. A fresh run dispatches directly into Step 1 (Extract Tasks from the Plan). Subagent IDs from the prior session cannot be resumed post-compaction — treat any needed fix as a fresh dispatch with prior-commit context.
./implementer-prompt.md — Dispatch implementer subagent./fix-prompt.md — Resume implementer to fix review issues./spec-reviewer-prompt.md and ./code-quality-reviewer-prompt.md — Review checklists the lead consults during inline review. Not dispatched as separate subagents; they encode the criteria the lead applies directly.[Read plan once; orient with Miller context; TaskCreate per task]
[Task 2 of 5 — commit mode: serial-worker-commit]
[Dispatch implementer with full task text + context + Miller directives. Save agent ID: impl-c3d4]
Implementer reports: verify/repair modes added, worker-red-green passing, committed def456. DONE.
[Lead inline review: inspect changed symbols]
Spec: MISSING progress reporting; EXTRA --json flag. Quality: magic number 100 hard-coded
[Fix round 1 of 3 — resume impl-c3d4 with ./fix-prompt.md + the three findings]
Implementer (resumed): all three addressed, tests passing, committed ghi789.
[Lead re-review → approved. TaskUpdate task 2 completed. Remaining tasks follow the same pattern]
[All tasks done: lead runs branch-gate scope, updates the ledger, then razorback:finishing-a-development-branch]
Never:
git add or git commitparallel-lead-commit task outside the Commit Mode Contract's lead-staging ruleparallel-lead-commit task complete before its lead commit exists, or write its progress line without the real commit SHAIf the subagent asks questions: answer clearly and completely before letting it proceed; provide extra context if needed, and don't rush it into implementation.
If review finds issues: route the fix per Step 4; the iteration cap is in Step 3 ("Review cap").
Required workflow skills:
Subagents should follow:
Alternative workflows:
Codex-specific:
spawn_agent / followup_task / send_message / wait_agent / interrupt_agent / list_agents) are enabled by default on current codex (verified 0.144.3); older versions needed multi_agent = true in ~/.codex/config.toml (see ../using-razorback/references/codex-tools.md). Trust the live tool list over these names.interrupt_agent(target=<agent-id>) to cancel a worker that is stuck or no longer needed (e.g. after the 4th-iteration flag-and-continue); there is no separate close/free step on current codex.