Delegation
Parallelize work via six patterns: built-in agents (Engineer/Architect/Algorithm/Explore/Plan via Task), worktree-isolated agents (conflict-free parallel file edits), background agents (run_in_background: true, non-blocking), custom agents (ComposeAgent via Agents skill → Task general-purpose), agent teams (TeamCreate + TaskCreate + SendMessage for multi-turn peer coordination), and parallel task dispatch (N identical operations). Two-tier delegation: lightweight (haiku, max_turns=3, one-shot extraction/classification) vs full (multi-step, tool use, iteration). Decision rule — agents need to talk to each other or share state → Teams; independent one-shot work → Subagents. Auto-invoked by Algorithm when 3+ independent workstreams exist at Extended+ effort. USE WHEN 3+ workstreams, parallel execution, agent specialization, agent team, swarm, spawn agents, create team, fan out, divide and conquer, multi-agent, coordinate agents. NOT FOR single-agent custom personality composition (use Agents skill).
What this skill does
# Delegation — Agent Orchestration & Parallelization **Auto-invoked by the Algorithm when work can be parallelized or requires agent specialization.** ## 🚨 CRITICAL ROUTING — Two COMPLETELY Different Systems | the user Says | System | Tool | What Happens | |-------------|--------|------|-------------| | "**custom agents**", "**specialized agents**", "spin up agents", "launch agents" | **Agents Skill** (ComposeAgent) | `Task(subagent_type="general-purpose", prompt=<ComposeAgent output>)` | Unique personalities, voices, colors via trait composition | | "**create an agent team**", "**agent team**", "**swarm**" | **Claude Code Teams** | `TeamCreate` → `TaskCreate` → `SendMessage` | Persistent team with shared task list, message coordination, multi-turn collaboration | **These are NOT the same thing:** - **Custom agents** = one-shot parallel workers with unique identities, launched via `Task()`, no shared state - **Agent teams** = persistent coordinated teams with shared task lists, messaging, and multi-turn collaboration via `TeamCreate` ## When the Algorithm Should Use This Skill - **3+ independent workstreams** exist at Extended+ effort level - **Multiple identical non-serial tasks** need parallel execution - **Specialized expertise** needed (architecture design, implementation, ISC optimization) - **Large codebase changes** spanning 5+ files benefit from parallel workers - **Research + execution** can proceed simultaneously - **"Create an agent team"** — use TeamCreate for persistent coordinated teams - **Unattended autonomous work where auditability matters more than speed** — spawn an Observer team (Agents skill → SPAWNOBSERVERS) alongside the primary agent, reading the tool-activity audit log, voting continue/halt/escalate. ONLY use when BOTH (a) time is not a constraint and (b) auditability is the primary requirement. Never for interactive or time-sensitive work. See Agents/SKILL.md "Observer Team Archetype" for shape and guardrails. ## Delegation Patterns ### 1. Built-In Agents **⚠️ Built-in agents are for internal workflow routing ONLY.** When the user asks for custom, specialized, or uniquely-voiced agents, use the Agents skill (section 4 below) instead. Use `Task(subagent_type="AgentType")` with these specialized agents: | Agent Type | Specialization | When to Use | |-----------|---------------|-------------| | `Engineer` | TDD implementation, code changes | Code-heavy tasks requiring tests | | `Architect` | System design, structure decisions | Architecture planning, design specs | | `Algorithm` | ISC optimization, criteria work | ISC-specialized verification | | `Explore` | Fast codebase search | Quick file/pattern discovery | | `Plan` | Implementation strategy | Design before execution | **Always include:** Full context, effort budget, expected output format. ### 2. Worktree-Isolated Agents Run agents in their own git worktree with `isolation: "worktree"` for file-safe parallelism: ``` Task(subagent_type="Engineer", isolation: "worktree", prompt="...") ``` - Each agent gets its own working tree — no file conflicts with other agents - Worktree auto-created on spawn, auto-cleaned when agent finishes (unless changes made) - Use when multiple agents edit the same files or for competing approaches - Can combine with `run_in_background: true` for non-blocking isolated work - **Built-in agents with `isolation: worktree` in frontmatter** (Engineer, Architect) auto-isolate on every spawn ### 3. Background Agents Run agents with `run_in_background: true` for non-blocking parallel work: ``` Task(subagent_type="Engineer", run_in_background: true, prompt="...") ``` - Use when results aren't needed immediately - Check output with `Read` tool on the output_file path - Ideal for: research, long builds, parallel investigations ### 3. Foreground Agents Standard `Task()` calls that block until complete: - Use when you need the result before proceeding - Use for sequential dependencies - Default mode — most common ### 4. Custom Agents (via Agents Skill) **Trigger:** "custom agents", "spin up agents", "launch agents", "specialized agents" **Action:** Invoke the **Agents skill** → run `ComposeAgent.ts` → launch with `Task(subagent_type="general-purpose")` ```bash # Step 1: Compose agent identity bun run ~/.claude/skills/Agents/Tools/ComposeAgent.ts --traits "security,skeptical,thorough" --task "Review auth" --output json # Step 2: Launch with composed prompt Task(subagent_type="general-purpose", prompt=<ComposeAgent JSON .prompt field>) ``` - Each agent gets unique personality, voice, and color via ComposeAgent - Use DIFFERENT trait combinations for each agent to get unique voices - Never use built-in agent types (Engineer, Architect) for custom work - Ideal for: domain experts, adversarial reviewers, creative brainstormers, parallel analysis ### 5. Agent Teams (via TeamCreate) **Trigger:** "create an agent team", "agent team", "swarm", "team of agents" **Action:** Use `TeamCreate` tool → `TaskCreate` → spawn teammates via `Task(team_name=...)` → coordinate via `SendMessage` ``` 1. TeamCreate(team_name="my-project") # Creates team + task list 2. TaskCreate(subject="Implement auth module") # Create team tasks 3. Task(subagent_type="Engineer", team_name="my-project", name="auth-engineer") # Spawn teammate 4. TaskUpdate(taskId="1", owner="auth-engineer") # Assign task 5. SendMessage(type="message", recipient="auth-engineer", content="...") # Coordinate ``` **This is a COMPLETELY DIFFERENT system from custom agents:** - **Custom agents** (Agents skill) = fire-and-forget parallel workers, no shared state - **Agent teams** (TeamCreate) = persistent coordinated teams with shared task lists, messaging, multi-turn **Team Guidelines:** - Use for 3+ independently workable criteria at Extended+ - Large complex coding tasks benefit most - Each teammate works independently on assigned tasks via shared task list - Parent coordinates via `SendMessage`, reconciles results - Teammates go idle between turns — send messages to wake them ### When to Use Teams vs Subagents (Decision Matrix) | Factor | Subagents (Task) | Agent Teams (TeamCreate) | |--------|------------------|--------------------------| | **Communication** | Fire-and-forget, no peer messaging | Persistent messaging between teammates | | **Context** | Fresh context each spawn, limited window | Full context window per teammate, preserved across turns | | **Coordination** | Parent collects results, no shared state | Shared task list, direct peer DMs, idle/wake cycle | | **Duration** | Single-turn execution | Multi-turn, iterative work with course corrections | | **Overhead** | Low — spawn and forget | Higher — team setup, task creation, message routing | | **Best for** | Parallel research, one-shot analysis, simple delegation | Complex multi-file changes, iterative debugging, cross-layer coordination | **Decision rule:** If agents need to talk to each other or iterate on shared work → Teams. If each agent does independent one-shot work → Subagents. **Concrete examples:** - "Research 4 topics in parallel" → **Subagents** (independent, no coordination needed) - "Build a feature spanning API + UI + tests with shared state" → **Teams** (cross-layer, needs coordination) - "Run 10 file updates with same pattern" → **Subagents** (parallel, identical, independent) - "Debug a complex issue with competing hypotheses" → **Teams** (need to share findings, adjust approach) ### 6. Parallel Task Dispatch For N identical operations (e.g., updating 10 files with the same pattern): 1. Create N `Task()` calls in a single message (parallel launch) 2. Each agent gets one unit of work 3. Results collected when all complete ## Effort-Level Scaling | Effort | Delegation Strategy | |--------|-------------------| | Instant/Fast | No delegation — direct tools only | | Standard | 1-2 foreground agents max for discrete subtasks | | Extended | 2-4 agents, background agents for research | | Ad
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.