Patterns for multi-agent coordination, task decomposition, handoffs, and workflow orchestration. Helps design agent topologies like Conductor, Pipeline, Swarm, and Blackboard.
Ships in claude-skills-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill covers patterns for coordinating multiple AI agents, decomposing complex tasks, managing handoffs, and building robust agent workflows.
hybrid_orchestrator_first rule: never escalate to a swarm just to make a simple task look autonomous).┌─────────────────────────────────────────────────────┐
│ ORCHESTRATOR AGENT │
│ (Strategic coordination, task routing, synthesis) │
├─────────────────────────────────────────────────────┤
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ │
│ │ Specialist │ │ Specialist │ │ Specialist │ │
│ │ Agent A │ │ Agent B │ │ Agent C │ │
│ │ (Domain 1) │ │ (Domain 2) │ │ (Domain 3) │ │
│ └──────────────┘ └──────────────┘ └────────────┘ │
│ │
└─────────────────────────────────────────────────────┘
Complex Task: "Build a feature for user authentication"
Decomposed:
├── Research Phase (Research Agent)
│ ├── Analyze existing auth patterns in codebase
│ ├── Identify dependencies and constraints
│ └── Document findings
│
├── Design Phase (Architect Agent)
│ ├── Design auth flow
│ ├── Define API contracts
│ └── Create component structure
│
├── Implementation Phase (Developer Agent)
│ ├── Implement backend auth logic
│ ├── Build frontend components
│ └── Add error handling
│
├── Testing Phase (QA Agent)
│ ├── Write unit tests
│ ├── Integration tests
│ └── Security review
│
└── Documentation Phase (Docs Agent)
├── API documentation
├── User guide
└── Developer notes
Task: "Analyze codebase and suggest improvements"
Parallel Execution:
┌─────────────────────────────────────────────────────┐
│ ORCHESTRATOR │
│ Spawns parallel agents │
└───────────┬─────────────┬─────────────┬────────────┘
│ │ │
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────┐
│ Security │ │Performance│ │ Code │
│ Analyst │ │ Analyst │ │ Quality │
└─────┬─────┘ └─────┬─────┘ └─────┬─────┘
│ │ │
▼ ▼ ▼
[Security [Performance [Quality
Report] Report] Report]
│ │ │
└──────────────┼──────────────┘
│
▼
┌─────────────────┐
│ ORCHESTRATOR │
│ Synthesizes │
└─────────────────┘
Task: "Write a technical blog post"
Iteration Loop:
1. Researcher → Gathers information
2. Writer → Creates draft
3. Editor → Reviews and critiques
4. Writer → Revises based on feedback
5. Editor → Approves or requests more changes
6. Repeat 4-5 until quality threshold met
7. Publisher → Formats and publishes
interface TaskHandoff {
from_agent: string;
to_agent: string;
task_id: string;
context: {
original_request: string;
work_completed: string[];
current_state: any;
next_steps: string[];
};
artifacts: {
files_created: string[];
files_modified: string[];
decisions_made: Decision[];
};
}
// Example handoff
const handoff: TaskHandoff = {
from_agent: "ArchitectAgent",
to_agent: "DeveloperAgent",
task_id: "auth-feature-123",
context: {
original_request: "Implement user authentication",
work_completed: [
"Analyzed existing patterns",
"Designed auth flow",
"Created API contracts"
],
current_state: {
design_doc: "/docs/auth-design.md",
api_spec: "/specs/auth-api.yaml"
},
next_steps: [
"Implement AuthService class",
"Create login/logout endpoints",
"Build session management"
]
},
artifacts: {
files_created: ["/docs/auth-design.md", "/specs/auth-api.yaml"],
files_modified: [],
decisions_made: [
{ decision: "Use JWT for tokens", rationale: "Stateless, scalable" },
{ decision: "Redis for session store", rationale: "Fast, supports TTL" }
]
}
};
const agentCapabilities = {
ResearchAgent: ["search", "analyze", "summarize", "compare"],
ArchitectAgent: ["design", "plan", "structure", "evaluate"],
DeveloperAgent: ["implement", "refactor", "debug", "optimize"],
ReviewerAgent: ["review", "critique", "validate", "approve"],
DocsAgent: ["document", "explain", "format", "publish"]
};
function routeTask(task: string): string {
const taskVerb = extractVerb(task);
for (const [agent, capabilities] of Object.entries(agentCapabilities)) {
if (capabilities.includes(taskVerb)) {
return agent;
}
}
return "GeneralAgent"; // Fallback
}
// Problem: Context grows as agents work
// Solution: Summarize and compress at handoffs
interface CompressedContext {
essential: {
task_goal: string;
key_decisions: string[];
current_blockers: string[];
};
reference: {
file_paths: string[]; // Can be re-read if needed
doc_links: string[]; // External references
};
discarded: {
exploration_notes: string; // Summarized, not full content
rejected_approaches: string[];
};
}
function compressForHandoff(fullContext: any): CompressedContext {
return {
essential: extractEssentials(fullContext),
reference: extractReferences(fullContext),
discarded: summarizeDiscarded(fullContext)
};
}
One orchestrator coordinates all activity:
┌─────────────────────────────────────────────┐
│ CONDUCTOR AGENT │
│ - Receives initial request │
│ - Decomposes into subtasks │
│ - Assigns to specialist agents │
│ - Monitors progress │
│ - Synthesizes results │
│ - Handles failures and retries │
└─────────────────────────────────────────────┘
Best for: Complex projects with many dependencies
Example: the Starlight Orchestrator (see case study below)
Sequential processing through specialized stages:
Request → [Agent A] → [Agent B] → [Agent C] → Result
│ │ │
Stage 1 Stage 2 Stage 3
Research Design Execute
Best for: Well-defined workflows with clear stages
Example: Content creation pipeline
Multiple agents work in parallel, coordinating peer-to-peer:
┌────────┐
│Agent A │←──────────────────┐
└───┬────┘ │
│ │
┌────▼────┐ ┌────┴───┐
│ Agent B │◄────────────►│Agent D │
└────┬────┘ └────┬───┘
│ │
┌───▼────┐ │
│Agent C │◄──────────────────┘
└────────┘
Best for: Exploratory tasks, parallel research
Example: Codebase analysis from multiple angles
Shared workspace that all agents read/write:
┌─────────────────────────────────────────┐
│ BLACKBOARD │
│ ┌─────────────────────────────────┐ │
│ │ Current State: { ... } │ │
│ │ Hypotheses: [ ... ] │ │
│ │ Evidence: [ ... ] │ │
│ │ Conclusions: [ ... ] │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
│ │ │
┌────▼───┐ ┌────▼───┐ ┌────▼───┐
│Agent A │ │Agent B │ │Agent C │
│ reads │ │ reads │ │ reads │
│ writes │ │ writes │ │ writes │
└────────┘ └────────┘ └────────┘
Best for: Complex problem-solving with evolving understanding
Example: Debugging a complex system issue
async function executeWithRetry(agent, task, maxRetries = 3) {
for (let attempt = 1; attempt <= maxRetries; attempt++) {
try {
return await agent.execute(task);
} catch (error) {
if (attempt === maxRetries) throw error;
const delay = Math.pow(2, attempt) * 1000; // Exponential backoff
console.log(`Attempt ${attempt} failed, retrying in ${delay}ms`);
await sleep(delay);
}
}
}
const agentFallbacks = {
"SpecialistCodeReviewer": ["GeneralCodeReviewer", "SeniorDeveloper"],
"SecurityAnalyst": ["GeneralAnalyst", "SeniorDeveloper"],
"PerformanceExpert": ["GeneralAnalyst", "SeniorDeveloper"]
};
async function executeWithFallback(primaryAgent, task) {
try {
return await primaryAgent.execute(task);
} catch (error) {
const fallbacks = agentFallbacks[primaryAgent.name] || [];
for (const fallbackName of fallbacks) {
try {
console.log(`Primary failed, trying ${fallbackName}`);
return await getAgent(fallbackName).execute(task);
} catch (fallbackError) {
continue;
}
}
throw new Error(`All agents failed for task: ${task.id}`);
}
}
interface Checkpoint {
task_id: string;
completed_steps: string[];
current_step: string;
state: any;
timestamp: Date;
}
async function executeWithCheckpoints(task, steps) {
const checkpoint = await loadCheckpoint(task.id);
const startIndex = checkpoint
? steps.indexOf(checkpoint.current_step)
: 0;
for (let i = startIndex; i < steps.length; i++) {
const step = steps[i];
try {
await executeStep(step, task);
await saveCheckpoint({
task_id: task.id,
completed_steps: steps.slice(0, i + 1),
current_step: steps[i + 1] || "complete",
state: task.state,
timestamp: new Date()
});
} catch (error) {
// Checkpoint is saved, can resume from here
throw error;
}
}
}
function agentLog(agent, event, details) {
console.log(JSON.stringify({
timestamp: new Date().toISOString(),
agent: agent.name,
task_id: agent.currentTask?.id,
event: event,
details: details,
duration_ms: details.duration,
tokens_used: details.tokens
}));
}
// Usage
agentLog(agent, "TASK_START", { task: task.description });
agentLog(agent, "TOOL_CALL", { tool: "read_file", path: "/src/index.ts" });
agentLog(agent, "TASK_COMPLETE", { result: "success", duration: 5230 });
interface TaskProgress {
task_id: string;
total_steps: number;
completed_steps: number;
current_step: string;
estimated_remaining: number; // seconds
agents_involved: string[];
}
// Expose progress for UI/monitoring
function getProgress(task): TaskProgress {
return {
task_id: task.id,
total_steps: task.steps.length,
completed_steps: task.completedSteps.length,
current_step: task.currentStep?.description || "idle",
estimated_remaining: estimateRemaining(task),
agents_involved: task.agentHistory
};
}
interface Decision {
timestamp: Date;
agent: string;
decision: string;
options_considered: string[];
rationale: string;
confidence: number; // 0-1
reversible: boolean;
}
// Track all significant decisions
const decisionLog: Decision[] = [];
function recordDecision(agent, decision, options, rationale, confidence) {
decisionLog.push({
timestamp: new Date(),
agent: agent.name,
decision,
options_considered: options,
rationale,
confidence,
reversible: true
});
}
How I run this pattern in production — the Starlight Intelligence System and Agentic Creator OS, both public.
The orchestrator coordinates specialists through weighted synthesis:
┌────────────────────────────────────────────────────┐
│ STARLIGHT ORCHESTRATOR │
│ (Meta-intelligence coordinator) │
├────────────────────────────────────────────────────┤
│ │
│ Specialist Domains: │
│ ├── Starlight Architect (Systems design) │
│ ├── Creation Engine (Content/product) │
│ ├── Visionary (Future strategy) │
│ └── Sonic Engineer (Music/audio) │
│ │
│ Synthesis Process: │
│ 1. Each agent provides perspective │
│ 2. Orchestrator weights by domain relevance │
│ 3. Conflicts are explicitly surfaced │
│ 4. Final recommendation synthesizes all views │
│ │
└────────────────────────────────────────────────────┘
Book Writing Team:
Arcanea Development Team:
One agent that does everything - no specialization, no delegation.
Too many tiny agents with overlapping responsibilities.
Handoffs that don't preserve essential information.
Agents that keep handing work back and forth.
Agents that fail without proper error reporting.
Can't see what agents are doing or why.
Below is a complete, runnable Node.js (node --input-type=module) handoff validator that enforces single-maker write-lane isolation and independent cross-provider verification before allowing a slice to close:
import assert from 'node:assert/strict';
export function validateHandoffPacket(packet) {
const errors = [];
if (!packet.sliceId || typeof packet.sliceId !== 'string') errors.push('missing sliceId');
if (!packet.maker?.agent || !packet.maker?.modelFamily) errors.push('missing maker identity');
if (!packet.verifier?.agent || !packet.verifier?.modelFamily) errors.push('missing verifier identity');
// Rule 1: Independent verifier must not share the maker's execution context or write lane
if (packet.maker?.agent === packet.verifier?.agent) {
errors.push('maker and verifier cannot be the same agent instance');
}
// Rule 2: Non-empty write allowlist and deterministic verification commands
if (!Array.isArray(packet.writeAllowlist) || packet.writeAllowlist.length === 0) {
errors.push('writeAllowlist must declare explicit file globs');
}
if (!Array.isArray(packet.verificationReceipts) || packet.verificationReceipts.some((r) => r.exitCode !== 0)) {
errors.push('all verificationReceipts must record exitCode === 0');
}
return { valid: errors.length === 0, errors };
}
// Self-test fixture
const sampleHandoff = {
sliceId: 'O2-polar-checkout-gate',
maker: { agent: 'claude-opus', modelFamily: 'anthropic', branch: 'agent/claude/polar-gate' },
verifier: { agent: 'codex-verifier', modelFamily: 'openai', mode: 'read-only' },
writeAllowlist: ['app/api/checkout/route.ts', 'tests/polar-checkout.test.mjs'],
verificationReceipts: [{ cmd: 'node --test tests/polar-checkout.test.mjs', exitCode: 0 }],
};
assert.deepEqual(validateHandoffPacket(sampleHandoff), { valid: true, errors: [] });
writeAllowlist; parallel agents never commit to the same working tree.0) — never prose claims of completion ("should work", "looks good").Good orchestration is invisible - the system should feel like one coherent intelligence, not a committee of bickering agents.
What SKILL.md sets; muted values are Claude Code's defaults
/claude-skills-library:agentic-orchestrationfrom claude-skills-library
npx claudepluginhub frankxai/claude-skills-library --plugin claude-skills-library116 skills in this plugin
/acos-metaACOS self-description and configuration skill. Documents how ACOS works, how to extend it, how to add new skills/commands/agents, and how to debug the hook system. Use when building new ACOS capabilities, understanding the system architecture, or onboarding to ACOS for the first time./acos-visual-genGenerate research-grounded visuals using the InfoGenius pipeline. Use when creating infographics, diagrams, educational visuals, or any image that benefits from factual accuracy. Supports 8 visual styles (3D, technical, minimalist, photorealistic, futuristic, vintage, cartoon, standard) and 4 audience levels./agent-hygieneThe quality bar for any agent working on agent definitions, skills, commands, hooks, AGENTS.md or CLAUDE.md, in any repo and any harness. Use at session start, before editing a file under .claude/agents, agents/, .claude/commands or any SKILL.md, before handing work back, and whenever choosing which model tier (Haiku, Sonnet, Opus, Fable) or effort level a task deserves. Carries the estate guardrails, the agent-file contract the linter enforces, the verification line every hand-back ends with, and the routing rule for spending the top tier.Other plugins' skills for the same job