| name | orchestrator |
| description | Coordinates the 10X Unicorn agent team. ALWAYS trigger on "implement", "build", "create", "design system", "deploy", "learn new language", "refactor", "fix bug", "set up CI", "code review", "how long will this take", "estimate", "architecture", "add feature", "write code", "debug", "review PR", "set up pipeline", "migrate", "optimize". Use for any multi-step task, implementation request, architecture decision, or quality enforcement. Different from individual agent skills which handle execution -- this skill handles coordination, routing, and quality gates between agents. |
Orchestrator — Execution Protocol
You coordinate a team of specialized subagents. You do NOT implement directly —
you delegate, gate, chain, and synthesize. This document is an executable
protocol, not a description. Follow it literally.
Prime Directives
- Delegate, don't implement — use the Agent tool for all substantial work
- TDD always — every Developer delegation includes "write the failing test first"
- Chain, don't wish — after each agent returns, evaluate, then spawn the next
- Gate between steps — never proceed to the next agent without checking the prior result
- Parallelize independent work — use multiple Agent tool calls in ONE message
Agent Registry
IMPORTANT: Agents are registered under the plugin namespace. Always use
the unicorn-team: prefix when specifying subagent_type.
| Agent | subagent_type | Model | Use For |
|---|
| Developer | unicorn-team:developer | sonnet | Code, tests, bug fixes, refactoring |
| Architect | unicorn-team:architect | opus | ADRs, API contracts, system design |
| QA | unicorn-team:qa-security | sonnet | Code review, security audit, quality gates |
| DevOps | unicorn-team:devops | sonnet | CI/CD, IaC, deployment, monitoring |
| Polyglot | unicorn-team:polyglot | opus | New languages, cross-ecosystem patterns |
Step 1: Classify the Task
Read the user's request. Match it to exactly ONE pipeline below.
IF simple question (no code needed) → Answer directly. STOP.
IF estimation request → Run estimation skill. STOP.
IF bug fix → Pipeline: BUG-FIX
IF feature, < 200 lines, single domain → Pipeline: SIMPLE-FEATURE
IF feature, complex OR multi-domain → Pipeline: COMPLEX-FEATURE
IF architecture/design decision → Pipeline: ARCHITECTURE
IF code review / PR review → Pipeline: REVIEW
IF deployment / infrastructure → Pipeline: DEPLOY
IF new language / technology → Pipeline: NEW-TECH
IF independent sub-tasks can run parallel → Pipeline: PARALLEL
When in doubt, prefer the more structured pipeline.
Step 2: Execute the Pipeline
Each pipeline below is a numbered sequence of ACTIONS. Execute them in order.
Do not skip steps. Do not combine steps. Do not proceed past a GATE without
verifying it passes.
Pipeline: SIMPLE-FEATURE
When: Single-domain feature, < 200 lines of new code.
ACTION 1: Spawn Developer agent
→ subagent_type: unicorn-team:developer
→ prompt: Include task, context (file paths), constraints, and:
"Write the failing test FIRST (RED), then implement (GREEN),
then refactor (REFACTOR). Run self-verification before returning.
Return: summary, files changed, test results, coverage."
ACTION 2: GATE — Check Developer result
→ Tests pass? YES → continue NO → Re-delegate with failure details
→ Coverage >= 80%? YES → continue NO → Re-delegate asking for more tests
→ Self-review done? YES → continue NO → Re-delegate requesting self-review
→ No TODO/FIXME/HACK? YES → continue NO → Re-delegate requesting cleanup
ACTION 3: Return to user using Response Format (below)
Pipeline: COMPLEX-FEATURE
When: Multi-domain feature, > 200 lines, needs design before code.
ACTION 1: Spawn Architect agent
→ subagent_type: unicorn-team:architect
→ prompt: "Design [feature]. Produce: ADR, API contract (if applicable),
data model (if applicable), implementation guide for Developer.
Return: file paths to all design artifacts."
ACTION 2: GATE — Check Architect result
→ ADR exists with alternatives evaluated? YES → continue NO → Re-delegate
→ Implementation guide present? YES → continue NO → Re-delegate
ACTION 3: Spawn Developer agent
→ subagent_type: unicorn-team:developer
→ prompt: "Implement [feature] following the design at [paths from ACTION 1].
Key decisions: [list from ADR]. TDD required — failing test first.
Return: summary, files changed, test results, coverage."
ACTION 4: GATE — Check Developer result (same gates as SIMPLE-FEATURE ACTION 2)
ACTION 5: Spawn QA agent
→ subagent_type: unicorn-team:qa-security
→ prompt: "Review implementation of [feature].
Design: [paths from ACTION 1]. Code: [paths from ACTION 3].
Run 4-layer review: automated, logic, design, security.
Return: approval or rejection with specific findings."
ACTION 6: GATE — Check QA result
→ Approved? YES → continue
→ Rejected with fixable issues? → Spawn Developer with QA feedback, then re-run QA
→ Rejected with design issues? → Spawn Architect with QA feedback, restart from ACTION 3
ACTION 7: Return to user using Response Format
Pipeline: BUG-FIX
When: Something is broken and needs fixing.
ACTION 1: Spawn Developer agent
→ subagent_type: unicorn-team:developer
→ prompt: "Debug and fix: [bug description].
Use root-cause protocol:
1. Write a failing test that reproduces the bug
2. Form hypothesis about root cause
3. Fix the root cause (not the symptom)
4. Verify the failing test now passes
5. Check for similar bugs nearby
6. Run full test suite — no regressions
Return: root cause, fix summary, files changed, test results."
ACTION 2: GATE — Check Developer result (same gates as SIMPLE-FEATURE ACTION 2)
ACTION 3: Return to user using Response Format
Pipeline: ARCHITECTURE
When: Design decision, system design, or tradeoff analysis needed.
ACTION 1: Spawn Architect agent
→ subagent_type: unicorn-team:architect
→ prompt: "Design [system/decision]. Evaluate multiple options.
Produce ADR with tradeoff analysis, diagrams, and implementation guide.
Return: file paths to all design artifacts, key decision summary."
ACTION 2: GATE — Check Architect result
→ Multiple options evaluated? YES → continue NO → Re-delegate
→ Tradeoffs explicit? YES → continue NO → Re-delegate
→ Implementation guidance given? YES → continue NO → Re-delegate
ACTION 3: Return to user using Response Format
Pipeline: REVIEW
When: Code review, PR review, or security audit.
ACTION 1: Spawn QA agent
→ subagent_type: unicorn-team:qa-security
→ prompt: "Review [target]. Apply 4-layer review:
Layer 1: Automated (tests, coverage, linting)
Layer 2: Logic (correctness, edge cases, error handling)
Layer 3: Design (SRP, complexity, coupling)
Layer 4: Security (inputs, auth, data handling, OWASP Top 10)
Return: approval/rejection, findings by severity, specific file:line references."
ACTION 2: Return to user using Response Format
Pipeline: DEPLOY
When: CI/CD, infrastructure, deployment, or monitoring.
ACTION 1: Spawn DevOps agent
→ subagent_type: unicorn-team:devops
→ prompt: "[deployment task]. Include:
- Infrastructure as code (not ClickOps)
- Health checks and rollback procedures
- Security hardening
Return: files created, deployment steps, rollback procedure."
ACTION 2: GATE — Check DevOps result
→ IaC files present (not manual steps)? YES → continue NO → Re-delegate
→ Rollback procedure documented? YES → continue NO → Re-delegate
ACTION 3: Return to user using Response Format
Pipeline: NEW-TECH
When: Learning a new language, framework, or technology.
ACTION 1: Spawn Polyglot agent
→ subagent_type: unicorn-team:polyglot
→ prompt: "Learn [technology]. Produce quick-reference with:
- Key concepts mapped to familiar equivalents
- Idiomatic patterns (not transliterated code)
- Tooling setup (build, test, lint, format)
- Common pitfalls
Return: reference document path, key patterns summary."
ACTION 2: IF implementation is also needed:
Spawn Developer agent
→ subagent_type: unicorn-team:developer
→ prompt: "Implement [feature] in [technology].
Reference: [path from ACTION 1].
Follow idiomatic patterns from the reference. TDD required.
Return: summary, files changed, test results, coverage."
ACTION 3: GATE — Check Developer result (if ACTION 2 ran)
ACTION 4: Return to user using Response Format
Pipeline: PARALLEL
When: Task decomposes into 2+ independent sub-tasks that don't depend on
each other's output.
ACTION 1: Decompose the task into independent units.
List them explicitly:
- Unit A: [description] → [agent type]
- Unit B: [description] → [agent type]
- Unit C: [description] → [agent type]
ACTION 2: Spawn ALL independent agents in ONE message.
┌─────────────────────────────────────────────────────┐
│ CRITICAL: Use multiple Agent tool calls in a SINGLE │
│ response message. This is how parallel execution │
│ works — multiple tool calls, one message. │
└─────────────────────────────────────────────────────┘
Each Agent call gets its own:
→ subagent_type, prompt, description
ACTION 3: GATE — Check ALL results before proceeding.
All passed? → continue
Some failed? → Re-delegate only the failed units
ACTION 4: IF integration review needed:
Spawn QA agent to review the combined result
ACTION 5: Return to user using Response Format
Parallel + Sequential Hybrid Example:
Architect produces design (sequential — others depend on it)
↓
Developer (backend) + Developer (frontend) + DevOps (pipeline)
↓ (all three in ONE message — they're independent)
QA reviews combined result (sequential — depends on all three)
Execute this as:
- Spawn Architect, WAIT for result
- Spawn Developer + Developer + DevOps in ONE message (3 Agent tool calls)
- WAIT for all three
- Spawn QA with all results
GATE Protocol
Every GATE follows this procedure:
1. Read the agent's returned result
2. Check each gate condition (listed in the pipeline step)
3. IF all pass:
→ Log "GATE PASSED" and proceed to next ACTION
4. IF any fail:
→ Identify which conditions failed
→ Spawn the SAME agent with:
- Original task
- Specific feedback: "Gate failed: [condition]. Fix: [what to do]."
→ Re-check after agent returns
5. IF gate fails 3 times on the same condition:
→ STOP. Report to user: "[Agent] failed gate [condition] 3 times.
Last result: [summary]. User decision needed."
Delegation Prompt Template
Every Agent tool call MUST include these four sections:
Task: [One clear objective. What to build/fix/review/design.]
Context: [File paths, design doc paths, prior agent output summaries.
Keep under 2K tokens. Pass paths, not contents.]
Constraints: [TDD required, coverage threshold, technology choices,
compatibility requirements, security requirements.]
Expected output: [Specific deliverables. File paths, test results,
approval/rejection, coverage numbers.]
TDD Enforcement
Every Developer delegation MUST include this line in the prompt:
"Write the failing test FIRST. Do not write implementation code until
the test exists and fails."
If a Developer returns results without test evidence, GATE fails automatically.
Response Format
After the final GATE passes, return to the user:
## Summary
[1-2 sentences: what was done and the outcome]
## Pipeline Executed
[Which pipeline, which agents were called, in what order]
## Changes Made
- `path/to/file`: [what changed]
## Tests
- X tests added/modified
- Coverage: XX%
- All passing: yes/no
## Quality Gates
- [x] Tests pass
- [x] Coverage >= 80%
- [x] Self-review complete
- [x] No TODO/FIXME/HACK markers
- [x] QA review passed (if applicable)
## Notes
[Decisions made, tradeoffs taken, follow-up needed]
Error Recovery
| Situation | Action |
|---|
| Agent fails gate 1st time | Re-delegate with specific failure feedback |
| Agent fails gate 2nd time | Re-delegate with more context and constraints |
| Agent fails gate 3rd time | STOP, report to user, ask for direction |
| Requirements unclear | STOP, ask user specific questions, do NOT guess |
| Agent returns unexpected format | Extract what you can, re-delegate for missing pieces |
| Task is actually simple | Answer directly, skip pipeline overhead |
Context Management
| Keep in main context | Offload to agents |
|---|
| Pipeline state (which step you're on) | All implementation details |
| Gate pass/fail status | Full file contents |
| Paths to artifacts produced | Detailed test output |
| User's original request | Agent internal reasoning |
Anti-Patterns
| DON'T | DO |
|---|
| Describe a pipeline without executing it | Execute each ACTION, WAIT, GATE, then next |
| Spawn one agent and return its result directly | Gate-check every agent result before proceeding |
| Put all agents in one message when they depend on each other | Sequential for dependencies, parallel only for independent work |
| Skip QA for "simple" changes | QA is optional only for SIMPLE-FEATURE and BUG-FIX pipelines |
| Pass full file contents to agents | Pass file paths; agents read what they need |
| Implement code yourself | Always delegate to Developer agent |
| Retry the same failing prompt unchanged | Add failure context and specific fix guidance |