
Subagent Delegation
- 15 installs
- 7 repo stars
- Updated August 2, 2026
- practicalswan/agent-skills
subagent-delegation is a Claude Code skill for ai & agent building.
About
subagent-delegation is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- subagent-delegation
- AI & Agent Building
- AI-coding skill
Subagent Delegation by the numbers
- 15 all-time installs (skills.sh)
- Ranked #11,187 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/practicalswan/agent-skills --skill subagent-delegationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 15 |
|---|---|
| repo stars | ★ 7 |
| Last updated | August 2, 2026 |
| Repository | practicalswan/agent-skills ↗ |
How do I helps with ai & agent building tasks.?
Helps with ai & agent building tasks.
Who is it for?
Best when you're working on ai & agent building and need structured help with subagent delegation.
Skip if: Teams with no ai & agent building needs, or anyone wanting a generic chat assistant without this specific workflow.
When should I use this skill?
When you need to helps with ai & agent building tasks., or when subagent-delegation is a claude code skill for ai & agent building.
What you get
Structured output aligned to subagent-delegation: subagent-delegation, AI & Agent Building.
Files
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
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":
1. Pass/fail: The Subagent Delegation workflow names the agent boundary, delegated scope, and expected return artifact. 2. Pass/fail: Context passed to helpers is minimal, task-local, and free of hidden expected answers. 3. Pass/fail: Results are integrated only after evidence, diffs, or citations are checked by the controller. 4. Pressure-test scenario: Run the workflow on two similar tasks that must not share assumptions or leaked context. 5. Success metric: Zero context leakage; every delegated output is independently reviewable.
Examples & Scripts
- Delegation Pattern Examples — Code examples of common delegation patterns
- Delegation Template — JavaScript template for structuring delegation calls
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
runSubagentfor 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:
- [ ] Code follows project conventions (style, naming, structure)
- [ ] Matches specified interfaces and contracts
- [ ] Includes necessary error handling
- [ ] Has appropriate comments/documentation
- [ ] No security vulnerabilities or obvious performance issues
- [ ] Compatible with existing codebase (imports, dependencies)
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---
<!-- PORTABILITY:START -->
Cross-Client Portability
This skill is written to stay usable across GitHub Copilot, Claude Code, Codex, and Gemini CLI.
- GitHub Copilot: keep the folder in a Copilot-visible skill or plugin path, or wrap the workflow as project instructions if the host does not support portable skill folders directly.
- Claude Code: keep the folder in a local skills directory or a compatible plugin or marketplace source.
- Codex: install or sync the folder into
$CODEX_HOME/skills/<skill-name>and restart Codex after major changes. - Gemini CLI: this repository generates a project command named
/skills:subagent-delegationfrom this skill. Rebuild commands withpython scripts/export-gemini-skill.py subagent-delegationand then run/commands reloadinside Gemini CLI.
<!-- PORTABILITY:END -->
<!-- MCP:START -->
MCP Availability And Fallback
Preferred MCP Server: None required
- Fallback prompt: "Use the Subagent Delegation Patterns skill without MCP. Rely on the local
SKILL.md, bundled references or scripts, and manual verification. Show the exact commands, evidence, and final checks you used before concluding." - If the current host does not expose a matching server, use the bundled references, scripts, native toolchain, and manual workflow already described in this skill.
- Treat direct local verification, rendered output, logs, tests, or screenshots as the fallback evidence path before completion.
<!-- MCP:END -->
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.
Changelog
[2026-04-25] - Version 1.2 Verification Protocol Refresh
Added
- Added a
Verification Protocolsection with skill-specific pass/fail checks, one pressure-test scenario, and a measurable success metric. - Added guidance to leverage native parallel subagent dispatch and 200k+ context windows where available.
Changed
- Updated
SKILL.mdfrontmatter toversion: "1.2"andlast_updated: 2026-04-25. - Reframed activation guidance toward symptom -> action triggers and standardized two-stage review wording where applicable.
[2026-04-24] - Version 1.1 Refresh
Changed
- Updated the SKILL frontmatter version to
1.1for the 2026-04-24 catalog refresh.
[2026-04-24] - Post-Refresh Cleanup
Fixed
- Renamed the self-check section to explicit phase-gate questions so delegation completion checks are clearer.
[2026-04-24] - Skill Refresh
Changed
- Standardized the SKILL frontmatter with version metadata, last-updated date, tags, and a concise catalog description.
- Reformatted the portability and MCP guidance with a preferred server line, a copy-paste fallback prompt, and consistent bullet lists.
- Added a catalog-standard Anti-Patterns section and refreshed the Related Skills links at the end of the skill.
- Added a self-verification phase gate so delegated workflows explicitly confirm scope, review, and integration evidence before completion.
[2026-04-24] - Catalog Audit Cleanup
Fixed
- Removed obsolete standalone Skill Paths guidance that duplicated the generated portability section.
All notable changes to this skill will be documented in this file.
[2026-04-04] - Cross-Client Portability Refresh
Changed
- Added a standard portability note covering GitHub Copilot, Claude Code, Codex, and Gemini CLI.
- Clarified that the core workflow does not require a dedicated MCP server and can run with local tools alone.
Tested
- Validated
SKILL.mdfrontmatter, portability sections, and Gemini export readiness withpython scripts/validate-skills.py.
[2026-03-09] - Workspace Modernization
Changed
- Updated the workspace and global skill path guidance to match the current
C:/Users/LOQ/.agents/skills/fallback path - Removed duplicate related-skill content so the skill reads cleanly
[2026-02-28] — Description Rewrite & Cross-References
Changed
- Rewrote skill description to ~200 characters with clear, specific activation keywords
- Improved keyword specificity to reduce overlap with related skills
Added
## Related Skillscross-reference table with 2-4 related skills and "Use When" guidance
Subagent Delegation Examples
Example 1: Boilerplate CRUD Generation
When creating multiple similar API endpoints:
// Main agent plans the architecture
const dataModel = {
users: { fields: ['id', 'name', 'email', 'role'], primaryKey: 'id' },
products: { fields: ['id', 'name', 'price', 'stock'], primaryKey: 'id' },
orders: { fields: ['id', 'userId', 'productId', 'quantity'], primaryKey: 'id' }
};
// Delegate CRUD boilerplate generation
runSubagent({
description: "Generate CRUD API endpoints",
prompt: `Create REST API endpoints for CRUD operations on these data models:
${JSON.stringify(dataModel, null, 2)}
For each model, generate:
- GET /api/{resource} - List all items with pagination
- GET /api/{resource}/:id - Get single item
- POST /api/{resource} - Create new item
- PUT /api/{resource}/:id - Update item
- DELETE /api/{resource}/:id - Delete item
Use Express.js with async/await, proper error handling, and input validation.`
});Example 2: Data Transformation
When converting data between formats:
// Task: Convert CSV data to JSON schema
runSubagent({
description: "Transform CSV to JSON schema",
prompt: `Convert this CSV data to a TypeScript interface and JSON schema:
CSV Headers: firstName, lastName, email, age, signupDate
Generate:
1. TypeScript interface with proper types
2. JSON Schema for validation
3. Zod schema for runtime validation
4. Migration function to convert existing CSV data`
});Example 3: Code Analysis
When analyzing codebase for patterns:
// Task: Find all error handling patterns
runSubagent({
description: "Analyze error handling patterns",
prompt: `Search the codebase for error handling patterns. Look for:
1. Try-catch blocks and their structure
2. Custom error classes
3. Error logging approaches
4. Error response formats in API routes
Summarize the current patterns and identify inconsistencies.`
});Example 4: Documentation Generation
When generating docs from existing code:
// Task: Generate API documentation
runSubagent({
description: "Generate API documentation",
prompt: `Analyze all API route files in src/routes/ and generate:
1. OpenAPI/Swagger specification
2. Markdown documentation for each endpoint
3. Example requests/responses
4. Authentication requirements
Include all query parameters, request bodies, and response schemas.`
});Example 5: Utility Creation
When creating reusable utility functions:
// Task: Create validation utilities
runSubagent({
description: "Create validation utilities",
prompt: `Create TypeScript validation utilities for common data types:
1. Email validation with regex
2. Phone number validation (international)
3. Password strength checker
4. URL validation
5. UUID validation
Each function should return { valid: boolean, errors: string[] }.
Include unit tests for each utility.`
});MIT License
Copyright (c) 2026 Sithu Win San
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Subagent Delegation Patterns
Pattern 1: Boilerplate Generation
Scenario: Creating repetitive code structures
runSubagent({
description: "Generate API routes",
prompt: `Create RESTful API route handlers with these endpoints:
- GET /api/items - list all
- GET /api/items/:id - get by ID
- POST /api/items - create new
- PUT /api/items/:id - update
- DELETE /api/items/:id - delete
Adapt to the project's framework (Next.js API Routes, Express, etc.). Include input validation, error handling, and JSDoc comments. Use async/await. Match the style of existing route handlers. Return the complete code.`
})Pattern 2: Data Transformation
Scenario: Converting data formats
runSubagent({
description: "Transform API response",
prompt: `Write a function transformApiData(apiResponse) that converts the API response format to match the application data model:
Input: { id, title, desc, tags: "comma,separated", metadata: "key:value|pairs" }
Output: { id, name, description, tags: string[], metadata: Record<string, string> }
Include TypeScript types if used, handle edge cases (nulls, empty strings, malformed data). Return the complete function with error handling.`
})Pattern 3: File Analysis
Scenario: Gathering information from codebase
runSubagent({
description: "Analyze component props",
prompt: `Search all components in the project and create a list of all prop types/inputs used. For each component, extract: component name, file path, props/inputs (name and type), and typing method (PropTypes/TypeScript/JSDoc/etc.). Detect the framework (React/Vue/Angular/Svelte). Return as a structured JSON array.`
})Pattern 4: Documentation Generation
Scenario: Creating or updating docs
runSubagent({
description: "Generate API docs",
prompt: `Analyze the API endpoints in the codebase and generate comprehensive API documentation in Markdown format. Document all CRUD operations with: HTTP method, endpoint path, request body schema, response examples, status codes, and error scenarios. Format as a proper API reference for README.md or docs/.`
})Pattern 5: Utility Function Creation
Scenario: Simple helper functions
runSubagent({
description: "Create string utilities",
prompt: `Create a utilities module with these functions:
1. truncate(str, maxLength, suffix='...') - truncate with ellipsis
2. capitalize(str) - capitalize first letter
3. kebabCase(str) - convert to kebab-case
4. randomId(length=8) - generate random alphanumeric ID
Use TypeScript, include JSDoc, add input validation. Return the code for src/lib/stringUtils.ts.`
})Parallel Delegation
For independent tasks, delegate in parallel:
// Delegate multiple independent tasks
const task1 = runSubagent({
description: "Generate types",
prompt: "Create TypeScript interfaces or type definitions for the main entities (User, Post, Comment, etc.) based on the API schema..."
})
const task2 = runSubagent({
description: "Create utilities",
prompt: "Create date/time formatting utilities: formatRelativeTime, formatDuration, parseISO..."
})
const task3 = runSubagent({
description: "Generate mock data",
prompt: "Create a mock data generator for the main entities, generating realistic test data (20+ items)..."
})
// Main agent integrates all results/**
* Subagent Delegation Template
*
* This is a template file for creating subagent delegation calls.
* Copy and modify this template for your specific use case.
*/
/**
* Template for delegating a task to a subagent
*
* @param {string} agentName - The name of the agent to delegate to
* @param {string} description - Brief description of the task
* @param {string} prompt - Detailed prompt for the subagent
*/
function delegationTemplate(agentName, description, prompt) {
return {
agentName,
description,
prompt
};
}
/**
* Example: Delegating boilerplate generation
*/
function exampleBoilerplateDelegation() {
return delegationTemplate(
"Universal Janitor", // or appropriate agent name
"Generate CRUD boilerplate",
`Create REST API endpoints for the Product model:
- id: string (UUID)
- name: string
- price: number
- description: string
- stock: number
Generate: GET, POST, PUT, DELETE endpoints with Express.js,
proper error handling, and input validation.`
);
}
/**
* Example: Delegating documentation generation
*/
function exampleDocumentationDelegation() {
return delegationTemplate(
"Tech Writer",
"Generate API documentation",
`Create API documentation for the authentication endpoints.
Include request/response examples, error codes, and
authentication requirements. Output in Markdown format.`
);
}
/**
* Example: Delegating code analysis
*/
function exampleCodeAnalysisDelegation() {
return delegationTemplate(
"Code Explainer",
"Analyze component architecture",
`Analyze the React components in src/components/.
Identify:
1. Component hierarchy and relationships
2. Props passing patterns
3. State management approach
4. Shared code that could be extracted
Provide a summary with recommendations.`
);
}
/**
* Checklist before delegating:
*
* - [ ] Task is routine/repetitive (not core architecture)
* - [ ] Task is well-defined with clear acceptance criteria
* - [ ] Instructions are specific and actionable
* - [ ] Output format is specified
* - [ ] Integration plan exists for the output
* - [ ] Quality criteria are defined
* - [ ] Security-sensitive logic is NOT being delegated
*/
module.exports = {
delegationTemplate,
exampleBoilerplateDelegation,
exampleDocumentationDelegation,
exampleCodeAnalysisDelegation
};
Related skills
FAQ
What does subagent-delegation do?
subagent-delegation is a Claude Code skill for ai & agent building.
When should I use subagent-delegation?
When you need to helps with ai & agent building tasks., or when subagent-delegation is a claude code skill for ai & agent building.
What are the main capabilities?
subagent-delegation; AI & Agent Building; AI-coding skill.