Overview
The Orchestration Workflow is a design pattern that coordinates multiple Claude Code components to handle complex, multi-step tasks. It demonstrates how Commands, Agents, and Skills work together in a hierarchical workflow. Pattern: Command → Agent (with skill) → SkillThis pattern is ideal for workflows that require user interaction, data fetching, and output generation as separate concerns.
Architecture
The orchestration workflow separates concerns across three component types:Command
Entry point that handles user interaction and orchestrates the workflow
Agent
Data fetcher that uses preloaded skills as domain knowledge
Skill
Output creator that generates visual or formatted results
Flow Diagram
When to Use
Use the orchestration workflow when you need:Multi-Step Processes
Multi-Step Processes
Breaking complex tasks into discrete phases (gather input → fetch data → generate output)
User Interaction
User Interaction
Asking users for preferences or decisions before proceeding
Specialized Agents
Specialized Agents
Leveraging agents with domain-specific knowledge (preloaded skills)
Reusable Components
Reusable Components
Creating modular, reusable components that can be mixed and matched
Real Example: Weather System
The weather system demonstrates orchestration with a command that coordinates an agent and skill to fetch and display weather data.Component Details
Command: weather-orchestrator
Location:
.claude/commands/weather-orchestrator.mdPurpose: Entry point that orchestrates the workflowResponsibilities:- Ask user for temperature unit (Celsius/Fahrenheit)
- Invoke weather-agent via Task tool
- Invoke weather-svg-creator via Skill tool
- Display results to user
Agent: weather-agent
Location:
.claude/agents/weather-agent.mdPurpose: Fetch weather data using preloaded skillPreloaded Skill: weather-fetcher (agent skill pattern)Process:- Follows weather-fetcher skill instructions
- Fetches temperature from Open-Meteo API
- Returns temperature value and unit to command
Skill: weather-fetcher (Preloaded)
Location: The skill provides step-by-step instructions:
.claude/skills/weather-fetcher/SKILL.mdPurpose: Instructions for fetching temperature dataPattern: Agent Skill (preloaded, not invoked directly)Data Source: Open-Meteo API for Dubai, UAE- Choose API URL based on unit (Celsius/Fahrenheit)
- Fetch data via WebFetch tool
- Extract temperature from JSON response
- Return value and unit
Skill: weather-svg-creator (Independent)
Location:
.claude/skills/weather-svg-creator/SKILL.mdPurpose: Create visual SVG weather cardPattern: Skill (invoked via Skill tool)Outputs:orchestration-workflow/weather.svg- SVG weather cardorchestration-workflow/output.md- Weather summary
Execution Flow
Code Snippets
- Command
- Agent
- Skill (Preloaded)
- Skill (Independent)
.claude/commands/weather-orchestrator.md
Key Design Principles
Two Skill Patterns
- Agent Skills: Preloaded via
skills:field (domain knowledge) - Skills: Invoked via Skill tool (independent execution)
Command as Orchestrator
Command handles user interaction and coordinates workflow - doesn’t implement business logic
Agent for Data
Agent uses preloaded skill to fetch data, then returns it to command
Skill for Output
Independent skill receives data from context and creates visual/formatted outputs
Clean Separation of Concerns
| Component | Responsibility | Data Flow |
|---|---|---|
| Command | User interaction, orchestration | Receives user input → coordinates agents/skills → displays results |
| Agent | Domain knowledge, data fetching | Receives request → executes skill instructions → returns data |
| Skill | Output generation | Receives data from context → creates files → reports completion |
Implementation Guide
Design Your Workflow
Identify the stages:
- What user input is needed?
- What data needs to be fetched?
- What output needs to be generated?
Create Command
Create
.claude/commands/your-command.md:- Handle user interaction with AskUserQuestion
- Orchestrate agents with Task tool
- Invoke skills with Skill tool
- Use fast model (haiku) for orchestration
Create Agent with Preloaded Skill
Create
.claude/agents/your-agent.md:- Define agent with
skills:field - List required tools
- Choose appropriate model for task
.claude/skills/your-skill/SKILL.md:- Set
user-invocable: false(background knowledge) - Provide detailed instructions for agent
Create Output Skill
Create
.claude/skills/output-creator/SKILL.md:- Define what data it expects from context
- Specify output files to create
- Keep focused on single output responsibility
Advanced Patterns
Multiple Agents
Orchestrate multiple specialized agents:Conditional Workflows
Branch based on user input or data:Error Handling
Handle failures gracefully:Best Practices
Do use commands for orchestration - they’re lightweight and user-facing
Do preload skills into agents when they need domain-specific knowledge
Do keep skills focused on single responsibilities
Do use appropriate models: haiku for commands, sonnet for agents
Don’t put business logic in commands - delegate to agents/skills
Don’t invoke agents directly via bash - always use Task tool
Don’t create circular dependencies between components
Troubleshooting
Agent not using preloaded skill
Agent not using preloaded skill
Problem: Agent doesn’t follow skill instructionsSolution:
- Verify skill is listed in agent’s
skills:field - Check skill file is at
.claude/skills/skill-name/SKILL.md - Ensure agent prompt references the skill
Skill not found when invoked
Skill not found when invoked
Problem: Skill tool can’t find the skillSolution:
- Check skill directory structure:
.claude/skills/skill-name/SKILL.md - Verify
name:in frontmatter matches invocation - Ensure SKILL.md file exists (case-sensitive)
Data not passing between components
Data not passing between components
Problem: Skill doesn’t receive data from agentSolution:
- Agent must return data to command explicitly
- Command must invoke skill AFTER receiving agent response
- Skill receives data from current conversation context
Related Patterns
RPI Workflow
Research → Plan → Implement pattern for feature development
Agent Teams
Multiple agents working in parallel on shared tasks
Git Worktrees
Isolated development environments for parallel work
Resources
Commands Guide
Learn more about creating commands
Agents Guide
Deep dive into agent configuration
Skills Guide
Master skills and progressive disclosure
Example Code
Full working example on GitHub
