pan-subagent-creator
Create custom Claude Code subagents with isolated context windows, specific tool permissions, and specialized prompts. Use when users want to create a new…
by eltmon★ 36 GitHub stars
Install pan-subagent-creator in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
About this skill
Subagent Creator
Create specialized subagents that handle specific tasks with their own context windows, system prompts, and tool permissions.
What Are Subagents?
Subagents are mini-agents with:
- Independent context window - Keep exploration out of main conversation
- Custom system prompt - Specialized behavior and expertise
- Scoped tool permissions - Least-privilege access
- Model selection - Cost optimization (Haiku for read-only, Sonnet for complex)
Claude delegates to subagents via the Task tool based on matching descriptions.
Subagent Anatomy
Subagents are Markdown files with YAML frontmatter:
---
name: code-reviewer
description: Expert code review. Use proactively after code changes.
tools: Read, Grep, Glob, Bash
model: sonnet
---
You are a senior code reviewer focusing on quality, security, and best practices.
[Instructions for the subagent...]
Frontmatter Fields
| Field | Required | Description |
|---|---|---|
name |
Yes | Unique identifier (lowercase, hyphens allowed) |
description |
Yes | When Claude should delegate - this is how Claude decides |
tools |
No | Allowed tools (inherits all if omitted) |
disallowedTools |
No | Tools to explicitly deny |
model |
No | haiku, sonnet, opus, or inherit (default: sonnet) |
permissionMode |
No | default, acceptEdits, dontAsk, bypassPermissions, plan |
skills |
No | Skills to load at startup |
hooks |
No | Lifecycle hooks for validation |
Storage Locations
| Location | Scope | Use Case |
|---|---|---|
.claude/agents/ |
Current project | Team-shared subagents |
~/.claude/agents/ |
All projects | Personal, reusable subagents |
CLI --agents flag |
Current session | Quick testing |
Model Selection for Cost
| Model | Cost | Best For |
|---|---|---|
| Haiku | Lowest | Read-only exploration, simple validation |
| Sonnet | Medium | Most tasks, good balance |
| Opus | Highest | Complex reasoning, critical decisions |
| inherit | Parent's | Match main conversation |
Permission Modes
permissionMode: default # Normal permission prompts
permissionMode: acceptEdits # Auto-accept file edits
permissionMode: dontAsk # Auto-deny all prompts
permissionMode: bypassPermissions # Skip all checks (dangerous)
permissionMode: plan # Read-only exploration mode
Common Tool Sets
Read-only agents:
tools: Read, Grep, Glob
Code review agents:
tools: Read, Grep, Glob, Bash
Full development agents:
tools: Read, Write, Edit, Bash, Grep, Glob
Restricted bash (specific commands only):
tools: Read, Grep, Glob, Bash(git status:*), Bash(git diff:*)
Creation Process
Step 1: Define Purpose
- What specific task does this agent handle?
- What expertise should it have?
- What tools does it need (minimum necessary)?
Step 2: Write Description
The description is how Claude decides when to delegate. Make it specific:
Good: "Expert database query optimizer. Analyzes SQL queries for performance issues, suggests indexes, and rewrites slow queries."
Bad: "Helps with database stuff."
Step 3: Create Agent File
# Project-level (shared with team)
mkdir -p .claude/agents
touch .claude/agents/my-agent.md
# User-level (personal)
mkdir -p ~/.claude/agents
touch ~/.claude/agents/my-agent.md
Step 4: Write Instructions
Use imperative voice. Be specific about:
- What the agent should do when invoked
- How to structure output
- What to avoid
- Error handling
Step 5: Test Delegation
Try prompts that should and shouldn't trigger the agent. Refine description if needed.
Example: Code Reviewer
---
name: code-reviewer
description: Expert code review specialist. Reviews code for quality, security, and maintainability. Use proactively after code changes or when user asks for review.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a senior code reviewer ensuring high standards.
When invoked:
1. Run `git diff` to see recent changes
2. Focus on modified files
3. Begin review immediately
Review checklist:
- Code is clear and readable
- Functions and variables are well-named
- No duplicated code
- Proper error handling
- No exposed secrets or API keys
- Input validation present
- Good test coverage
- Performance considered
Provide feedback by priority:
- **Critical** (must fix)
- **Warning** (should fix)
- **Suggestion** (consider)
Include specific examples of how to fix issues.
Example: Database Read-Only Agent with Hooks
---
name: db-reader
description: Execute read-only database queries. Use when user needs data analysis without modification risk.
tools: Bash
model: haiku
hooks:
PreToolUse:
- matcher: "Bash"
hooks:
- type: command
command: "./scripts/validate-readonly.sh"
---
You are a
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
Bundled files
- assets/validate-readonly-query.sh
- references/example-agents.md
- scripts/init_agent.py
FAQ
What does the pan-subagent-creator skill do?
Create custom Claude Code subagents with isolated context windows, specific tool permissions, and specialized prompts. Use when users want to create a new subagent, configure agent delegation, set up task-specific agents, or define specialized assistants. Triggers on "create a subagent", "make a custom agent", "define an agent", "agent configuration", or "Task tool agent".
How do I install the pan-subagent-creator skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the pan-subagent-creator skill run scripts?
Yes, this skill bundles executable scripts. Review the source before installing.
Related skills
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…