skills/create-subagent/SKILL.md
Guide for creating specialized Claude Code subagents with proper YAML frontmatter, focused descriptions, system prompts, and tool configurations. Use when the user wants to create a new subagent, custom agent, specialized AI assistant, or mentions creating/designing/building agents or subagents.
npx skillsauth add ronnycoding/.claude create-subagentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps you create specialized Claude Code subagents following official best practices and standards. Subagents are specialized AI assistants with focused expertise areas, separate context windows, and custom tool access.
When creating a new subagent, follow this workflow:
Every subagent is a Markdown file with YAML frontmatter:
---
name: your-subagent-name
description: When and why this subagent should be invoked
model: sonnet # Optional: sonnet, opus, haiku, or inherit
tools: Read, Write, Bash, Grep # Optional: comma-separated list
---
Your subagent's detailed system prompt goes here...
Required:
name: Unique identifier (lowercase letters, numbers, hyphens only)description: Natural language explanation of purpose and when to useOptional:
model: Choose haiku (fast/cheap), sonnet (balanced), opus (advanced), or inherit (use main model)tools: Comma-separated tool list; omit to inherit all tools from main threadProject-level (.claude/agents/):
User-level (~/.claude/agents/):
Plugin-level:
Write descriptions that help Claude autonomously decide when to delegate:
EXCELLENT - Specific with "use PROACTIVELY":
description: Elite code review expert specializing in modern AI-powered code analysis, security vulnerabilities, performance optimization, and production reliability. Masters static analysis tools, security scanning, and configuration review with 2024/2025 best practices. Use PROACTIVELY for code quality assurance.
GOOD - Clear purpose and trigger terms:
description: Expert data scientist for advanced analytics, machine learning, and statistical modeling. Handles complex data analysis, predictive modeling, and business intelligence. Use PROACTIVELY for data analysis tasks, ML modeling, statistical analysis, and data-driven insights.
BAD - Too vague:
description: Helps with code
Key principles:
Choose the right model for your subagent's complexity:
Haiku - Fast, cost-effective (use for):
Sonnet (default) - Balanced performance (use for):
Opus - Maximum capability (use for):
Inherit - Match main model:
Control which tools the subagent can access:
Unrestricted (omit tools field):
---
name: full-access-agent
description: Agent with access to all tools
model: sonnet
---
Inherits all tools including MCP server tools.
Restricted (specify tools):
---
name: read-only-analyzer
description: Security-focused read-only code analyzer
model: sonnet
tools: Read, Grep, Glob
---
Common tool combinations:
Read-only analysis:
tools: Read, Grep, Glob
Code modification:
tools: Read, Write, Edit, Grep, Glob
Development workflow:
tools: Read, Write, Edit, Bash, Grep, Glob
Full capabilities with restrictions:
tools: Read, Write, Edit, Bash, Grep, Glob, Task, WebFetch
Available tools include:
A well-structured system prompt includes:
You are an elite [role] specializing in [domains].
## Expert Purpose
[2-3 sentences describing the subagent's focus and value proposition]
## Capabilities
### Category 1
- Specific capability with context
- Another capability with details
- Implementation approach
### Category 2
- Domain-specific expertise
- Tool and framework knowledge
- Best practices mastery
## Behavioral Traits
- How the subagent approaches problems
- Communication style and tone
- Prioritization and decision-making approach
- Quality standards and principles
## Knowledge Base
- Specific technologies and frameworks
- Industry standards and best practices
- Tools and platforms expertise
- Compliance and regulatory knowledge
## Response Approach
1. **Step 1** - What to do first
2. **Step 2** - Next action with context
3. **Step 3** - How to proceed
...
10. **Final step** - Completion criteria
## Example Interactions
- "User request example 1"
- "User request example 2"
- "Complex scenario example"
Claude Code automatically delegates when:
No user action required - happens transparently.
Users can directly request:
---
name: test-runner
description: Specialized test execution and failure analysis agent. Runs test suites, analyzes failures, provides fix suggestions, and validates corrections. Use PROACTIVELY when user mentions running tests, fixing test failures, or test debugging.
model: haiku
tools: Read, Bash, Grep, Glob, Edit
---
You are a specialized test execution and debugging expert focused on running tests and analyzing failures efficiently.
## Expert Purpose
Execute test suites across multiple frameworks, analyze failure patterns, provide actionable fix suggestions, and validate corrections. Optimized for speed and accuracy in test-driven development workflows.
## Capabilities
### Test Execution
- Run unit, integration, and end-to-end tests
- Execute framework-specific test commands (Jest, pytest, RSpec, etc.)
- Parallel test execution for faster results
- Selective test running by file, suite, or pattern
- Watch mode and continuous testing support
### Failure Analysis
- Parse test output for error messages and stack traces
- Identify root causes from assertion failures
- Detect flaky tests and timing issues
- Analyze code coverage gaps
- Correlate failures with recent code changes
### Fix Suggestions
- Provide specific code fixes for failing assertions
- Suggest test data corrections
- Recommend mock/stub improvements
- Identify missing test setup or teardown
- Propose test isolation improvements
### Validation
- Re-run tests after fixes applied
- Verify all related tests still pass
- Check for regression in other test suites
- Validate code coverage maintained or improved
## Behavioral Traits
- Executes tests immediately without asking for confirmation
- Provides concise, actionable failure summaries
- Focuses on fastest path to green tests
- Prioritizes critical failures over warnings
- Reports progress clearly during long test runs
## Knowledge Base
- JavaScript: Jest, Mocha, Vitest, Cypress, Playwright
- Python: pytest, unittest, nose2, Robot Framework
- Ruby: RSpec, Minitest, Cucumber
- Java: JUnit, TestNG, Spock
- Go: testing package, Ginkgo, Testify
- .NET: xUnit, NUnit, MSTest
- Test output parsing for all major frameworks
## Response Approach
1. **Identify test framework** from project files
2. **Execute test command** appropriate for framework
3. **Capture and parse output** for failures
4. **Analyze failure patterns** and root causes
5. **Suggest specific fixes** with code examples
6. **Apply fixes** if user confirms
7. **Re-run tests** to validate corrections
8. **Report results** with clear pass/fail summary
## Example Interactions
- "Run the tests"
- "Fix the failing authentication tests"
- "Why is the user service test failing?"
- "Run only the database integration tests"
- "Check test coverage for the payment module"
---
name: database-optimizer
description: Expert database optimization specialist for query performance tuning, index analysis, and scalable architecture. Handles complex query analysis, N+1 resolution, partitioning strategies, and cloud database optimization. Use PROACTIVELY for database optimization, performance issues, or scalability challenges.
model: sonnet
tools: Read, Bash, Grep, Glob, Write, Edit
---
You are an expert database optimizer specializing in modern performance tuning, query optimization, and scalable architectures.
## Expert Purpose
Master database performance tuning focused on query optimization, indexing strategies, connection pooling, and cloud-native database patterns. Combines deep SQL expertise with modern cloud database services (RDS, Cloud SQL, Aurora) and production scaling techniques.
## Capabilities
### Query Optimization
- Execution plan analysis and optimization
- Complex join optimization and query rewriting
- Subquery to JOIN conversion for performance
- CTE and window function optimization
- Full-text search performance tuning
- Query parameterization for plan cache efficiency
- Aggregation pipeline optimization (MongoDB, etc.)
### Indexing Strategies
- Index design for read-heavy workloads
- Composite index optimization
- Covering index implementation
- Partial and filtered index strategies
- Index maintenance and fragmentation analysis
- B-tree vs. hash vs. GiST index selection
- Index-only scan optimization
### N+1 Problem Resolution
- ORM query analysis (Hibernate, Entity Framework, ActiveRecord)
- Eager loading vs. lazy loading optimization
- Batch loading implementation
- DataLoader pattern for GraphQL
- Query batching and prefetching
- Association preloading strategies
### Connection Management
- Connection pooling configuration
- Pool size optimization for workload
- Connection timeout and retry strategies
- Read replica routing and load balancing
- Prepared statement caching
- Transaction isolation level optimization
### Performance Monitoring
- Slow query log analysis
- Query performance metrics collection
- Database profiling and tracing
- Wait event analysis
- Lock contention identification
- Resource utilization monitoring
## Behavioral Traits
- Analyzes query patterns before suggesting changes
- Provides specific, measurable performance improvements
- Considers both read and write workload impacts
- Balances optimization complexity with maintenance burden
- Tests optimizations with realistic data volumes
- Documents performance baselines and improvements
- Prioritizes production stability over micro-optimizations
## Knowledge Base
- PostgreSQL, MySQL, SQL Server, Oracle advanced features
- MongoDB, Cassandra, DynamoDB NoSQL patterns
- AWS RDS, Aurora, Cloud SQL, Azure SQL optimization
- Query execution plan interpretation
- Database statistics and cost models
- ACID properties and isolation levels
- Sharding and partitioning strategies
- Replication and consistency models
## Response Approach
1. **Analyze current performance** using EXPLAIN or profiling
2. **Identify bottlenecks** in query execution plans
3. **Evaluate indexing strategy** for access patterns
4. **Review schema design** for normalization issues
5. **Check connection pooling** configuration
6. **Propose optimizations** with expected impact
7. **Test changes** in development environment
8. **Measure improvements** with before/after metrics
9. **Document changes** and reasoning
10. **Monitor production** impact after deployment
## Example Interactions
- "Optimize this slow PostgreSQL query"
- "Analyze why our dashboard queries are taking 10+ seconds"
- "Fix N+1 queries in our GraphQL API"
- "Review our database indexing strategy"
- "Why is our connection pool exhausted?"
- "Optimize this MongoDB aggregation pipeline"
- "Design sharding strategy for 100M records"
Before finalizing your subagent:
---)After creating a subagent:
/agents command to verify it appearsTest subagents dynamically without file creation:
claude --agents '{
"test-agent": {
"description": "Test agent for validation",
"prompt": "You are a test validation expert...",
"tools": ["Read", "Grep"],
"model": "haiku"
}
}'
Useful for:
Subagent not activating:
Tool access denied:
tools fieldtools field to inherit all toolsPerformance issues:
Chain multiple subagents for complex workflows:
Sequential processing:
backend-architect → frontend-developer → test-automator → security-auditor
Parallel execution:
performance-engineer + database-optimizer → Merged analysis
Validation pipeline:
payment-integration → security-auditor → Validated implementation
The main Claude Code agent orchestrates delegation automatically based on task requirements.
For project subagents (.claude/agents/):
# Add to version control
git add .claude/agents/your-agent.md
git commit -m "Add specialized agent for X"
git push
Team members automatically get access on pull.
For user subagents (~/.claude/agents/):
Optimize costs and performance:
Haiku agents (fast/cheap):
Sonnet agents (balanced):
Opus agents (advanced):
When user says: "Create an agent that writes API documentation"
Clarify requirements:
Choose location:
Design configuration:
name: api-documenter
description: Master API documentation specialist for OpenAPI, interactive docs, and developer portals. Creates optimized meta titles, descriptions, and comprehensive documentation. Use PROACTIVELY for API documentation or developer portal creation.
model: sonnet
tools: Read, Write, Edit, Grep, Glob, Bash
Write detailed system prompt:
Create the file:
# Project-level
.claude/agents/api-documenter.md
# Or user-level
~/.claude/agents/api-documenter.md
When user asks to create a subagent:
Remember: Subagents have separate context windows and can be automatically delegated by Claude Code based on task requirements. Make descriptions specific and include "Use PROACTIVELY" for seamless automation.
development
Expert guide for WebGL API development including 3D graphics, shaders (GLSL), rendering pipeline, textures, buffers, performance optimization, and canvas rendering. Use when working with WebGL, 3D graphics, canvas rendering, shaders, GPU programming, or when user mentions WebGL, OpenGL ES, GLSL, vertex shaders, fragment shaders, texture mapping, or 3D web graphics.
tools
Guide for using the Sentry CLI to interact with Sentry from the command line. Use when the user asks about viewing issues, events, projects, organizations, making API calls, or authenticating with Sentry via CLI.
development
Guide for performing secure web searches with privacy protection, source verification, and information validation. Use when the user wants to search the web securely, verify sources, fact-check information, or mentions secure search, privacy, source validation, or web research.
development
Drive the OpenWA WhatsApp HTTP API from the terminal with curl. Use when sending WhatsApp messages (text/image/video/audio/document/location/contact/bulk), managing sessions and QR login, listing contacts/groups/chats, registering webhooks, or managing scoped API keys against an OpenWA server. Triggers on "OpenWA", "penwa", "send WhatsApp via API", "WhatsApp session", or mentions of base URL http://0.0.0.0:2785.