Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Coordinate multiple AI agents working together on complex tasks — routing, handoffs, consensus, memory sharing, and quality gates. Use when tasks involve building multi-agent systems, coordinating specialist agents in a pipeline, implementing agent-to-agent communication, designing swarm architectures, setting up agent orchestration frameworks, or building autonomous agent teams with supervision and quality control. Covers hierarchical, mesh, and pipeline topologies.
.claude/skills/terminalskills-agent-swarm-orchestration/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-22 | ✓→✓ | = Same ✓ | 143% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 55% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 193% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 65% | 0% |
Coordinate multiple AI agents working together on complex tasks. Design topologies, implement routing, handle handoffs, share memory, and enforce quality gates.
Single-agent limitations: context window fills up, generalist performance degrades on specialist tasks, no parallel execution, single point of failure. Multi-agent benefits: focused expertise per agent, parallel subtasks, quality agents review others' work, failed agents retry without losing all progress.
Pipeline (sequential):
Task → Agent A → Agent B → Agent C → Result
Best for: Linear workflows (Spec → Code → Test → Deploy)
Hierarchical (manager + workers):
Orchestrator
/ | \
Coder Tester Reviewer
Best for: Complex tasks decomposing into independent subtasks
Hub-and-spoke (router):
┌→ Specialist A
Router → Specialist B
└→ Specialist C
Best for: Task classification and routing to the right expertpython# orchestrator.py — Central coordinator managing agent pipeline from dataclasses import dataclass, field from enum import Enum class AgentRole(Enum): PLANNER = "planner" CODER = "coder" REVIEWER = "reviewer" TESTER = "tester" @dataclass class AgentTask: id: str role: AgentRole input_data: dict output_data: dict = field(default_factory=dict) status: str = "pending" retries: int = 0 max_retries: int = 3 class Orchestrator: def __init__(self, agents: dict[AgentRole, 'Agent']): self.agents = agents self.tasks: list[AgentTask] = [] self.context: dict = {} # Shared memory async def run_pipeline(self, spec: str) -> dict: plan = await self._run_agent(AgentRole.PLANNER, {"spec": spec}) self.context["plan"] = plan for subtask in plan.get("subtasks", []): result = await self._run_agent(AgentRole.CODER, { "task": subtask, "plan": plan }) review = await self._run_agent(AgentRole.REVIEWER, { "code": result, "requirements": subtask }) retries = 0 while not review.get("approved") and retries < 3: result = await self._run_agent(AgentRole.CODER, { "task": subtask, "previous_attempt": result, "feedback": review.get("feedback") }) review = await self._run_agent(AgentRole.REVIEWER, { "code": result, "requirements": subtask }) retries += 1 self.context[f"subtask_{subtask['id']}"] = result tests = await self._run_agent(AgentRole.TESTER, {"code": self.context}) return {"plan": plan, "results": self.context, "tests": tests} async def _run_agent(self, role: AgentRole, input_data: dict) -> dict: agent = self.agents[role] task = AgentTask(id=f"{role.value}_{len(self.tasks)}", role=role, input_data=input_data) self.tasks.append(task) try: task.status = "running" result = await agent.execute(input_data) task.output_data = result task.status = "completed" return result except Exception: task.status = "failed" if task.retries < task.max_retries: task.retries += 1 return await self._run_agent(role, input_data) raise
python# router.py — Classify and route tasks to specialists class TaskRouter: ROUTING_PROMPT = """Classify this task and select the best agent: Task: {task} Available agents: {agents} Return JSON: {{"agent": "name", "confidence": 0.0-1.0, "reasoning": "why"}}""" def __init__(self, agents: dict[str, 'Agent']): self.agents = agents async def route(self, task: str) -> dict: agent_descriptions = "\n".join( f"- {name}: {agent.description}" for name, agent in self.agents.items() ) routing = await self._classify(task, agent_descriptions) return await self.agents[routing["agent"]].execute({"task": task})
python# shared_memory.py — Inter-agent communication layer class SharedMemory: def __init__(self): self.facts: list[dict] = [] self.decisions: list[dict] = [] self.artifacts: dict = {} def add_fact(self, agent: str, fact: str, confidence: float = 1.0): self.facts.append({"agent": agent, "fact": fact, "confidence": confidence}) def add_decision(self, agent: str, decision: str, reasoning: str): self.decisions.append({"agent": agent, "decision": decision, "reasoning": reasoning}) def get_context_for_agent(self, agent_role: str, max_items: int = 20) -> str: parts = [] for f in self.facts[-max_items:]: parts.append(f"[{f['agent']}] {f['fact']}") for d in self.decisions[-max_items:]: parts.append(f"[{d['agent']}] {d['decision']}: {d['reasoning']}") return "\n".join(parts)
Enforce quality between pipeline stages:
python# quality_gate.py — Validate agent output before handoff @dataclass class QualityCheck: name: str passed: bool details: str severity: str # "blocking" or "warning" class QualityGate: async def check(self, stage: str, output: dict) -> list[QualityCheck]: checks = [] if stage == "code": checks.append(self._check_syntax(output.get("code", ""))) checks.append(self._check_tests_present(output)) checks.append(self._check_no_secrets(output.get("code", ""))) elif stage == "review": checks.append(self._check_review_depth(output.get("review", ""))) elif stage == "test": checks.append(self._check_tests_pass(output.get("test_results", {}))) return checks def gate_passed(self, checks: list[QualityCheck]) -> bool: return all(c.passed for c in checks if c.severity == "blocking")
promptBuild a multi-agent pipeline for automated code review. Agent 1 (Analyzer) reads the PR diff and identifies potential issues. Agent 2 (Security Reviewer) checks for security vulnerabilities. Agent 3 (Style Checker) verifies coding standards. The Orchestrator collects all findings, deduplicates, prioritizes by severity, and produces a structured review. Include retry logic for when agents produce low-quality reviews.
promptBuild a research swarm where 4 agents each search different sources (web, academic papers, news, social media) for information about a topic, then a Synthesizer agent combines their findings into a comprehensive brief. Use shared memory so agents can see what others have found and avoid duplication. Include confidence scores and source citations.
promptBuild a support ticket routing system with 5 specialist agents: Billing, Technical, Account, Feature Requests, and Escalation. The Router agent classifies incoming tickets and routes to the right specialist. If confidence is below 70%, route to a generalist. Track routing accuracy and retrain the classifier weekly based on resolution data.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-22 | pass→pass | 7,585 | 9,148 | +21% | 1 | 1 | 0% | 1,421 | 3,451 | +143% | 0 | 0 | — |
case-01 | pass→pass | 11,014 | 5,379 | -51% | 1 | 1 | 0% | 1,959 | 3,033 | +55% | 0 | 0 | — |
case-02 | pass→pass | 6,904 | 7,990 | +16% | 1 | 1 | 0% | 1,241 | 3,640 | +193% | 0 | 0 | — |
case-03 | pass→pass | 11,486 | 6,449 | -44% | 1 | 1 | 0% | 1,992 | 3,292 | +65% | 0 | 0 | — |
case-04 | pass→pass | 12,772 | 7,073 | -45% | 1 | 1 | 0% | 1,830 | 3,347 | +83% | 0 | 0 | — |
case-05 | pass→pass | 11,597 | 4,083 | -65% | 1 | 1 | 0% | 2,208 | 2,822 | +28% | 0 | 0 | — |
case-06 | pass→pass | 10,411 | 4,860 | -53% | 1 | 1 | 0% | 1,787 | 2,857 | +60% | 0 | 0 | — |
case-07 | pass→pass | 15,636 | 11,434 | -27% | 1 | 1 | 0% | 2,424 | 4,218 | +74% | 0 | 0 | — |
case-08 | pass→pass | 12,211 | 13,455 | +10% | 1 | 1 | 0% | 2,006 | 4,505 | +125% | 0 | 0 | — |
case-09 | pass→pass | 11,889 | 9,346 | -21% | 1 | 1 | 0% | 2,328 | 3,959 | +70% | 0 | 0 | — |
case-10 | pass→pass | 14,395 | 12,862 | -11% | 1 | 1 | 0% | 2,626 | 4,478 | +71% | 0 | 0 | — |
case-11 | fail→pass | 16,849 | 5,044 | -70% | 1 | 1 | 0% | 2,213 | 2,929 | +32% | 0 | 0 | — |
case-12 | pass→pass | 12,826 | 15,312 | +19% | 1 | 1 | 0% | 2,430 | 5,158 | +112% | 0 | 0 | — |
case-13 | pass→pass | 16,059 | 14,659 | -9% | 1 | 1 | 0% | 2,840 | 4,364 | +54% | 0 | 0 | — |
case-14 | pass→pass | 12,055 | 8,962 | -26% | 1 | 1 | 0% | 2,137 | 3,850 | +80% | 0 | 0 | — |
case-15 | pass→pass | 10,626 | 7,600 | -28% | 1 | 1 | 0% | 1,524 | 3,314 | +117% | 0 | 0 | — |
case-16 | pass→pass | 8,409 | 5,390 | -36% | 1 | 1 | 0% | 1,479 | 3,207 | +117% | 0 | 0 | — |
case-17 | pass→pass | 5,500 | 3,424 | -38% | 1 | 1 | 0% | 907 | 2,562 | +182% | 0 | 0 | — |
case-18 | fail→fail | 5,101 | 3,651 | -28% | 1 | 1 | 0% | 786 | 2,664 | +239% | 0 | 0 | — |
case-19 | pass→pass | 16,446 | 19,301 | +17% | 1 | 1 | 0% | 2,669 | 5,503 | +106% | 0 | 0 | — |
case-20 | pass→pass | 12,434 | 11,889 | -4% | 1 | 1 | 0% | 2,354 | 4,423 | +88% | 0 | 0 | — |
case-21 | pass→pass | 16,649 | 18,569 | +12% | 1 | 1 | 0% | 2,790 | 5,218 | +87% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +5 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.