
Orchestration
- 61 installs
- 14 repo stars
- Updated March 2, 2026
- oakoss/agent-skills
Helps with ai & agent building tasks during AI-assisted development.
About
orchestration is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- orchestration
- AI & Agent Building
- AI-coding skill
Orchestration by the numbers
- 61 all-time installs (skills.sh)
- +3 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #6,381 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oakoss/agent-skills --skill orchestrationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 61 |
|---|---|
| repo stars | ★ 14 |
| Last updated | March 2, 2026 |
| Repository | oakoss/agent-skills ↗ |
What it does
Helps with ai & agent building tasks during AI-assisted development.
Files
Orchestration
Overview
Coordinates skills, frameworks, and workflows across the project lifecycle. Combines pattern-based project classification with goal decomposition, hierarchical task planning, and multi-agent coordination.
Use this skill for project-level workflow decisions: which frameworks to activate, in what order, and how to validate progress between phases. For Claude Code-specific agent implementation details (agent configuration, batch sizing, prompt engineering), use the agent-patterns skill instead.
This skill does NOT replace project management tools. It provides the decision framework for sequencing capabilities and validating readiness at each transition point.
Quick Reference
| Need | Action |
|---|---|
| Identify project type | Classify as Pattern A / B / C |
| Sequence frameworks | Follow pattern-specific phase order |
| Decompose a goal | Extract required effects, match capabilities |
| Validate readiness | Check phase-gate criteria before advancing |
| Find alternatives | Generate fallback capabilities per step |
| Score a plan | Evaluate cost, latency, risk, diversity |
| Coordinate agents | Select orchestration pattern for task type |
| Pass context | Use context distillation for subagents |
Pattern Identification
Classify every project before selecting frameworks or skills.
| Pattern | Characteristics | Timeline |
|---|---|---|
| A: Simple Feature | Existing system, well-understood, single-team | 1-5 days |
| B: New Product/System | From scratch, security/compliance matters | 4-12 weeks |
| C: AI-Native/Complex | AI agents, RAG, knowledge graphs, orchestration | 8-20 weeks |
Phase Gates
Do not advance without meeting gate criteria.
| Gate | Entry Criteria |
|---|---|
| Design (Phase 2) | PRP complete, problem validated, success metrics, user stories |
| Development (3) | Architecture documented, data model designed, security threats mapped |
| Testing (Phase 4) | Features complete, unit tests over 80%, code review, SAST clean |
| Deployment (5) | All tests passing, UAT completed, security tested, coverage over 90% |
Scoring Function
Plans are evaluated using weighted utility:
| Factor | Weight | Scores |
|---|---|---|
| Cost | 0.3 | free=1.0, low=0.8, medium=0.5, high=0.2 |
| Risk | 0.3 | safe=1.0, low=0.8, medium=0.5, high=0.2 |
| Latency | 0.2 | instant=1.0, fast=0.7, slow=0.3 |
| Diversity | 0.2 | min(unique_domains / 5, 1.0) |
Modifiers: recently used (within 3 steps) gets -30% penalty; novel capability gets +20% bonus.
Multi-Agent Orchestration Patterns
| Pattern | Use Case |
|---|---|
| Hierarchical | Parent delegates to specialized subagents |
| Sequential | Chain of experts (architect -> dev -> review) |
| Parallel | Independent tasks running simultaneously |
| Handoff | One agent passes context to the next |
Key rules: max delegation depth of 3, use context distillation (not full codebase), log all agent interactions.
MCP Integration
MCP (Model Context Protocol) standardizes how agents connect to external tools, data sources, and prompt templates. The orchestrator discovers available MCP servers at startup and routes tool calls from subagents to the correct server.
| MCP Primitive | Role in Orchestration |
|---|---|
| Resources | Discover available data (schemas, configs, docs) before work |
| Tools | Execute validated actions with typed arguments |
| Prompts | Reuse domain-specific instruction templates across agents |
| Sampling | Allow servers to request AI reasoning mid-execution |
Common Mistakes
| Mistake | Correct Pattern |
|---|---|
| Treating all projects as Pattern A (simple feature) | Classify first: Pattern A (simple), B (new product), C (AI-native) before selecting frameworks |
| Skipping phase gates to move faster | Enforce gate criteria before advancing; skipping causes compounding rework |
| Activating all available skills simultaneously | Limit to 1-3 skills per phase with clear deliverables and handoffs |
| No decision logging for capability choices | Log rationale, alternatives considered, scores, and rejection reasons at each step |
| Building HTN plans without validating preconditions | Check project state (files, dependencies, env vars) against each capability's requirements first |
| Delegating without a clear objective manifest | Every subagent needs an objective, constraints, max tokens, and available tools |
| Passing entire codebase to subagents | Use context distillation to pass only relevant symbols and facts |
Delegation
- Discover project pattern and classify scope: Use
Exploreagent to survey the codebase, dependencies, and requirements - Execute multi-phase orchestration plan: Use
Taskagent to implement phase-specific deliverables with gate validation - Design architecture and capability sequences: Use
Planagent to decompose goals and build scored HTN plans
References
- goal-decomposition.md -- HTN planning, goal analysis, capability matching, precondition validation, scoring, decision logging
- project-patterns.md -- Pattern A/B/C classification, phase sequences, skill coordination by phase, parallelization
- multi-agent-coordination.md -- Hierarchical, sequential, parallel orchestration patterns, delegation manifests, recursion limits
- mcp-orchestration.md -- MCP architecture, resources, tools, prompts, multi-server orchestration, bidirectional sampling
- context-distillation.md -- Symbol indexing, fact extraction, recursive context reduction, token management
- error-handling.md -- Objective drift, tool failure, context overflow, circuit breakers, recovery strategies, logging
Context Distillation
Passing the entire project context to every subagent is expensive and leads to "Lost in the Middle" syndrome where the agent ignores crucial information buried in a large context window.
The Problem
| Approach | Tokens | Quality | Cost |
|---|---|---|---|
| Full codebase | 100k+ | Low | High |
| Relevant files | 10-30k | Medium | Medium |
| Distilled facts | 1-5k | High | Low |
Distilled context produces better results because the agent focuses on exactly what matters.
Distillation Techniques
1. Symbol Indexing
Instead of passing file contents, pass a list of available functions, classes, and types. The subagent can then request specific file contents only when needed.
Available Symbols:
- auth/validateSession(token: string): Promise<Session | null>
- auth/createSession(userId: string): Promise<Session>
- types/Session { id, userId, expiresAt, createdAt }
- types/User { id, email, name, role }The subagent sees the shape of the system without reading every file.
2. Fact Extraction
Use a context distiller to extract only the facts relevant to the sub-task:
| Original Task | Distilled Context |
|---|---|
| "Fix the bug in the login flow" (100 files) | "Login uses auth-expert via src/lib/auth.ts. Error in validateSession. Relevant interfaces: Session, User." |
| "Add caching to API" (50 files) | "API uses ky client in src/api/client.ts. Response types in src/types/api.ts. Cache candidates: user list, product catalog." |
3. Summary Chain-of-Thought
Before delegating, the parent should write a concise summary:
What we know:
- Auth system uses JWT tokens stored in cookies
- Session validation happens in middleware
- The bug causes 401 errors after token refresh
What we need to find out:
- Why the refreshed token is not being saved
- Whether the cookie settings match between set and readRecursive Context Reduction
As delegation depth increases, the context must become narrower:
| Level | Agent | Context Scope |
|---|---|---|
| 0 | User | Full problem statement |
| 1 | Supervisor | Architectural plan + key files |
| 2 | Worker | Single function logic + local types |
| 3 | Executor | Specific tool parameters |
Each level strips away information not relevant to that level's task. The executor only needs to know about the specific function call, not the entire system architecture.
Best Practices
| Practice | Rationale |
|---|---|
| Pass symbols, not file contents | Reduces tokens while preserving structure |
| Extract facts relevant to task | Focuses agent attention on what matters |
| Write "what we know / need" summary | Prevents objective drift in delegation |
| Narrow context at each depth | Deeper agents need less context, not more |
| Allow subagents to request more | Let them pull specific files when needed |
| Never pass the entire codebase | Causes "Lost in the Middle" syndrome |
Error Handling in Multi-Agent Systems
Common Failure Modes
| Failure Mode | Description | Frequency |
|---|---|---|
| Objective Drift | Subagent forgets the original goal | High |
| Tool Failure | MCP server is offline or returns an error | Medium |
| Context Overflow | Subagent runs out of tokens | Medium |
| Infinite Loops | Agents delegating back and forth indefinitely | Low |
| Hallucination | Agent generates plausible but incorrect output | Medium |
| Silent Failure | Agent completes without error but wrong result | High |
Recovery Strategies
1. Reset and Re-prompt
If a subagent's output is nonsensical or fails validation, reset its context and re-issue the command with more specific constraints.
First attempt: "Implement the auth module"
Failed: Output was unrelated database code
Re-prompt: "Implement JWT authentication in src/lib/auth.ts.
Must export: validateSession(token: string): Promise<Session | null>
Must use: jsonwebtoken library
Must read: existing Session type from src/types/auth.ts"2. Circuit Breakers
If an agent fails a specific tool call repeatedly, trip the circuit breaker:
| Failure Count | Action |
|---|---|
| 1 | Retry with same parameters |
| 2 | Retry with modified parameters |
| 3 | Trip circuit breaker, escalate to parent |
After the circuit breaker trips, the parent agent must either:
- Try an alternative capability
- Escalate to the user
- Mark the step as blocked and continue with remaining steps
3. Graceful Degradation
If a complex capability fails, fall back to simpler alternatives:
Primary: AI-powered code analysis
Fallback: Static analysis tool
Last resort: Manual review flagThe system should always produce some useful output, even if degraded.
4. Objective Drift Prevention
| Technique | Implementation |
|---|---|
| Manifest of Objective | Every subagent receives explicit goal statement |
| Output validation | Parent checks output against expected deliverables |
| Periodic checkpoints | Long-running tasks report progress to parent |
| Context anchoring | Include goal statement at start and end of prompt |
Logging and Traceability
Every agent interaction must be logged for debugging.
Trace Log Schema
| Field | Type | Description |
|---|---|---|
| timestamp | string | ISO-8601 format |
| agentId | string | The subagent's identifier |
| parentId | string | The delegating agent's identifier |
| action | string | DELEGATE, TOOL_CALL, RESPONSE, ERROR |
| duration | number | Milliseconds |
| tokenCount | number | Tokens consumed |
| toolResults | object | Tool call inputs and outputs |
| errorInfo | object | Error type, message, stack (if failed) |
Debugging Multi-Agent Failures
1. Identify the failing agent -- Check trace logs for ERROR actions 2. Examine the delegation chain -- Follow parentId links back to the root 3. Check context quality -- Was the right information passed? 4. Verify tool availability -- Are MCP servers responding? 5. Review objective alignment -- Did the agent understand the task?
Anti-Patterns
| Anti-Pattern | Problem | Fix |
|---|---|---|
| No error handling at all | Silent failures cascade | Validate every subagent output |
| Infinite retries | Runaway token spend | Use circuit breakers (max 3) |
| Ignoring partial results | Throws away useful work | Gracefully degrade |
| No trace logging | Cannot debug multi-agent failures | Log every interaction |
| Retrying with same prompt | Gets same wrong result | Modify constraints on retry |
Goal Decomposition
For complex goals, decompose into executable capability sequences using Hierarchical Task Network (HTN) planning.
Process Overview
1. Analyze goal -- Extract required and optional effects 2. Find candidates -- Query capability graph for capabilities producing desired effects 3. Validate preconditions -- Check project state against each capability's requirements 4. Build HTN plan -- Order capabilities by dependencies, identify parallel steps, list alternatives 5. Score and rank -- Evaluate using weighted utility function 6. Log decisions -- Capture rationale, alternatives considered, rejection reasons
Step 1: Goal Analysis
Break the goal into discrete effects:
Goal: "Build RAG system for documentation search"
Required Effects:
- enables_embedding_generation
- creates_vector_index
- configures_retrieval_pipeline
Optional Effects:
- adds_caching_layer
- implements_reranking
Domains: [rag, api, database]Effects are specific, measurable outcomes. Examples:
creates_vector_indexadds_auth_middlewareconfigures_databaseimplements_api_endpointadds_tests
Step 2: Find Candidate Capabilities
For each required effect, find capabilities that produce it:
Effect: creates_vector_index
Candidates:
- pinecone-integration (managed, low latency)
- weaviate-setup (self-hosted, more control)
- qdrant-setup (open source, local dev)Step 3: Validate Preconditions
Check if current project state satisfies each capability's requirements:
| Check Type | Example | Resolution if Missing |
|---|---|---|
| File exists | package.json present | Initialize project |
| Dependency | @tanstack/react-query installed | Run install command |
| Environment var | DATABASE_URL set | Add to .env |
| Configuration | TypeScript config present | Run init command |
Capabilities with unsatisfied required preconditions are marked as blocked. Either resolve the precondition or use an alternative capability.
Step 4: Build HTN Plan
Order capabilities by dependencies and identify parallelism:
Plan for "Build RAG system":
Step 1: openai-integration (enables embeddings) [no deps]
Step 2: pinecone-setup (creates vector index) [no deps]
Step 3: rag-implementer (retrieval pipeline) [depends on 1, 2]
Parallel steps: [[1, 2]] -- Steps 1 and 2 can run simultaneouslyEach step includes:
- Capability name and effect
- Whether it is required or optional
- Blocked status
- Alternative capabilities
- Dependencies on other steps
- Reasoning for selection
Step 5: Score and Rank
Evaluate plans using the weighted utility function:
utility = cost_score * 0.3 + risk_score * 0.3 + latency_score * 0.2 + diversity_score * 0.2Score mappings:
| Factor | Values and Scores |
|---|---|
| Cost | free=1.0, low=0.8, medium=0.5, high=0.2 |
| Latency | instant=1.0, fast=0.7, slow=0.3 |
| Risk | safe=1.0, low=0.8, medium=0.5, high=0.2, critical=0.0 |
| Diversity | min(unique_domains / 5, 1.0) |
Modifiers:
- Cooldown penalty: Capability used within 3 steps gets -30%
- Novelty bonus: Capability not yet in plan gets +20%
Step 6: Decision Logging
Every plan must include a decision log:
Decision Log:
Goal: "Build RAG system"
Selected: pinecone-integration (score: 0.78)
Alternatives considered:
- weaviate-setup (score: 0.72, rejected: higher operational cost)
- qdrant-setup (score: 0.65, rejected: requires self-hosting)
Precondition checks: all passed
Reasoning: Managed service reduces operational overheadLog fields: goal, timestamp, selected capabilities, alternatives with scores and rejection reasons, precondition results, overall reasoning.
MCP Orchestration
MCP (Model Context Protocol) provides a standardized way for agents to connect to servers that host tools, resources, and prompts.
MCP Architecture
Resources
Readable data sources like files, database schemas, or API documentation. Subagents should use list_resources to discover what is available before reading specific resources.
Examples:
- File system contents
- Database schemas
- API documentation
- Configuration files
- Environment information
Tools
Executable functions with JSON-Schema validated arguments. MCP standardizes argument typing and validation.
Examples:
- Database queries
- File operations
- API calls
- Code analysis
- Build commands
Prompts
Servers can provide prompt templates that guide agents on how to use specific tools effectively. These encode domain expertise into reusable instructions.
Multi-Server Orchestration
An orchestrator often connects to multiple MCP servers simultaneously.
Unified Toolset Pattern
The parent agent acts as a gateway, exposing a unified set of tools to subagents. The parent routes tool calls to the correct MCP server.
Parent Agent (Gateway)
├── MCP Server: PostgreSQL (database tools)
├── MCP Server: GitHub (repository tools)
├── MCP Server: Filesystem (file tools)
└── Subagent (sees unified toolset)Server Selection
| Server Type | Use Case | Tools Provided |
|---|---|---|
| Database | Schema queries, data operations | query, insert, update, migrate |
| Repository | Code management, PR operations | read_file, create_pr, search |
| Filesystem | Local file operations | read, write, list, search |
| API | External service integration | request, webhook, authenticate |
Configuration
MCP servers are configured per project. The orchestrator discovers available servers and their capabilities at startup.
Key configuration:
- Server endpoints and authentication
- Available tools per server
- Resource access patterns
- Rate limits and quotas
Bidirectional Communication (Sampling)
MCP servers can request the agent to generate text as part of tool execution. This enables complex workflows where tool execution requires AI reasoning mid-stream.
Protocol Flow
1. Agent calls Tool A on Server X 2. Tool A starts executing 3. Tool A sends a sampling/createMessage request back to the Agent 4. Agent generates a response 5. Tool A receives the response and finishes execution
Use Cases
- Code analysis tool asks agent to explain a pattern
- Database tool asks agent to generate a migration
- Review tool asks agent to summarize findings
Best Practices
| Practice | Rationale |
|---|---|
| Use MCP servers for all tool access | Standardized, typed, validated interfaces |
| Never build custom tool adapters | MCP handles protocol, auth, and validation |
| Discover resources before reading | Avoid assumptions about available data |
| Configure per-project servers | Different projects need different tools |
| Set appropriate rate limits | Prevent runaway tool calls |
Multi-Agent Coordination
Orchestration Patterns
Hierarchical Orchestration
Parent agent delegates to specialized subagents. The parent validates output and handles errors.
Supervisor
├── architect-agent (produces design doc)
├── developer-agent (implements features)
└── reviewer-agent (validates code quality)Use when: complex tasks requiring multiple specialized capabilities.
Sequential Pipeline (Chain of Experts)
One agent passes output to the next in a defined sequence.
architect -> developer -> reviewer -> deployerUse when: tasks have clear phases where each depends on the previous output.
Parallel Execution
Independent tasks run simultaneously, results aggregated by parent.
Supervisor
├── frontend-agent (parallel)
├── backend-agent (parallel)
└── [aggregate results]Use when: tasks are independent and can run concurrently.
Handoff Pattern
One agent passes full context to another when its expertise is exhausted.
generalist-agent -> specialist-agent (with full context transfer)Use when: task requires expertise transition (e.g., architecture to implementation).
Delegation Manifests
Every subagent must receive a clear objective manifest:
interface DelegationManifest {
objective: string;
constraints: string[];
maxTokens: number;
availableTools: string[];
planId: string;
currentStepIndex: number;
}Key rules:
- Never delegate with vague objectives ("fix this")
- Include specific constraints and success criteria
- List available tools explicitly
- Reference the current plan step
Recursion Limits
To prevent "Inception Loops" and excessive token spend:
- Maximum delegation depth: 3 levels
- Each subagent must report its
recursionDepthin metadata - If depth limit is reached, task must be completed at current level or escalated to user
Level 0: User request
Level 1: Supervisor agent
Level 2: Specialist agent
Level 3: Executor agent (max depth, no further delegation)A2A Communication (Peer-to-Peer)
Unlike hierarchical delegation, Agent-to-Agent (A2A) focuses on peer collaboration.
Request-Response Pattern
{
"type": "A2A_REQUEST",
"from": "frontend-dev",
"to": "backend-architect",
"payload": {
"action": "QUERY_SCHEMA",
"params": { "table": "users" }
}
}Negotiation Protocol
When agents have conflicting plans:
1. Proposal: Agent A proposes a change 2. Critique: Agent B provides feedback with constraints 3. Synthesis: Parent or third agent resolves based on project priorities
Shared Working Memory (Blackboard)
Agents post findings to a shared state to avoid redundant work:
- Discovered symbols and types
- Architectural decisions
- Blockers and dependencies
- Completed sub-tasks
Anti-Patterns
| Anti-Pattern | Consequence | Fix |
|---|---|---|
| Delegating without clear objective | Subagent wastes tokens on wrong task | Use delegation manifests |
| Unsupervised agent-to-agent calls | Uncontrolled recursive delegation | Require parent supervision |
| Passing entire codebase | Token bloat, "lost in the middle" | Use context distillation |
| Ignoring subagent logs | Silent failures hard to debug | Log all interactions |
| Generic agents for specialized tasks | Poor quality output | Select most appropriate skill |
| No recursion depth tracking | Inception loops, runaway token spend | Enforce max depth of 3 |
Project Patterns
Classify every project before selecting frameworks or skills.
Pattern A: Simple Feature/Enhancement
- Adding to existing system, well-understood requirements
- Low risk, single-team, 1-5 days
- Examples: search filter, dashboard widget, form field, styling update
Sequence: feature framework -> code quality -> testing -> deployment
Pattern B: New Product/System
- Building from scratch or major module, user validation needed
- Security/compliance important, multiple considerations, 4-12 weeks
- Examples: SaaS product, customer portal, internal tool, API platform
Phases:
1. Discovery -- Validation frameworks, product-market fit analysis, user research 2. Architecture and Design -- System design, prototyping, UX design, security architecture, API design 3. Development -- Full-stack development, frontend/backend build, API implementation, quality assurance 4. Testing -- Test validation, QA, usability testing, security review 5. Deployment -- DevOps setup, deployment, go-to-market planning
Pattern C: AI-Native/Complex System
All Pattern B phases, plus:
- Phase 2b (AI Architecture) -- Multi-agent architecture, RAG implementation, knowledge graph design, agentic workflow orchestration
- Phase 3b (AI Development) -- Context engineering, multi-agent orchestration implementation
- Phase 4b (AI Testing) -- Agent behavior tests, RAG retrieval quality, LLM benchmarks
Characteristics: AI agents, RAG, knowledge graphs, complex orchestration, 8-20 weeks.
Phase Gates
Do not advance without meeting gate criteria.
| Gate | Entry Criteria |
|---|---|
| Design (Phase 2) | PRP complete, problem validated, success metrics defined, user stories documented |
| Development (3) | Architecture documented, data model designed, security threats identified, mitigations planned |
| Testing (Phase 4) | Features complete, unit tests over 80%, code review passed, SAST scans clean |
| Deployment (5) | All tests passing, UAT completed, security testing done, coverage over 90% |
Skill Coordination by Phase
Limit to 1-3 skills per phase. Each skill has a specific deliverable and clear handoff.
| Phase | Skills |
|---|---|
| Discovery | user-researcher, product-strategist, product-analyst |
| Design | ux-designer, design-system-architect, security-architect |
| Development | frontend-builder, api-designer, mvp-builder, multi-agent-architect |
| Testing | quality-assurance, usability-tester, security-architect |
| Deployment | deployment-advisor, go-to-market-planner, performance-optimizer |
| Post-Launch | product-analyst, customer-feedback-analyzer, performance-optimizer |
Parallelization Opportunities
- UX design + Architecture design (Phase 2)
- Frontend + Backend development (Phase 3)
- Test writing + Feature development (Phase 3)
- Independent capability steps with no shared dependencies (HTN parallel steps)
Troubleshooting
Wrong pattern identified mid-project: Adapt orchestration. Pattern A to B: add discovery and design phases. Pattern B to C: add AI architecture and testing. Scope reduction: simplify orchestration.
Phase gate not met: Do not skip. Identify specific unmet criteria, address them, then re-validate. Partial advancement leads to compounding rework.
Deliverables
When orchestrating, produce:
1. Pattern classification with rationale and timeline estimate 2. Orchestration plan with phase breakdown, framework sequence, skill activation points, and gate criteria 3. Phase status showing current position, completion percentage, gate readiness, and next steps 4. Decision log capturing selected capabilities, alternatives considered, scores, and reasoning