Subagent Delegation Patterns
- Leverage native parallel subagent dispatch and 200k+ context windows where available.
Activation Conditions
Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.
Activate this skill when:
- Creating repetitive code structures or boilerplate
- Performing data transformation tasks
- Analyzing codebase for patterns or information
- Generating documentation from existing code
- Creating simple utility functions
- Breaking down complex features into manageable subtasks
Core Delegation Patterns
See Delegation Patterns for detailed examples of:
- Boilerplate generation (API routes, CRUD operations, component structures)
- Data transformations between formats
- File analysis and pattern extraction
- Documentation generation from code
- Utility function creation
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
workflow in project instructions when folder discovery is unavailable.
- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/subagent-delegation and restart Codex after major changes.
MCP Availability And Fallback
Preferred MCP Server: None required
- Fallback prompt: "Use the Subagent Delegation Patterns skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
- Do not claim an MCP operation was used when the active host does not expose it.
- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
Anti-Patterns
- Delegating or evaluating without a scoped success condition: The output becomes hard to review and easy to overbuild.
- Skipping the evidence step: A workflow that cannot be re-checked quickly is not ready for handoff.
- Bundling unrelated subtasks together: It creates noisy prompts, weaker ownership, and avoidable integration risk.
Verification Protocol
Before claiming "skill applied successfully":
- Pass/fail: The Subagent Delegation workflow names the agent boundary, delegated scope, and expected return artifact.
- Pass/fail: Context passed to helpers is minimal, task-local, and free of hidden expected answers.
- Pass/fail: Results are integrated only after evidence, diffs, or citations are checked by the controller.
- Pressure-test scenario: Run the workflow on two similar tasks that must not share assumptions or leaked context.
- Success metric: Zero context leakage; every delegated output is independently reviewable.
Examples & Scripts
Self-Verification Phase-Gate Questions
Before you mark delegated work complete, the coordinating agent must ask:
- Did the subagent receive a scoped task, owned files or responsibilities, and a clear definition of done?
- Did I review the returned output for correctness, integration fit, and missing edge cases instead of forwarding it blindly?
- Did I preserve the evidence trail showing what was delegated, what changed, and what still needs local ownership?
- Are any follow-up fixes, risks, or unresolved assumptions now explicit to the next reviewer?
Integration Workflow
For delegating tasks to subagents, follow this 5-step process:
- Step 1: Plan - Analyze problem, design solution, identify routine subtasks
- Step 2: Delegate - Use
runSubagent for routine or repetitive work
- Step 3: Review - Check output for correctness, completeness, integration compatibility
- Step 4: Integrate - Incorporate output into codebase, handle conflicts
- Step 5: Validate - Test integrated code, debug issues, ensure quality
Quality Control
Before integrating subagent results, verify:
Combining with Sequential Thinking
For complex tasks, use Sequential Thinking first to plan architecture, then delegate routine parts:
// Use Sequential Thinking to plan
mcp_sequentialthi_sequentialthinking({
thought: "Breaking down feature...identifying repetitive CRUD for delegation",
thoughtNumber: 1,
totalThoughts: 5,
nextThoughtNeeded: true
})
// Then delegate boilerplate
runSubagent({
description: "Generate CRUD API",
prompt: "Create CRUD functions matching data model..."
})
// Main agent implements core logic
Related Skills
- agent-task-mapping: Use it when the workflow also needs task-to-agent routing decisions.
- custom-agent-usage: Use it when the workflow also needs loading and invoking custom agent definitions safely.
- subagent-driven-development: Use it when the workflow also needs plan-driven implementation with reviewer loops.
- agentic-eval: Use it when the workflow also needs rubric-driven evaluation loops.
1---
2name: subagent-delegation
3version: "2.0"
4last_updated: 2026-09-08
5tags: [subagent, delegation, agents, workflow, automation]
6description: "Delegate routine work to subagents — boilerplate generation, data transformation, file analysis, documentation drafting. Use when splitting tasks into independent subtasks for parallel subagent execution."
7metadata:
8 source: https://skillmd.com/skills/practicalswan/subagent-delegation
9---
10
11# Subagent Delegation Patterns
12
13- Leverage native parallel subagent dispatch and 200k+ context windows where available.
14
15
16## Activation Conditions
17
18Use symptom -> action triggers: when one matches, apply this skill and verify with the protocol below.
19
20Activate this skill when:
21- Creating repetitive code structures or boilerplate
22- Performing data transformation tasks
23- Analyzing codebase for patterns or information
24- Generating documentation from existing code
25- Creating simple utility functions
26- Breaking down complex features into manageable subtasks
27
28## Core Delegation Patterns
29
30See [Delegation Patterns](./references/patterns.md) for detailed examples of:
31- Boilerplate generation (API routes, CRUD operations, component structures)
32- Data transformations between formats
33- File analysis and pattern extraction
34- Documentation generation from code
35- Utility function creation
36
37<!-- MCP:START -->
38
39<!-- PORTABILITY:START -->
40## Cross-Client Portability
41
42This skill is written to stay usable across GitHub Copilot, Claude Code, and Codex.
43
44- GitHub Copilot: keep the folder in a Copilot-visible skill path or wrap the
45 workflow in project instructions when folder discovery is unavailable.
46- Claude Code: keep the folder in a local skills directory or a compatible plugin source.
47- Codex: install or sync the folder into
48 `$CODEX_HOME/skills/subagent-delegation` and restart Codex after major changes.
49
50<!-- PORTABILITY:END -->
51
52## MCP Availability And Fallback
53
54Preferred MCP Server: None required
55
56- Fallback prompt: "Use the Subagent Delegation Patterns skill without MCP. Rely on its local instructions, bundled resources, standard shell or editor tools, and direct verification. Show the evidence used before concluding."
57- Do not claim an MCP operation was used when the active host does not expose it.
58- Treat local files, tests, rendered outputs, logs, or screenshots as the fallback evidence path.
59
60<!-- MCP:END -->
61
62## Anti-Patterns
63
64- Delegating or evaluating without a scoped success condition: The output becomes hard to review and easy to overbuild.
65- Skipping the evidence step: A workflow that cannot be re-checked quickly is not ready for handoff.
66- Bundling unrelated subtasks together: It creates noisy prompts, weaker ownership, and avoidable integration risk.
67
68## Verification Protocol
69
70Before claiming "skill applied successfully":
71
721. Pass/fail: The Subagent Delegation workflow names the agent boundary, delegated scope, and expected return artifact.
732. Pass/fail: Context passed to helpers is minimal, task-local, and free of hidden expected answers.
743. Pass/fail: Results are integrated only after evidence, diffs, or citations are checked by the controller.
754. Pressure-test scenario: Run the workflow on two similar tasks that must not share assumptions or leaked context.
765. Success metric: Zero context leakage; every delegated output is independently reviewable.
77
78## Examples & Scripts
79
80- [Delegation Pattern Examples](./examples/delegation-patterns-examples.md) — Code examples of common delegation patterns
81- [Delegation Template](./scripts/delegation-template.js) — JavaScript template for structuring delegation calls
82
83## Self-Verification Phase-Gate Questions
84
85Before you mark delegated work complete, the coordinating agent must ask:
86
87- Did the subagent receive a scoped task, owned files or responsibilities, and a clear definition of done?
88- Did I review the returned output for correctness, integration fit, and missing edge cases instead of forwarding it blindly?
89- Did I preserve the evidence trail showing what was delegated, what changed, and what still needs local ownership?
90- Are any follow-up fixes, risks, or unresolved assumptions now explicit to the next reviewer?
91
92## Integration Workflow
93
94For delegating tasks to subagents, follow this 5-step process:
95
96- **Step 1: Plan** - Analyze problem, design solution, identify routine subtasks
97- **Step 2: Delegate** - Use `runSubagent` for routine or repetitive work
98- **Step 3: Review** - Check output for correctness, completeness, integration compatibility
99- **Step 4: Integrate** - Incorporate output into codebase, handle conflicts
100- **Step 5: Validate** - Test integrated code, debug issues, ensure quality
101
102## Quality Control
103
104Before integrating subagent results, verify:
105- [ ] Code follows project conventions (style, naming, structure)
106- [ ] Matches specified interfaces and contracts
107- [ ] Includes necessary error handling
108- [ ] Has appropriate comments/documentation
109- [ ] No security vulnerabilities or obvious performance issues
110- [ ] Compatible with existing codebase (imports, dependencies)
111
112## Combining with Sequential Thinking
113
114For complex tasks, use Sequential Thinking first to plan architecture, then delegate routine parts:
115
116```javascript
117// Use Sequential Thinking to plan
118mcp_sequentialthi_sequentialthinking({
119 thought: "Breaking down feature...identifying repetitive CRUD for delegation",
120 thoughtNumber: 1,
121 totalThoughts: 5,
122 nextThoughtNeeded: true
123})
124
125// Then delegate boilerplate
126runSubagent({
127 description: "Generate CRUD API",
128 prompt: "Create CRUD functions matching data model..."
129})
130
131// Main agent implements core logic
132```
133
134
135---
136
137## Related Skills
138
139- [agent-task-mapping](../agent-task-mapping/SKILL.md): Use it when the workflow also needs task-to-agent routing decisions.
140- [custom-agent-usage](../custom-agent-usage/SKILL.md): Use it when the workflow also needs loading and invoking custom agent definitions safely.
141- [subagent-driven-development](../subagent-driven-development/SKILL.md): Use it when the workflow also needs plan-driven implementation with reviewer loops.
142- [agentic-eval](../agentic-eval/SKILL.md): Use it when the workflow also needs rubric-driven evaluation loops.