swarm
Orchestrate parallel agent teams using Claude Code's experimental Agent Teams feature
What this skill does
# Swarm Command
You orchestrate parallel agent teams for complex multi-agent workflows. This skill surfaces the swarm orchestration pattern documented in `docs/patterns/swarm-orchestration.md`.
**Task:** $ARGUMENTS
## Phase 1: Check Environment
```bash
echo "=== Swarm Readiness Check ==="
# Check if Agent Teams is enabled
if [ -n "$CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS" ]; then
echo "Agent Teams: ENABLED"
SWARM_MODE="agent-teams"
else
echo "Agent Teams: NOT ENABLED (falling back to parallel Task dispatch)"
echo ""
echo "To enable Agent Teams (experimental):"
echo " export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1"
echo ""
SWARM_MODE="task-parallel"
fi
echo "Swarm mode: $SWARM_MODE"
```
## Phase 2: Decompose the Task
Break the user's task into parallelizable work units. For each unit, identify:
1. **Agent type** — which specialized agent should handle this?
2. **Dependencies** — does this unit depend on another completing first?
3. **Inputs** — what context does the agent need?
4. **Outputs** — what should the agent produce?
Present the decomposition:
```markdown
### Task Decomposition
| # | Work Unit | Agent | Depends On | Parallel Group |
|---|-----------|-------|------------|----------------|
| 1 | [desc] | [agent type] | — | A |
| 2 | [desc] | [agent type] | — | A |
| 3 | [desc] | [agent type] | 1, 2 | B |
```
**Parallel groups** run simultaneously. Group B waits for Group A to complete.
## Phase 3: Dispatch
### Task-Parallel Mode (Default)
Use multiple Task tool invocations in a single message to achieve parallelism:
```
For each work unit in Parallel Group A:
Task tool invocation:
subagent_type: [appropriate agent]
description: "[work unit description]"
prompt: "[detailed prompt with context and expected output format]"
Wait for Group A results.
For each work unit in Parallel Group B:
Task tool invocation:
subagent_type: [appropriate agent]
description: "[work unit description]"
prompt: "[detailed prompt with Group A results as context]"
```
**Key rules:**
- Launch ALL agents in the same parallel group in a single message
- Never launch dependent work units before their dependencies complete
- Include full context in each agent prompt (agents don't share memory)
- Set `run_in_background: true` for long-running agents if you have other work to do
### Agent Teams Mode (Experimental)
If Agent Teams is enabled, use the TeammateTool and InboxTool pattern instead:
1. Spawn teammates for each work unit
2. Each teammate works independently
3. Leader monitors inboxes for results
4. Leader synthesizes findings as they arrive
**Note:** Agent Teams is experimental. If it fails, fall back to Task-Parallel mode.
## Phase 4: Synthesize
After all work units complete:
1. **Collect results** from all agents
2. **Resolve conflicts** — if agents disagree, present both perspectives
3. **Identify gaps** — what did no agent cover?
4. **Produce unified output** — combine into a single coherent result
```markdown
### Swarm Results
**Mode:** [task-parallel | agent-teams]
**Agents dispatched:** [count]
**Parallel groups:** [count]
#### Findings
[Synthesized results organized by theme, not by agent]
#### Conflicts
[Areas where agents disagreed, with both perspectives]
#### Gaps
[Areas no agent covered that may need follow-up]
#### Recommended Next Steps
[What to do with these results]
```
## Common Swarm Patterns
### Code Review Swarm
Dispatch security-analyst, typescript-reviewer, architecture-strategist, and code-simplicity-reviewer in parallel against the same diff.
### Research Swarm
Dispatch learnings-researcher, best-practices-researcher, framework-docs-researcher, and repo-research-analyst in parallel on different aspects of a question.
### Implementation Swarm
Dispatch frontend-specialist and backend-specialist in parallel for full-stack features, then work-validator to review both.
## Guidelines
- **Minimum 2 agents** — if only 1 agent is needed, use Task directly instead of /swarm
- **Maximum 6 agents per group** — more than 6 parallel agents is diminishing returns
- **Include full context** — each agent gets its own prompt; don't assume shared knowledge
- **Prefer Task-Parallel** — it's stable and production-ready. Agent Teams is experimental.
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.