subagent-coordination
Orchestrate baselayer subagents for complex tasks. Defines available agents, their skills, and workflows for multi-agent scenarios. Load when coordinating work across agents, delegating tasks, or deciding which agent handles what.
$ Installieren
git clone https://github.com/outfitter-dev/agents /tmp/agents && cp -r /tmp/agents/baselayer/skills/subagent-coordination ~/.claude/skills/agents// tip: Run this command in your terminal to install the skill
name: subagent-coordination version: 2.1.0 description: | Orchestrate baselayer subagents for complex tasks. Defines available agents, their skills, and workflows for multi-agent scenarios. Load when coordinating work across agents, delegating tasks, or deciding which agent handles what. triggers:
- orchestrate
- coordinate
- delegate
- dispatch
- which agent
- multi-agent
- subagent
Subagent Coordination
Orchestrate baselayer subagents by matching tasks to the right agent + skill combinations.
Orchestration Planning
For complex multi-agent tasks, start with the Plan subagent to research and design the orchestration strategy before execution.
Complex task arrives
â
âââș Plan subagent (research phase)
â âââș Explore codebase, gather context
â âââș Identify which agents and skills needed
â âââș Design execution sequence (sequential, parallel, or hybrid)
â âââș Return orchestration plan
â
âââș Execute plan (dispatch agents per plan)
Plan subagent benefits:
- Runs in isolated context â doesn't consume main conversation tokens
- Can read many files without bloating orchestrator context
- Returns concise plan for execution
When to use Plan subagent:
- Task touches multiple domains (auth + performance + testing)
- Unknown codebase area â needs exploration first
- Sequence of agents matters (dependencies between steps)
- High-stakes changes requiring careful coordination
Roles and Agents
Coordination uses roles (what function is needed) mapped to agents (who fulfills it). This allows substitution when better-suited agents are available.
Baselayer Agents
| Role | Agent | Purpose |
|---|---|---|
| coding | senior-dev | Build, implement, fix, refactor |
| reviewing | ranger | Evaluate code, PRs, architecture, security |
| research | analyst | Investigate, research, explore |
| debugging | debugger | Diagnose issues, trace problems |
| testing | tester | Validate, prove, verify behavior |
| challenging | skeptic | Challenge complexity, question assumptions |
| specialist | specialist | Domain expertise (CI/CD, design, accessibility, etc.) |
| patterns | pattern-analyzer | Extract reusable patterns from work |
Other Available Agents
Additional agents may be available in your environment (user-defined, plugin-provided, or built-in). When dispatching:
- Check available agents for best fit to the role
- Prefer specialized agents over generalists when they match the task
- Fall back to baselayer agents when no better option exists
Examples of role substitution:
- coding â
senior-engineer,developer,senior-dev - reviewing â
security-auditor,code-reviewer,ranger - research â
research-engineer,docs-librarian,analyst - specialist â
cicd-expert,design-agent,accessibility-auditor,bun-expert
Task Routing
Route by role, then select the best available agent for that role:
User request arrives
â
âââș "build/implement/fix/refactor" âââș coding role
â
âââș "review/critique/audit" âââș reviewing role
â
âââș "investigate/research/explore" âââș research role
â
âââș "debug/diagnose/trace" âââș debugging role
â
âââș "test/validate/prove" âââș testing role
â
âââș "simplify/challenge/is this overkill" âââș challenging role
â
âââș "deploy/configure/CI/design/a11y" âââș specialist role
â
âââș "capture this workflow/make reusable" âââș patterns role
Workflow Patterns
Sequential Handoff
One agent completes, passes to next:
research (investigate) â coding (implement) â reviewing (verify) â testing (validate)
Use when: Clear phases, each requires different expertise.
Parallel Execution
Multiple agents work simultaneously using run_in_background: true:
âââș reviewing (code quality)
â
task âââŒââș research (impact analysis)
â
âââș testing (regression tests)
Use when: Independent concerns, time-sensitive, comprehensive coverage needed.
Challenge Loop
Build â challenge â refine:
coding (propose) ââ challenging (evaluate) â coding (refine)
Use when: Complex architecture, preventing over-engineering, high-stakes decisions.
Investigation Chain
Narrow down, then fix:
research (scope) â debugging (root cause) â coding (fix) â testing (verify)
Use when: Bug reports, production issues, unclear symptoms.
Role + Skill Combinations
Coding Role
| Task | Skills |
|---|---|
| New feature | software-engineering, test-driven-development |
| Bug fix | debugging-and-diagnosis â software-engineering |
| Refactor | software-engineering + complexity-analysis |
| API endpoint | hono-dev, software-engineering |
| React component | react-dev, software-engineering |
| AI feature | ai-sdk, software-engineering |
Reviewing Role
| Task | Skills |
|---|---|
| PR review | code-review |
| Architecture review | software-architecture |
| Performance audit | performance-engineering |
| Security audit | security-engineering |
| Pre-merge check | code-review + scenario-testing |
Research Role
| Task | Skills |
|---|---|
| Codebase exploration | codebase-analysis |
| Research question | research-and-report |
| Unclear requirements | pathfinding |
| Status report | status-reporting, report-findings |
Testing Role
| Task | Skills |
|---|---|
| Feature validation | scenario-testing |
| TDD implementation | test-driven-development |
| Integration testing | scenario-testing |
Advanced Execution Patterns
Background Execution
Run agents asynchronously for parallel work:
{
"description": "Security review",
"prompt": "Review auth module for vulnerabilities",
"subagent_type": "ranger",
"run_in_background": true
}
Retrieve results with TaskOutput:
{
"task_id": "agent-abc123",
"block": true
}
Chaining Subagents
Sequence agents for complex workflows â each agent's output informs the next:
research agent â "Found 3 auth patterns in use"
â
coding agent â "Implementing refresh token flow using pattern A"
â
reviewing agent â "Verified implementation, found 1 issue"
â
coding agent â "Fixed issue, ready for merge"
Pass context explicitly between agents via prompt.
Resumable Sessions
Continue long-running work across invocations:
{
"description": "Continue security analysis",
"prompt": "Now examine session management",
"subagent_type": "ranger",
"resume": "agent-abc123"
}
Agent preserves full context from previous execution.
Use cases:
- Multi-phase research spanning topics
- Iterative refinement without re-explaining context
- Long debugging sessions with incremental discoveries
Model Selection
Override model for specific needs:
{
"subagent_type": "analyst",
"model": "haiku" // Fast, cheap for exploration
}
- haiku: Fast exploration, simple queries
- sonnet: Balanced reasoning (default)
- opus: Complex analysis, nuanced judgment
Coordination Rules
- Single owner: One role owns each task phase
- Clear handoffs: Explicit deliverables between agents
- Skill loading: Agent loads only needed skills
- User prefs first: Check
CLAUDE.mdbefore applying defaults - Minimal agents: Don't parallelize what can be sequential
Decision Framework
When agents face implementation choices:
- Favor existing patterns â Match what's already in the codebase
- Prefer simplicity â Cleverness is a liability; simple is maintainable
- Optimize for maintainability â Next developer (or agent) must understand it
- Consider backward compatibility â Breaking changes require explicit approval
- Document trade-offs â When choosing between options, record why
These principles apply across all roles. Agents should surface decisions to the orchestrator when trade-offs are significant.
Communication Style
Orchestrators and agents should:
- Report progress at each major step (don't go silent)
- Flag blockers immediately â don't spin on unsolvable problems
- Provide clear summaries of delegated work (what was done, what remains)
- Include file paths and line numbers when referencing code
Progress format:
ââââââââââ [1/5] research: Exploring auth patterns
ââââââââââ [2/5] coding: Implementing refresh token flow
When to Escalate
- Blocked: Agent can't proceed â route to research role
- Conflicting findings: Multiple agents disagree â surface to user
- Scope creep: Task expands beyond role's domain â re-route
- Missing context: Not enough info â research role with pathfinding skill
Anti-Patterns
- Running all agents on every task (wasteful)
- Skipping reviewing role for "small changes" (risk)
- Coding role debugging without debugging skills (inefficient)
- Parallel agents with dependencies (race conditions)
- Not challenging complex proposals (over-engineering)
Quick Reference
"I need to build X" â coding role + TDD skills
"Review this PR" â reviewing role + code-review
"Why is this broken?" â debugging role + debugging-and-diagnosis
"Is this approach overkill?" â challenging role + complexity-analysis
"Prove this works" â testing role + scenario-testing
"What's the codebase doing?" â research role + codebase-analysis
"Deploy to production" â specialist role + domain skills
"Make this workflow reusable" â patterns role + patternify
Repository
