orchestrator
主要代理的多阶段工作流编排模式。支持结构化规划、委托给子代理、并行执行和结果聚合。
📖 中文导读:主要代理的多阶段工作流编排模式。支持结构化规划、委托给子代理、并行执行和结果聚合。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: orchestrator description: Multi-phase workflow orchestration pattern for main agents. Enables structured planning, delegation to sub-agents, parallel execution, and result aggregation.
Orchestrator Skill
You are operating with orchestration capabilities. Follow this 4-phase workflow pattern to break down complex tasks and delegate to specialized sub-agents.
Phase 1: Planning
Before starting any work, analyze the task and create a structured plan:
1. **Understand the Task**: Read and comprehend the full scope of what's being requested 2. **Identify Work Items**: Break the task into discrete, actionable items 3. **Assess Dependencies**: Determine which items depend on others 4. **Map to Sub-Agents**: For each work item, identify which sub-agent is best suited 5. **Identify Parallelization**: Mark items that can run concurrently (no dependencies between them) Output your plan as structured XML:<orchestration_plan>
<task_summary>Brief description of the overall task</task_summary>
<work_items>
<item id="1" parallel_group="A">
<description>What needs to be done</description>
<sub_agent>sub-agent-name</sub_agent>
<dependencies>none</dependencies>
<inputs>What this sub-agent needs</inputs>
<expected_output>What this sub-agent will produce</expected_output>
</item>
<item id="2" parallel_group="A">
<description>Another independent task</description>
<sub_agent>another-sub-agent</sub_agent>
<dependencies>none</dependencies>
<inputs>...</inputs>
<expected_output>...</expected_output>
</item>
<item id="3" parallel_group="B">
<description>Task that depends on items 1 and 2</description>
<sub_agent>yet-another-sub-agent</sub_agent>
<dependencies>1, 2</dependencies>
<inputs>Outputs from items 1 and 2</inputs>
<expected_output>...</expected_output>
</item>
</work_items>
<execution_order>
<parallel_group name="A" items="1, 2"/>
<parallel_group name="B" items="3" after="A"/>
</execution_order>
</orchestration_plan>
Phase 2: Delegation
Execute your plan by invoking sub-agents:
1. **Parallel Execution**: Invoke all sub-agents in the same parallel_group simultaneously using multiple Task tool calls in a single message 2. **Sequential Groups**: Wait for a parallel group to complete before starting the next group 3. **Context Passing**: Pass relevant outputs from completed items as inputs to dependent items 4. **Clear Instructions**: Give each sub-agent specific, actionable instructions based on the work item When invoking sub-agents, use this pattern:Task(subagent_type="sub-agent-name", prompt="
<task>
[Specific task description from work item]
</task>
<context>
[Any relevant context or outputs from previous items]
</context>
<expected_deliverables>
[What this sub-agent should produce]
</expected_deliverables>
")
Phase 3: Execution Monitoring
As sub-agents complete their work:
1. **Collect Results**: Gather outputs from each sub-agent 2. **Validate Completeness**: Ensure each sub-agent delivered expected outputs 3. **Handle Failures**: If a sub-agent fails, assess whether to retry, use fallback, or escalate 4. **Track Progress**: Update your plan status as items completePhase 4: Aggregation
After all sub-agents complete, synthesize results:
1. **Combine Outputs**: Merge artifacts and deliverables from all sub-agents 2. **Resolve Conflicts**: If sub-agents produced conflicting outputs, reconcile them 3. **Quality Check**: Review combined output for consistency and completeness 4. **Summarize**: Provide a cohesive summary of what was accomplished 5. **Identify Gaps**: Note any remaining work or follow-up items ```xmlParallelization Guidelines
**CAN run in parallel:** - Independent analysis tasks (e.g., requirements + risk assessment) - Non-overlapping file generation (e.g., frontend components + backend models) - Multiple test generators targeting different layersMUST run sequentially:
- Tasks where output feeds into another task's input
- File modifications to the same files
- Tasks with explicit dependencies
Error Handling
If a sub-agent fails or produces incomplete results:- Assess Impact: Determine if dependent items can proceed
- Retry Option: Consider retrying with clarified instructions
- Fallback: If sub-agent unavailable, attempt the work directly
- Escalate: If critical failure, report to user with details