This skill should be used when the user asks to "create a subagent", "validate a subagent", "generate subagent schema", "check subagent configuration", "write subagent specification", or mentions...
Comprehensive guidance for creating, validating, and documenting Claude Code subagents with schemas and protocol specifications.
This skill provides structured workflows for developing production-ready Claude Code subagents. Use when creating new subagents, validating existing configurations, generating JSON schemas for validation, or writing technical specifications for subagent protocols.
This skill should be used when:
Subagents are Markdown files with YAML frontmatter:
---
name: subagent-identifier
description: When and how to use this subagent
tools: Tool1, Tool2
model: sonnet
permissionMode: default
skills: skill1, skill2
---
System prompt content in Markdown format.
^[a-z0-9-]+$)sonnet, opus, haiku, or inheritdefault, acceptEdits, bypassPermissions, plan, ignoreDefine purpose and scope:
Use the subagent template:
cp assets/template.md .claude/agents/your-subagent.md
Configure frontmatter:
name (lowercase, hyphens)description with trigger phrasestools needed (or omit for all)model and permissionModeWrite system prompt:
Validate configuration:
scripts/validate-subagent.sh .claude/agents/your-subagent.md
Use the validation script to check:
scripts/validate-subagent.sh path/to/subagent.md
The script validates against the JSON schema in assets/subagent-schema.json.
When needing a validation schema for tooling:
assets/subagent-schema.jsonThe schema includes:
For technical documentation:
Reference the protocol spec: references/protocol-specification.md
Include key sections:
Adapt for your needs:
scripts/validate-subagent.sh checks:
Usage:
scripts/validate-subagent.sh <subagent-file>
Exit codes:
scripts/create-subagent.sh scaffolds a new subagent:
scripts/create-subagent.sh <name> <scope>
Arguments:
name: Subagent identifier (lowercase, hyphens)scope: project (.claude/agents/) or user (~/.claude/agents/)Creates file from template and opens in editor.
assets/subagent-schema.json provides:
Use with validation tools:
# With ajv-cli
ajv validate -s assets/subagent-schema.json -d your-subagent.json
# With Python jsonschema
python -c "import json, jsonschema; \
jsonschema.validate( \
json.load(open('subagent.json')), \
json.load(open('assets/subagent-schema.json')))"
Include specific trigger phrases:
Good:
description: Expert code reviewer. Use PROACTIVELY after code changes to review quality, security, and best practices. Checks for vulnerabilities, performance issues, style violations.
Poor:
description: Helps with code
Grant only necessary tools:
# Read-only analysis
tools: Read, Grep, Glob
# Code modification
tools: Read, Edit, Write
# Full workflow
tools: Read, Edit, Write, Bash
Structure prompts with:
Choose appropriate model:
Comprehensive documentation in references/:
protocol-specification.md: Complete subagent protocol spec (20,000+ words)
field-reference.md: Detailed field-by-field reference
best-practices.md: Advanced best practices
Production-ready examples in examples/:
code-reviewer.md: Comprehensive code review subagent
debugger.md: Systematic debugging specialist
test-runner.md: Test automation expert
Templates and schemas in assets/:
subagent-schema.json: Complete JSON Schema for validationtemplate.md: Base template for new subagents.claude/agents/name.md~/.claude/agents/name.mdplugin-dir/agents/name.mdWhen names conflict:
Common tools for subagents:
Task - Delegate to subagentsBash - Execute shell commandsRead, Edit, Write - File operationsGrep, Glob - Search operationsWebFetch, WebSearch - Web operationsTodoWrite - Task managementmcp__<server>__<tool>default: Standard permission flow (recommended)acceptEdits: Auto-approve edit operationsbypassPermissions: Skip all permissions (use cautiously)plan: Read-only explorationignore: Ignore permission dialogsCheck:
^[a-z0-9-]+$Run validation:
scripts/validate-subagent.sh path/to/subagent.md
Improve description:
Example:
description: Security auditor. Use PROACTIVELY when reviewing code, checking for vulnerabilities, or analyzing security. Checks OWASP Top 10, injection attacks, authentication issues.
Verify:
tools specifiedmcp__server__toolCheck available tools:
Task, Bash, Glob, Grep, Read, Edit, Write, NotebookEdit,
WebFetch, WebSearch, BashOutput, KillShell, AskUserQuestion,
TodoWrite, Skill, SlashCommand
Adjust permissionMode:
default: User approves operationsacceptEdits: Auto-approve edits onlybypassPermissions: Auto-approve all (use carefully)Or grant specific tools in tools field.
Before deploying a subagent:
Structure:
Configuration:
^[a-z0-9-]+$Content Quality:
Validation:
Testing: