Delegate work to subagents in parallel or sequence across implementation, review, QA, research, and plan execution. Use whenever a task has 2+ independent tracks, spans multiple files or domains, or explicitly calls for subagent delegation, spawning agents, or orchestration. Supersedes `supersub` and absorbs the native delegation patterns from `delegation-autopilot`.
Read FEEDBACK.md before every use to apply the latest lessons about subagent mapping, model verification, and host-specific tool behavior.
Delegate work to subagents intelligently. Route by task shape, dispatch in parallel when independent, enforce quality gates when risk warrants it, and synthesize results into coherent output.
Core principle: Classify first, then dispatch. The routing decision matters more than the execution details.
Before dispatching, classify the work:
| Shape | Mode | When |
|---|---|---|
| Single simple task | Do it yourself | One file, one concern, <5 tool calls |
| Single complex task | One subagent | Needs isolated context or specialized focus |
| 2+ independent tasks, low risk | Speed mode | No shared files, localized changes |
| 2+ independent tasks, higher risk | Quality mode | Shared interfaces, public APIs, migrations |
| Multi-domain request | Dispatch mode | Research + code + QA + docs spanning domains |
| Implementation plan with tracks | Development mode | Structured plan with phases and review gates |
Upgrade rule: If you chose Speed mode and discover overlap or integration risk mid-flight, stop new lightweight dispatches and re-route remaining tracks through Quality mode. Never downgrade once risk is confirmed.
This skill now owns the native parent-agent subagent workflow that previously lived in delegation-autopilot.
Use these tools when the current host supports them:
spawn_agentsend_inputwait_agentresume_agentclose_agentOne track = one spawned subagent. The parent agent owns decomposition, synchronization, and final integration.
Pick the most constrained type that fits — less capability means faster, cheaper, and safer.
| Type | Best for | Tools |
|---|---|---|
Bash | Command execution, git ops, builds, terminal tasks | Bash only |
Explore / explorer | Fast codebase search, file finding, keyword investigation | Read-only (Read, Glob, Grep, WebSearch) |
Plan | Architecture design, implementation strategy | Read-only |
general-purpose / worker | Multi-step implementation, research, reviews | All tools |
Use Explore for read-only investigation, Bash for command-only work, general-purpose when the agent needs to both read and write. Specify thoroughness for Explore agents ("quick", "medium", "very thorough").
When using this skill inside Craft Agent, do not assume a generic Task tool exists just because the orchestration pattern talks about subagents.
Map the concepts to the tools actually exposed in the current session:
spawn_session
call_llm
thinking: true when you specifically want Claude Sonnet/Opus extended reasoning.Important:
call_llm as a tool-using subagent; it is a single isolated completion.Always use foreground agents for implementation work. Background agents (run_in_background: true) have no crash reporting, no health checks, and silently fail without recourse.
| Mode | Use When | Risk |
|---|---|---|
| Foreground (default) | All implementation, reviews, research | Low — errors surface immediately |
| Background | Fire-and-forget tasks where failure is acceptable | High — silent failures, no recovery |
Parallel foreground agents — dispatch multiple Task/subagent calls in a single message to make them truly concurrent. In Craft Agent specifically, use spawn_session for true independent workers, or multiple call_llm calls for parallel model-only analysis.
Never use run_in_background: true for:
Use when all are true:
Switch to Quality mode immediately if any of the following appear:
Each agent gets:
Scenario: 6 failures across 3 files after a major refactoring.
| Agent | Scope | Root Cause Found |
|---|---|---|
| Agent 1 | agent-tool-abort.test.ts (3 failures) | Replaced arbitrary timeouts with event-based waiting |
| Agent 2 | batch-completion-behavior.test.ts (2 failures) | Fixed event structure bug (threadId in wrong place) |
| Agent 3 | tool-approval-race-conditions.test.ts (1 failure) | Added wait for async tool execution to complete |
All fixes were independent — zero conflicts, full suite green. This pattern applies whenever failures span multiple independent subsystems (different test files, different bugs, different root causes). Do not use it when fixing one issue might cascade and fix others — investigate together first.
| Mistake | Fix |
|---|---|
| Too broad scope ("fix all tests") | Specific scope ("fix auth tests in src/auth.test.ts") |
| No context | Paste error messages and test names |
| No constraints | "Do NOT change production code" or "Fix tests only" |
| Vague output | "Return summary of root cause and changes" |
Use when any apply:
Phase 1: Partition and classify
low, medium, high).Phase 2: Parallel implementation dispatch
references/track-ledger-template.md).Phase 3: Adaptive review loop per track
low risk: combined spec + quality review in one passmedium/high risk: spec compliance review first, then code quality reviewIf review fails → triage:
resume_agent on original implementer; if not viable, spawn fresh fixer with prior contextPhase 4: Final integration verifier (required) Spawn one read-only verifier after all tracks are locally green. Verifier checks:
Phase 5: Integration and closeout
references/implementer-prompt.mdreferences/spec-reviewer-prompt.mdreferences/quality-reviewer-prompt.mdreferences/final-verifier-prompt.mdreferences/triage-matrix.mdreferences/track-ledger-template.mdUse for requests spanning multiple specialist domains or requiring ad-hoc parallel investigation across different concerns (research, code, QA, docs).
| Situation | Action | Agent Type |
|---|---|---|
| 3+ files to modify | Spawn per module/domain | Specialist or general-purpose |
| Web research needed | Spawn research agent | search-specialist |
| Find files/variables in codebase | Spawn exploration agent | Explore |
| Bug investigation | Spawn debugger | debugger |
| Security review | Spawn security specialist | security-auditor |
| Code review needed | Spawn reviewer | code-reviewer |
| Large file to analyze | Spawn reader agent | Explore |
| Phase complete, context heavy | Summarize, spawn fresh agent | Any appropriate type |
| Parallel-capable independent tasks | Spawn multiple concurrent agents | Various |
When NOT to spawn: single file simple change (<30 lines), information already in context, quick verification you can do directly.
Bounded recursion: Max depth 2. You (depth 0) → specialists (depth 1) → workers (depth 2, leaf only). Depth-2 agents do not spawn further agents.
| Context Level | Action |
|---|---|
| < 40% | Work directly, spawn for parallelism only |
| 40-60% | Consider spawning for large operations |
| 60-80% | Proactively spawn, summarize completed work |
| > 80% | Must spawn, avoid large reads/fetches |
Use when executing a structured implementation plan where tasks proceed through staged review loops.
This mode keeps implementation sequential when tasks are tightly coupled, parallel when they are independent.
Good prompts are self-contained, scoped, output-specified, and constrained. Use this template:
You are [role] working on [scope].
## Task
[Full description — paste it, don't reference external files]
## Context
[Where this fits, dependencies, architecture notes]
## Your Job
[Numbered steps]
## Constraints
- Do not spawn subagents.
- Do not call MCP delegate_* tools.
- Keep scope bounded to assigned files and outcomes.
[What to avoid, what not to touch]
## Report Format
1. Files read
2. Files changed + rationale
3. Checks/tests run + results
4. Blockers/open questions
5. Risks/integration notes
6. Recommended next actions
Paste full task text into the prompt. Subagents should never need to read plan files or hunt for context — provide everything upfront.
If a foreground agent returns an error or incomplete result:
If a wait times out (when using native subagent tools):
wait with longer timeoutsend_input to stalled trackIf a track exceeds 3 failed re-validation loops: stop automatic retry, surface explicit escalation report.
| Mistake | Fix |
|---|---|
| Parallel agents editing same files | Serialize conflicting tracks |
| Vague scope ("fix all tests") | Specific scope ("fix auth tests in src/auth.test.ts") |
| Skipping integration verification | Run full suite after parallel work completes |
| Subagents for trivial tasks | Do simple things yourself (<5 tool calls) |
| Unspecified output format | Agents return inconsistent, hard-to-synthesize summaries |
| Quality review before spec compliance | Spec first, quality second (for medium/high risk) |
| Unlimited rework loops | Cap at 3, then escalate with explicit report |
| Agents spawning more agents | Enforce max depth 2 — leaf workers cannot delegate |
| Background agents for critical work | Always foreground — background = fire-and-forget only |
| Not verifying agent output immediately | Check results right after return; don't assume success |
| Dispatching >4 parallel agents | Diminishing returns; 2-4 is the sweet spot |