agent-teams
Guide for coordinating multiple Claude Code instances as a team using Agent Teams. Covers TeammateTool operations, spawn backends, communication, task coordination, hooks, and orchestration patterns. Use when building multi-agent workflows requiring inter-agent communication.
What this skill does
# Agent Teams
Coordinate multiple Claude Code instances as a team with shared task lists, inter-agent messaging, and independent context windows. Fundamentally different from subagents (Task tool): teammates communicate directly with each other, not just back to the caller.
## When to Use Agent Teams vs Subagents
```
Does the work require inter-agent communication?
├── No → Use subagents (Task tool)
│ ├── Focused tasks where only the result matters
│ ├── Research/verification that reports back
│ └── Lower token cost (results summarized to main context)
└── Yes → Use Agent Teams
├── Teammates need to share findings mid-task
├── Adversarial debate / competing hypotheses
├── Self-organizing work from shared task list
└── Complex coordination across 3+ parallel workers
How many parallel workers?
├── 1-3 independent tasks → Subagents (less overhead)
├── 3-5 coordinating workers → Agent Teams
└── 5+ workers → Agent Teams with delegate mode
```
**Best use cases:**
- Research + review from multiple perspectives simultaneously
- Multi-module features where teammates own different files
- Debugging with competing hypotheses (adversarial investigation)
- Cross-layer coordination (frontend, backend, tests)
**Avoid when:**
- Sequential tasks with many dependencies
- Same-file edits (causes overwrites)
- Simple focused work (coordination overhead not worth it)
- Routine tasks (single session more cost-effective)
## Environment Setup
Enable Agent Teams (experimental, disabled by default):
```json
// settings.json (user or project level)
{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}
```
Or set in shell: `export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`
## Tool Architecture
Agent Teams use four distinct tools (not a single "TeammateTool"):
| Tool | Purpose |
|------|---------|
| **TeamCreate** | Creates team config + task directory. Caller becomes lead |
| **SendMessage** | All inter-agent communication (5 message types below) |
| **TeamDelete** | Removes team resources after shutdown (cleanup) |
| **Task** (extended) | Spawns teammates when `name` + `team_name` params present |
### SendMessage Types
| Type | Parameters | Description |
|------|-----------|-------------|
| `message` | `recipient`, `content`, `summary` | Direct message to one teammate |
| `broadcast` | `content`, `summary` | Message to all teammates (expensive — N deliveries) |
| `shutdown_request` | `recipient`, `content` | Request teammate termination (lead only) |
| `shutdown_response` | `request_id`, `approve`, `content` | Accept/reject shutdown (teammate only) |
| `plan_approval_response` | `request_id`, `approve`, `recipient`, `content` | Approve/reject plan (lead only) |
**Critical:** Plain text output is NOT visible to teammates. Agents MUST use SendMessage for all inter-agent communication.
**Usage notes:**
- Prefer `message` over `broadcast` — broadcast creates N messages for N teammates
- Messages delivered automatically to recipient inboxes (no polling)
- Idle notifications sent automatically when teammates finish
- Only the lead should run TeamDelete — teammate context may not resolve correctly
## Spawning Teammates
**Method 1: Natural language** — Tell Claude to create a team and describe structure:
```
Create an agent team to review this PR. Spawn three reviewers:
- One focused on security
- One checking performance
- One validating test coverage
```
**Method 2: Task tool with team parameters:**
```
Task({
team_name: "my-team",
name: "worker-1",
subagent_type: "general-purpose",
prompt: "Review src/auth/ for security vulnerabilities...",
model: "sonnet",
run_in_background: true
})
```
**Teammate receives on spawn:**
- Same project context as regular session (CLAUDE.md, MCP servers, skills)
- The spawn prompt from the lead
- Does NOT inherit lead's conversation history
**Built-in agent types for teammates:**
| Type | Capabilities |
|------|-------------|
| `general-purpose` | All tools (Edit, Write, Bash, Task, etc.) |
| `Explore` | Read-only — codebase search and analysis |
| `Plan` | Read-only — architectural design |
| `Bash` | System commands only |
**Model selection:** Use Sonnet for most teammates (cost-effective). Reserve Opus for leads or complex reasoning tasks. Specify via `model` parameter or natural language ("Use Sonnet for each teammate").
## Spawn Backends
Controls how teammates display. Set via `teammateMode` in settings.json or `--teammate-mode` CLI flag.
| Mode | Setting | Requirements | Behavior |
|------|---------|-------------|----------|
| Auto (default) | `"auto"` | None | Split panes if in tmux, else in-process |
| In-process | `"in-process"` | None | All in main terminal. Shift+Up/Down to select |
| Split panes | `"tmux"` | tmux or iTerm2 | Each teammate gets own pane |
```json
// settings.json
{ "teammateMode": "in-process" }
```
```bash
# CLI override for single session
claude --teammate-mode in-process
```
**Auto-detection logic:**
1. `$TMUX` env var set → use tmux split panes
2. `$ITERM_SESSION_ID` set + `it2` available → use iTerm2
3. `which tmux` succeeds → use tmux
4. Fallback → in-process
**In-process navigation:**
- Shift+Up/Down → select teammate
- Enter → view teammate's session
- Escape → interrupt teammate's current turn
- Ctrl+T → toggle task list
**Split-pane navigation:**
- Click into pane to interact directly
- Each teammate has full terminal view
## Communication Patterns
**Direct message (`type: "message"`):** Send to one specific teammate via SendMessage. Use for targeted instructions, follow-ups, or redirecting approach.
**Broadcast (`type: "broadcast"`):** Send to all teammates simultaneously via SendMessage. Use sparingly — costs scale with team size. Good for: announcing shared decisions, requesting status updates.
**Automatic delivery:** Messages arrive at recipients automatically. Lead does not need to poll for updates.
**Idle notifications:** When a teammate finishes and stops, it automatically notifies the lead.
**Message type schemas:** See [assets/message-formats.yml](assets/message-formats.yml)
## Task Coordination
The shared task list coordinates work across the team. All agents see task status and can claim available work.
**Task lifecycle:** `pending` → `in_progress` → `completed`
**Assignment patterns:**
- Lead assigns explicitly ("Give task 3 to the security reviewer")
- Self-claim: after finishing a task, teammate picks next unassigned, unblocked task
**Dependencies:**
- Express with `blockedBy` field (array of task IDs)
- Auto-unblock: when blocking task completes, blocked tasks become available
- Enables sequential pipelines without polling
**File locking:** Task claiming uses file locking to prevent race conditions when multiple teammates try to claim simultaneously.
**Recommended task sizing:**
- 5-6 tasks per teammate for steady throughput
- Self-contained units producing clear deliverables
- Avoid: tasks too small (overhead > benefit) or too large (risk of wasted effort)
## Delegate Mode
Restricts the lead to coordination-only tools: spawning, messaging, shutting down teammates, and managing tasks. Prevents lead from implementing tasks itself.
**Enable:** Press Shift+Tab to cycle into delegate mode after starting a team.
**When to use:**
- Lead keeps implementing tasks instead of waiting for teammates
- You want pure orchestration (break down work, assign, synthesize)
- Large teams where lead should focus on coordination
**Known bug:** Teammates spawned AFTER entering delegate mode inherit restricted tool access (lose Read, Write, Edit, Bash, Glob, Grep). **Workaround:** Spawn all teammates BEFORE pressing Shift+Tab.
**When to skip:**
- Small teams where lead can contribute implementation
- Lead needs to do synthesis work requiring file edits
## Plan Approval Workflow
Require teammates to plan before implementing. Teammate works in read-only plan mode until lead approves.
**Spawn with plan approval:**
```
SpawnRelated 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.