orchestrate
Runtime orchestration of agent teams for parallel work. Use when the user says "create a team", "/orchestrate", or wants multiple Claude instances working together. Supports patterns: review (parallel code review), debate (competing hypotheses), plan (explore + plan + critique), build (parallel implementation), research (parallel investigation), cross-agent (multi-engine comparison via CLI bridges like Codex), and custom teams. This skill handles live team coordination at runtime — distinct from cadre:init which bootstraps static team definitions and agent configurations for a project. TRIGGERS - Use this skill when user says: - "/orchestrate review src/" or "review this code with a team" - "/orchestrate debate 'why does X fail'" or "investigate this bug with competing theories" - "/orchestrate plan 'add authentication'" or "plan this feature with a team" - "/orchestrate build 'calculator module'" or "build this with a team" - "/orchestrate research 'compare React vs Vue'" or "research this topic in parallel" - "/orchestrate cleanup" or "shut down the team" - Any request to create an agent team or coordinate multiple Claude instances
What this skill does
# Agent Team Skill
Orchestrate teams of Claude Code sessions for parallel work. Parse user input to determine
the pattern and target, then execute the appropriate team workflow.
## Input Parsing
Parse `$ARGUMENTS` to determine:
1. **Pattern**: first word (review, debate, plan, build, research, custom, cleanup)
2. **Target**: remaining text (file path, description, or quoted string)
If no pattern is recognized, ask the user which pattern to use.
## Prerequisites Check
Before creating any team, verify the environment:
```bash
echo $CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS
```
If not `1`, tell the user to enable it and stop.
## Pattern Workflows
Each pattern follows the same lifecycle:
1. Create team with `Teammate(spawnTeam)`
2. Create tasks with `TaskCreate`
3. Spawn teammates with `Task` tool (team_name + name params)
4. Monitor progress via `TaskList` and incoming messages
5. Synthesize results when all teammates report back
6. Shutdown and cleanup
For pattern-specific teammate prompts, task structures, and configurations,
see [reference/patterns.md](reference/patterns.md).
## Teammate Prompt Template
Every teammate prompt MUST include these steps (learned from testing):
```
You are "{name}", a {role} on the {team-name} team.
Your task: {specific task description with file paths}
Steps:
1. Check TaskList and claim task #{n} (set owner to your name, mark in_progress)
2. {Pattern-specific work steps}
3. Mark task #{n} as completed
4. Send a message to the team lead with a brief summary of your findings
```
For debate/plan patterns, add:
```
5. Send messages to {other teammates by name} to {challenge/review/discuss} their findings
```
## Model Selection
Default to `sonnet` for teammates to manage token costs. Use `opus` only when the user
explicitly requests it or the task requires deep reasoning (architecture, complex debugging).
Pass the model parameter when spawning: `model: "sonnet"` in the Task tool call.
## Shutdown Sequence
Reliable shutdown (handles the known flaky behavior):
1. Send `shutdown_request` to each teammate via SendMessage
2. Wait for `shutdown_approved` messages (up to 30 seconds)
3. If a teammate doesn't respond:
- Send a direct message nudging them to shut down
- Send another `shutdown_request`
4. Run `Teammate(cleanup)`
5. If cleanup fails with "active members":
- Run `rm -rf ~/.claude/teams/{team-name} ~/.claude/tasks/{team-name}`
- Inform the user that manual cleanup was needed
## Cleanup Command
When `$ARGUMENTS` is "cleanup":
1. Run the shutdown sequence above for all active teammates
2. Report what was cleaned up
## Error Handling
- If `spawnTeam` fails with "already leading team": run `Teammate(cleanup)` first, retry
- If a teammate gets stuck: send Escape hint to user, offer to spawn replacement
- If tasks appear stuck: check if work is done, manually update task status
## Cost Warning
Before spawning teams with 4+ teammates, warn the user:
"This will spawn {N} teammates, each using its own context window. Token usage scales
linearly with team size. Proceed?"
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.