/skills-toolkit:subagent-creatorfrom skills-toolkit
Creates, validates, and refines Claude Code subagents with proper scope, tool access, and permission modes for reliable delegation.
Ships in skills-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Dual purpose: Create subagents right the first time OR elevate existing subagents to best practices.
Use AskUserQuestion with predefined options:
questions: [
{
question: "What would you like to do?",
header: "Action",
options: [
{
label: "Create a new subagent",
description: "Build a subagent from scratch with proper scope, tool access, and permissions"
},
{
label: "Validate existing subagent",
description: "Check if subagent is properly configured and production-ready"
},
{
label: "Refine/improve subagent",
description: "Enhance existing subagent for clarity, efficiency, or reliability"
}
],
multiSelect: false
}
]
Then route to the appropriate workflow section based on their selection.
| Workflow | Purpose | Steps | Reference |
|---|---|---|---|
| Create | Build subagent from scratch | 1. Interview → 2. Design → 3. Implement → 4. Validate | templates.md + validation-workflow.md |
| Validate | Check existing subagent | 1. Configuration → 2. Delegation → 3. Prompt → 4. Tools → 5. Permissions → 6. Hooks → 7. Test | validation-workflow.md + checklist.md |
| Refine | Improve existing subagent | 1. Identify issues → 2. Target improvements → 3. Update → 4. Re-validate | checklist.md + topic-specific refs |
Mindset: Subagents are execution FOR CLAUDE, not documentation FOR PEOPLE. Question: "Will Claude reliably delegate & execute?" not "Does this read well?"
Subagents isolate task execution with custom prompts, tool access, permissions. Without structured guidance, they become misconfigured and unreliable. This skill ensures every subagent is optimized for reliable delegation and execution from creation.
Subagents are isolated execution environments with independent configuration (prompt, tools, permissions). Claude delegates to subagents based on request context using natural language matching against descriptions. For complete architectural details including delegation mechanisms, configuration options, and integration patterns, see references/how-subagents-work.md.
⚠️ CRITICAL: Scope Detection & Clarification
Always detect project type first, then clarify scope only when needed:
Allowed scopes (project-scoped only):
.claude-plugin/plugin.json): Subagents in agents/ (plugin) or .claude/agents/ (project-level).claude/agents/ only🚫 Forbidden scopes (REFUSE all editing attempts):
~/.claude/plugins/cache/ — Installed/cached plugins~/.claude/agents/ — User-space subagents (affects all projects)If user provides forbidden path: Refuse with explanation: "Subagent-creator only works with project-scoped subagents. User-space subagents (~/.claude/agents/) affect all projects and should not be edited here."
START HERE - Scope Detection & Clarification Flow:
Ask Question 1: Action type
AUTO-DETECT: Check for .claude-plugin/plugin.json
3a. IF PROJECT IS A CLAUDE PLUGIN - Ask Question 2: Scope choice with predefined options
questions: [
{
question: "Should this subagent be part of the plugin or project-level?",
header: "Scope",
options: [
{
label: "Part of the plugin",
description: "Add to agents/ directory (bundled with plugin for distribution)"
},
{
label: "Project-level",
description: "Add to .claude/agents/ directory (local, not bundled with plugin)"
}
],
multiSelect: false
}
]
Then ask: "What do you want to call it?" (e.g., db-analyzer, code-reviewer, compliance-auditor)
3b. IF PROJECT IS REGULAR - No scope question needed
.claude/agents/"db-analyzer, code-reviewer, compliance-auditor)For validating/refining: Ask "Provide the subagent name or path relative to project root" (e.g., agents/db-analyzer for plugins or .claude/agents/db-analyzer for regular projects)
Based on answers, route to the appropriate workflow below.
After routing to "create", interview the user to gather requirements using AskUserQuestion with proper options:
questions: [
{
question: "What specialized task should this subagent execute? What problem does isolation solve?",
header: "Purpose & Scope",
options: [] // Open-form
},
{
question: "When should Claude delegate to this subagent? What request phrases trigger it?",
header: "Delegation Trigger",
options: [] // Open-form
},
{
question: "Which tools will this subagent need? (Apply principle of least privilege)",
header: "Tool Access",
options: [] // Open-form
},
{
question: "How should the subagent handle permission prompts?",
header: "Permission Mode",
options: [
{ label: "default", description: "Prompt for each permission (standard behavior)" },
{ label: "acceptEdits", description: "Auto-accept file edits without prompting" },
{ label: "dontAsk", description: "Auto-accept all permissions without prompting" },
{ label: "plan", description: "Use plan mode for structured permission flow" }
],
multiSelect: false
}
]
Then use references/templates.md to apply requirements to the appropriate subagent structure.
.claude/agents/ or agents/ relative to project root. If path is from ~/.claude/plugins/cache/ or ~/.claude/, REFUSE and explain project scopeagents/ → Plugin-level subagent.claude/agents/ → Project-level subagentreferences/validation-workflow.md (Phase 1-7)references/checklist.md to identify gaps during validationreferences/delegation-signals.md for description clarityreferences/checklist.md or references/delegation-signals.mdMeasure success by whether Claude will reliably delegate to and execute the subagent:
✅ Description clarity - Includes specific trigger phrases Claude will recognize; delegates reliably when needed ✅ Configuration - Correct YAML frontmatter (name, description, tools, permissionMode, model, hooks) ✅ Prompt quality - System prompt is clear, procedural, and context-appropriate ✅ Tool scoping - Only necessary tools declared; principle of least privilege enforced ✅ Permission mode - Appropriate for use case (foreground vs background, interactive vs auto-deny) ✅ Hooks - Correctly configured for validation/lifecycle when needed ✅ Integration - Tested with real delegation scenarios; works with both foreground and background execution
When helping the user create a subagent, follow these steps:
Step 1: Prepare storage location Guide the user to create the directory:
~/.claude/agents/.claude/agents/Step 2: Create the Markdown file Write the subagent configuration with YAML frontmatter + system prompt body. Example structure:
---
name: db-analyzer
description: >-
Execute read-only database queries to analyze data. Use when exploring
databases, generating reports, or analyzing data patterns. Supports
SELECT queries only; write operations blocked.
model: sonnet
tools: Bash, Read, Write
permissionMode: dontAsk
---
You are a database analyst with read-only access...
Step 3: Apply guidelines for Claude's delegation Ensure the subagent meets these requirements:
Step 4: Write the system prompt The prompt body is what Claude executes when delegated. Structure: Purpose → Key behaviors → Constraints → Examples
Step 5: Add hooks if needed For conditional tool validation (e.g., read-only database access), guide the user to configure PreToolUse hooks with validation scripts.
Step 6: Guide user through validation
Have the user review the checklist in references/checklist.md before deployment. Then guide them through real-world testing: try requests that should trigger delegation, and requests that should not.
references/validation-workflow.md) to identify issues systematicallyreferences/checklist.md) during validationStep 1: Understand subagent architecture
→ How Claude delegates, execution models, when to use subagents, delegation mechanisms
→ references/how-subagents-work.md for architecture overview
Step 2: Choose starting template
→ Real-world examples and copy-paste starting points for common patterns
→ references/templates.md
Step 3: Write clear delegation signals
→ Descriptions trigger Claude's delegation. Include specific trigger phrases; vague descriptions = poor reliability.
→ references/delegation-signals.md for writing descriptions that trigger delegation
Step 3b: Write reliable delegation prompts
→ Pattern: role statement → task → context → explicit outputs → constraints. Based on production implementations (skill-tester, skill-creator).
→ references/delegation-patterns.md for proven delegation patterns with real examples
Step 4: Configure tools & permissions
→ Grant only necessary tools (principle of least privilege). Permission modes: foreground/interactive, background/concurrent, plan/read-only
→ references/tool-scoping.md for tool access patterns
→ references/permission-modes.md for permission mode decision matrices
Step 5: Complete YAML configuration
→ Frontmatter fields: name, description, model, tools, permissionMode, hooks (PreToolUse, PostToolUse, SubagentStart, SubagentStop)
→ references/configuration-reference.md for complete YAML reference
Step 6: Validate before deployment
→ 7-phase validation process: configuration → delegation → prompt → tools → permissions → hooks → testing
→ references/validation-workflow.md for validation phases
→ references/checklist.md for best practices checklist
→ Run 7-phase validation workflow systematically
→ references/validation-workflow.md for all phases
→ references/checklist.md for quality assessment
→ Identify gaps using checklist, make targeted improvements, re-validate
→ references/checklist.md for identifying issues
→ Topic-specific references as needed
→ Hook validation, chaining, background execution, lifecycle management, error handling
→ references/advanced-patterns.md for production patterns
Frontmatter essentials:
name: Required, lowercase-hyphen, ≤64 chars (Claude's reference label)description: Required, ≤1024 chars, must include trigger phrases Claude recognizes (PRIMARY delegation signal)[Action]. Use when [trigger contexts]. [Scope/constraints].Common optional fields:
model: sonnet|opus|haiku|inherit (default: sonnet)tools: Allowlist tools (default: inherit all)permissionMode: default|acceptEdits|dontAsk|bypassPermissions|planhooks: PreToolUse, PostToolUse, SubagentStart, SubagentStop for validation/lifecycleScope storage (project-scoped only; subagent-creator refuses user-space):
.claude/agents/ (recommended)agents/ in plugin directory (for plugin projects)~/.claude/agents/ (forbidden; affects all projects — do not edit here)For complete configuration reference, defaults, field combinations, naming conventions, and permission mode decision matrices, see references/configuration-reference.md and references/permission-modes.md.
Team/Production:
tool-scoping.md)checklist.md → "Team & Production Subagents" for full considerations and advanced-patterns.md for production patternsreferences/advanced-patterns.md (opens in a new tab)references/checklist.md (opens in a new tab)references/configuration-reference.md (opens in a new tab)references/delegation-patterns.md (opens in a new tab)references/delegation-signals.md (opens in a new tab)references/how-subagents-work.md (opens in a new tab)references/permission-modes.md (opens in a new tab)references/templates.md (opens in a new tab)references/tool-scoping.md (opens in a new tab)references/validation-workflow.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
7 skills in this plugin
/ask-user-questionImplement skills using AskUserQuestion tool for interactive user input and decisions. Use when authoring skills that need to gather options, handle free-text answers, process multi-select, or build multi-step workflows. Covers tool mechanics, constraints, wiring into skills, response handling, and dynamic question patterns./hook-creatorCreate, validate, and refine Claude Code plugin hooks for automating workflows. Use when building new hooks from scratch, validating existing hooks against best practices, or improving hook quality. Supports command hooks (shell scripts), prompt hooks (LLM decisions), event matching, decision schemas, and production safety validation. Claude auto-activates when you ask to build a hook, check hook reliability, improve hook configurations, or validate hooks for production./plugin-creatorCreate, convert, validate, and publish Claude Code plugins with Agent Skills, hooks, agents, and servers. Use when building plugins from scratch, converting projects to plugins, improving plugin structure, or publishing to marketplace. Includes automated scanning, manifest generation, marketplace.json creation, and validation guidance. Component-specific work delegates to hook-creator, subagent-creator, and skill-creator skills./skill-composerCreate NEW Claude Code skills from scratch following best practices. Use when building new skills, interviewing for requirements, applying templates, organizing frontmatter and body content, or converting slash commands to skills. Guides skill structure, naming, descriptions, progressive disclosure, reference organization, and tool scoping./skill-refinerImprove and validate existing Claude Code skills for clarity, efficiency, and production readiness. Use when: refining skills, improving skill structure, validating against best practices, reducing token usage, consolidating references, checking production readiness, or applying the 80% rule. Takes imperfect existing skills and elevates them to quality standards./skill-testerTest and benchmark Claude Code skills empirically using evaluation-driven development. Use when validating a skill's effectiveness, comparing skill vs. baseline performance, running benchmarks with timing/token metrics, and iterating on skill improvements. Two modes: Quick Workflow (with_skill only, no baseline, fast pass/fail) or Full Pipeline (7-phase with baseline comparison, timing, aggregation).npx claudepluginhub full-stack-biz/claude-skills-toolkit --plugin skills-toolkitOther plugins' skills for the same job