Claude Skills Guide

Multi-Agent Orchestration with Claude Subagents Guide

Claude Code enables multi-agent systems through its subagent architecture. Rather than one long conversation handling everything, you can orchestrate multiple specialized Claude instances that collaborate on complex tasks — each focused on a narrow domain, coordinated by a parent agent that tracks overall progress.

Understanding Claude Subagents

In Claude Code, a subagent is a separate Claude process spawned by a parent agent using the Task tool. Each subagent runs with its own context window, can be assigned a specific skill, and reports back structured output to the parent.

The key advantage is separation of concerns. A parent agent coordinating a full-stack feature can delegate to:

Each subagent works in its domain; the parent integrates their outputs.

How Subagents Are Invoked in Practice

The parent agent uses the Task tool to spawn subagents. From within a Claude Code session, this looks like:

Use the Task tool to start a subagent with the frontend-design skill.
Instruct it to scaffold a notification bell component in src/components/NotificationBell.tsx
using Tailwind CSS and our existing design tokens from src/styles/tokens.ts.

Claude Code’s orchestration layer handles process management. You define what each subagent should do in its task description, and optionally which skill to activate:

Task for subagent 1:
/frontend-design
Create a NotificationBell component. Requirements: [...]
Output: the component file content

Task for subagent 2:
/tdd
Write Jest tests for the NotificationBell component.
Input: [component code from subagent 1]
Output: the test file content

There is no from claude import SubAgent Python library. Subagent orchestration happens inside Claude Code itself, not through an external SDK.

Coordination Patterns

Sequential Workflow

Sequential orchestration passes output from one subagent as input to the next. The parent waits for each step to complete before starting the next:

  1. frontend-design subagent creates component structure
  2. Backend subagent implements API routes based on component requirements
  3. tdd subagent generates tests for the integrated system

This is the right pattern when each step depends on the previous one’s output.

Parallel Execution

For independent tasks, the parent can launch multiple subagents simultaneously using multiple Task tool calls in a single turn. Claude Code will execute them concurrently:

Launch three parallel subagents:
1. frontend-design subagent: build the dashboard component
2. [pdf](/claude-skills-guide/best-claude-skills-for-data-analysis/) subagent: extract the API spec from docs/api-spec.pdf and produce a summary
3. tdd subagent: write integration tests for the existing auth module

Collect all three outputs and summarize what was completed.

The supermemory skill is useful in the parent context here — it stores what each subagent has completed so the parent maintains a coherent picture across many concurrent tasks.

Hierarchical Control

For large projects, mid-level manager agents can own specific subsystems:

Parent agent
├── Frontend manager (owns src/components/)
│   ├── UI subagent (frontend-design)
│   └── Test subagent (tdd)
└── Infrastructure manager (owns deployment/)
    ├── Scripts subagent (handles deployment scripts)
    └── Config subagent (handles IaC)

Each manager reduces the cognitive load on the parent and allows finer-grained progress tracking.

Defining Agent Responsibilities

Clear task definitions are more important than any other factor in subagent quality. Vague instructions produce inconsistent outputs. Specify:

A well-structured task definition:

Subagent task: Backend API routes
Skill: none (general purpose)
Working directory: src/server/routes/
Context: The frontend NotificationBell component expects GET /api/notifications
  returning [{id, message, timestamp, read}] and POST /api/notifications/:id/read.
Output: Express route handler file for these two endpoints, including input validation.

Context Management Across Agents

Each subagent has its own context window. Avoid dumping the entire codebase into every subagent; give each one only what it needs:

Layer Contents Who holds it
Global context Architecture overview, key dependencies, team conventions Parent agent (often from CLAUDE.md)
Agent-specific Relevant files, requirements for this domain Each subagent’s task prompt
Session state Task status, inter-agent messages, blockers Parent agent, optionally persisted via supermemory

When one subagent needs to reference another’s output, the parent summarizes and passes only the relevant portion — not the full conversation history.

Handling Agent Communication

Establish a convention for how subagents report results. A structured output format lets the parent make routing decisions without parsing free-form text:

{
  "agent": "backend-engineer",
  "status": "completed",
  "deliverables": ["src/server/routes/notifications.js"],
  "depends_on_next": ["tests from tdd subagent"],
  "blockers": []
}

If a subagent hits a blocker, the parent can retry with adjusted context, re-assign the task, or escalate to the user.

Event-Driven Agent Communication

For reactive systems, subagents can respond to events rather than following predetermined sequences. This suits monitoring, alerting, and continuous integration scenarios. The parent agent acts as the event router:

Event received: code-push to main branch

Dispatch subagents:
1. security-audit subagent: scan the diff for vulnerabilities
2. tdd subagent: run the test suite and report failures
3. documentation subagent: check if changed functions have updated docstrings

Collect results and post a status summary.

The parent tracks which events have been handled and which subagent outputs remain pending, then routes follow-up actions based on what each subagent reports.

Skill Composition Techniques

Effective orchestration requires thoughtful composition of what you pass to each subagent.

Output Normalization: Define a standard output format across subagents so the parent can parse results consistently without guessing. The structured format shown in the Agent Communication section above works well. Extend it with a confidence field for tasks where the subagent is uncertain:

{
  "agent": "security-audit",
  "status": "completed",
  "deliverables": [],
  "findings": ["SQL injection risk in routes/users.js:42"],
  "confidence": 0.85,
  "blockers": []
}

Fallback Chains: Define what happens when a subagent fails or returns low-confidence results. The parent can retry with a simpler scope, reassign to a different skill, or escalate to the user:

Primary: code-review subagent
On failure: reduce scope to a single function, retry
On second failure: surface to user with context

Context Passing: Maintain a running summary in the parent context. Each subagent adds its key findings; the parent distills these into a compact handoff for the next subagent rather than forwarding full conversation history.

Error Handling and Recovery

Multi-agent workflows need defined recovery paths:

Log all subagent interactions. The supermemory skill in the parent context can persist these logs across sessions, creating an audit trail for multi-day projects.

Real-World Example: Adding a Notification System

A complete feature addition across a real codebase:

  1. Parent receives the feature request and plans the work
  2. frontend-design subagent scaffolds the NotificationBell UI component
  3. Backend subagent designs WebSocket infrastructure and notification schema
  4. tdd subagent creates test scenarios for delivery, ordering, and read-state
  5. webapp-testing subagent validates the integrated feature in a running browser
  6. Parent reviews all outputs, resolves conflicts, and assembles the final PR description

Steps 2, 3, and 4 can run in parallel once the schema is agreed. Step 5 depends on all three completing. The parent manages that dependency.

Best Practices

Keep subagent responsibilities narrow. Agents with multiple unrelated responsibilities produce mediocre results across all of them. Specialized agents with clear boundaries consistently outperform general-purpose ones.

Invest time in the parent agent’s orchestration prompts. The quality of the parent’s coordination determines the quality of the whole system more than any individual subagent.

Monitor token usage. Context accumulates quickly in long-running multi-agent projects. Periodically summarize completed work and reset contexts for tasks that have finished.


Built by theluckystrike — More at zovo.one