Claude Code Swarm Orchestration Skill Guide
Complete reference skill for multi-agent swarm orchestration in Claude Code. Covers TeammateTool API, 6 orchestration patterns, spawn backends, and error handling.
Installation avec revue préalable
Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.
npx -y tokrepo@latest install e07746ff-7065-4e96-922d-9c02aa90f6a8 --target codexDry-run d'abord, confirmez les écritures, puis lancez cette commande.
What it is
The Swarm Orchestration skill is a reference guide for building multi-agent systems within Claude Code. It documents the TeammateTool API for spawning subagents, six orchestration patterns (fan-out, pipeline, supervisor, consensus, map-reduce, and recursive), spawn backend options, and error handling strategies. The skill file is installed into your Claude Code skills directory and activates when you work on multi-agent workflows.
This skill targets developers building complex AI systems where a single agent is insufficient -- scenarios requiring parallel research, multi-step validation, or coordinated code changes across a large codebase.
How it saves time or tokens
Without this skill, developers must discover the TeammateTool API and orchestration patterns through trial and error. The skill provides tested patterns with correct parameter names, error handling, and concurrency limits. This means Claude Code generates working multi-agent code on the first attempt rather than producing broken spawn calls that fail at runtime.
How to use
- Save the skill file to your Claude Code skills directory:
mkdir -p ~/.claude/skills/swarm-orchestration
curl -o ~/.claude/skills/swarm-orchestration/SKILL.md \
https://gist.githubusercontent.com/kieranklaassen/4f2aba89594a4aea4ad64d753984b2ea/raw/SKILL.md
- Or install via Claude Code:
claude skill install swarm-orchestration
- Ask Claude Code to build multi-agent workflows -- it will automatically reference the skill patterns.
Example
# Fan-out pattern: parallel research agents
from claude_code import TeammateTool
# Spawn 3 research agents in parallel
tasks = [
TeammateTool.spawn(
name='researcher-1',
prompt='Research React state management libraries',
background=True
),
TeammateTool.spawn(
name='researcher-2',
prompt='Research Vue state management libraries',
background=True
),
TeammateTool.spawn(
name='researcher-3',
prompt='Research Svelte state management libraries',
background=True
),
]
# Collect results
results = [task.wait() for task in tasks]
# Synthesize findings
TeammateTool.spawn(
name='synthesizer',
prompt=f'Compare these findings: {results}'
)
Related on TokRepo
- Multi-agent frameworks -- Compare orchestration frameworks including LangGraph, CrewAI, and AutoGen
- AI tools for coding -- Developer tools for AI-assisted programming
Common pitfalls
- Spawning too many concurrent agents exhausts API rate limits; the skill recommends a maximum of 5 parallel spawns
- Subagent errors do not propagate to the parent by default; always check return status before using results
- The skill file must be in the correct directory structure (~/.claude/skills/<name>/SKILL.md) or Claude Code will not detect it
Questions fréquentes
The skill documents six patterns: fan-out (parallel independent tasks), pipeline (sequential handoffs), supervisor (parent monitors children), consensus (multiple agents vote on output), map-reduce (split work then aggregate), and recursive (agent spawns sub-problems of the same type).
TeammateTool is the Claude Code API for spawning subagents. It lets one Claude Code session create child sessions with specific prompts, tools, and permissions. Each child runs independently and returns results to the parent. The skill documents the correct parameters and patterns.
The practical limit depends on your API rate limits and the complexity of each agent's task. The skill recommends a maximum of 5 parallel spawns to avoid rate limiting. For larger workloads, use a pipeline or map-reduce pattern with controlled concurrency.
The skill requires a Claude Code version that supports TeammateTool and the skills directory structure. Check that your Claude Code version supports subagent spawning before installing. Older versions without TeammateTool will not benefit from the skill.
Yes. The skill provides reference patterns that you can modify. Each pattern is a starting point. You can adjust concurrency limits, error handling strategies, and result aggregation logic to match your specific use case.
Sources citées (3)
- Skill Gist— Swarm orchestration skill for Claude Code multi-agent workflows
- Anthropic Claude Code Docs— Claude Code supports subagent spawning via TeammateTool
- Anthropic Multi-Agent Docs— Multi-agent orchestration patterns for LLM applications
En lien sur TokRepo
Source et remerciements
Created by Kieran Klaassen. Based on Claude Code v2.1.19.
Fil de discussion
Actifs similaires
Claude-Flow — Multi-Agent Orchestration for Claude Code
Layers swarm and hive-mind multi-agent orchestration on top of Claude Code with 64 specialized agents, SQLite memory, and parallel execution.
Claude Swarm — Multi-Agent Orchestration with SDK
Python-based multi-agent orchestration built on Claude Agent SDK. Opus decomposes tasks, Haiku workers execute in parallel waves with real-time TUI dashboard and budget control.
Claude Code CLAUDE.md — Best Practices Template
Production-tested CLAUDE.md template for Claude Code projects. Covers coding conventions, test requirements, git workflow, and project-specific AI instructions.
Claude Code Hooks — Automate Pre/Post Task Actions
Complete guide to Claude Code hooks for automating actions before and after tool calls. Set up linting, testing, notifications, and custom validation with shell commands.