Claude Code Plugin Development
Comprehensive guidance for creating well-structured plugins, skills, hooks, agents, commands, and MCP integrations.
Core Principles (Anthropic Official)
- Composable - Multiple skills work together seamlessly, Claude coordinates automatically
- Portable - Same format works across Claude apps, Claude Code, and Claude API
- Efficient - Progressive disclosure loads only what's needed (description → SKILL.md → references)
- Powerful - Combines prompts + executable code for complete workflows
- Secure - Never hardcode secrets, use
${CLAUDE_PLUGIN_ROOT} for paths
Critical Budget Limits
| Limit |
Value |
Consequence if Exceeded |
| All skill descriptions combined |
15,000 chars |
Silent filtering, skills won't activate |
| Individual description |
1,024 chars |
Truncation |
| SKILL.md body |
5,000 words |
Context saturation, partial execution |
| Target per description |
300-400 chars |
Allows ~40 skills safely |
Quick Start
Create a New Plugin
mkdir -p my-plugin/.claude-plugin
mkdir -p my-plugin/skills/my-skill/references
cat > my-plugin/.claude-plugin/plugin.json << 'PLUGIN'
{
"name": "my-plugin",
"version": "1.0.0",
"description": "What this plugin does"
}
PLUGIN
cat > my-plugin/skills/my-skill/SKILL.md << 'SKILL'
---
name: my-skill
description: Use when creating X, configuring Y, or analyzing Z
---
# My Skill
Instructions for Claude when this skill activates...
SKILL
Install and Test
# Symlink to Claude's plugin directory
ln -s $(pwd)/my-plugin ~/.claude/plugins/my-plugin
# Restart Claude Code to load
/restart
# Test the skill
/my-plugin:my-skill
Component Reference
Choose a topic for detailed guidance:
📁 @references/structure.md - Plugin Directory Structure
- Standard plugin layout
- Marketplace vs standalone patterns
- Auto-discovery rules
- Portable path references (
${CLAUDE_PLUGIN_ROOT})
- Common troubleshooting
🎯 @references/skills-reference.md - Creating Skills
- SKILL.md format and frontmatter
- Progressive disclosure patterns
- Bundled resources (scripts/, references/, assets/)
- Description best practices with trigger phrases
- Writing style (imperative, not second person)
- Validation checklist
💬 @references/commands-reference.md - Slash Commands
- Command file format with frontmatter
- Dynamic arguments (
$1, $2, @$1)
- Bash execution inline
- Tool restrictions (allowed-tools)
- Organization (flat vs namespaced)
- Plugin command portability
🤖 @references/agents-reference.md - Subagents
- Agent frontmatter (name, description, model, color, tools)
- Name validation rules
- Description with examples
- Color guidelines by purpose
- Tool restriction patterns
- System prompt best practices
🎣 @references/hooks-reference.md - Event Hooks
- Hook types (prompt-based vs command)
- Event types (PreToolUse, PostToolUse, Stop, etc.)
- Configuration (hooks.json format)
- Matchers (exact, wildcard, regex)
- Output structure and exit codes
- Security best practices
- Environment variables
🔌 @references/mcp-reference.md - MCP Integration
- MCP server configuration (.mcp.json)
- Server types (stdio, SSE, HTTP, WebSocket)
- Tool naming conventions
- Environment variable usage
- Security and testing
🏪 @references/marketplace-reference.md - Marketplaces
- Standalone vs marketplace patterns
- marketplace.json schema
- Skills array pattern
- Bundle plugin pattern
- Common mistakes to avoid
- Team configuration
📋 @references/plugin-reference.md - Plugin Manifest
- plugin.json required fields
- Optional metadata
- Custom component paths
- Installation and deployment
⚙️ @references/settings.md - Plugin Settings
- .local.md settings files
- YAML frontmatter for configuration
- Reading settings in hooks
- Best practices and gitignore
Common Patterns
Minimal Skill
---
name: simple-skill
description: Use when user asks to "do X" or "configure Y"
---
# Simple Skill
Step-by-step instructions...
1. Check if condition exists
2. Execute action
3. Verify result
For detailed patterns, see @references/advanced-patterns.md
Command with Arguments
---
description: Review code for security issues
allowed-tools: Read, Grep
argument-hint: [file] [severity]
---
Review @$1 for security issues.
Focus on severity level: $2
Use these patterns:
- SQL injection
- XSS vulnerabilities
- Hardcoded credentials
Hook with Validation
{
"hooks": {
"PreToolUse": [{
"matcher": "Write|Edit",
"hooks": [{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
"timeout": 30
}]
}]
}
}
File Organization
my-plugin/
├── .claude-plugin/
│ └── plugin.json # Manifest
├── commands/ # Slash commands
│ └── action.md
├── agents/ # Subagents
│ └── analyzer.md
├── skills/ # Skills
│ └── my-skill/
│ ├── SKILL.md # Main skill file
│ ├── references/ # Detailed docs
│ ├── scripts/ # Executable code
│ └── assets/ # Templates, images
├── hooks/
│ └── hooks.json # Event handlers
└── .mcp.json # MCP servers
Development Workflow
- Plan - Identify what your plugin should do
- Structure - Create directory layout (see @references/structure.md)
- Implement - Write skills, commands, or agents
- Configure - Add hooks or MCP servers if needed
- Test - Install and verify functionality
- Iterate - Refine based on usage
- Document - Update README and examples
Best Practices
| Practice |
Reason |
| Keep SKILL.md under 2000 words |
Move details to references/ for progressive disclosure |
| Use specific trigger phrases |
"when user asks to 'create X'" not "provides guidance" |
| Imperative writing style |
"Parse the config" not "You should parse" |
| Portable paths |
${CLAUDE_PLUGIN_ROOT} not hardcoded |
| Test after changes |
/restart then invoke skill/command |
| Single responsibility |
One focused purpose per component |
Common Mistakes
| Mistake |
Solution |
| Vague skill descriptions |
Add specific trigger phrases users would say |
| 8000-word SKILL.md |
Move content to references/, keep SKILL.md brief |
| Hardcoded paths |
Use ${CLAUDE_PLUGIN_ROOT} for portability |
| Missing frontmatter |
All components need valid YAML frontmatter |
| Wrong directory structure |
See @references/structure.md for correct layout |
Validation
Before releasing a plugin:
Related Tools
/plugin-dev:create-plugin - Interactive plugin scaffolding command
/plugin-dev:plugin-cli - CLI commands for plugin management
/skill-creator:skill-creation - Focused skill creation workflow
/agent-creator:agent-design - Subagent design patterns
/mcp-builder:mcp-servers - MCP server development
Quick Navigation:
| Need to... |
See |
| Understand plugin layout |
@references/structure.md |
| Create a skill |
@references/skills-reference.md |
| Add a slash command |
@references/commands-reference.md |
| Configure a subagent |
@references/agents-reference.md |
| Set up hooks |
@references/hooks-reference.md |
| Integrate MCP server |
@references/mcp-reference.md |
| Build a marketplace |
@references/marketplace-reference.md |
Status: Consolidated plugin development skill with progressive disclosure pattern
1---2name: plugin-dev3description: Claude Code plugin development - create plugins, skills, commands, agents, hooks, MCP servers, and marketplaces. Use when: 'create a plugin', 'add a skill', 'write a command', 'configure hooks', 'integrate MCP server', 'build marketplace', 'How do plugins work?', 'What goes in plugin.json?'4---5
6# Claude Code Plugin Development
7
8Comprehensive guidance for creating well-structured plugins, skills, hooks, agents, commands, and MCP integrations.
9
10## Core Principles (Anthropic Official)
11
121. **Composable** - Multiple skills work together seamlessly, Claude coordinates automatically
132. **Portable** - Same format works across Claude apps, Claude Code, and Claude API
143. **Efficient** - Progressive disclosure loads only what's needed (description → SKILL.md → references)
154. **Powerful** - Combines prompts + executable code for complete workflows
165. **Secure** - Never hardcode secrets, use `${CLAUDE_PLUGIN_ROOT}` for paths
17
18## Critical Budget Limits
19
20| Limit | Value | Consequence if Exceeded |
21|-------|-------|------------------------|
22| All skill descriptions combined | 15,000 chars | Silent filtering, skills won't activate |
23| Individual description | 1,024 chars | Truncation |
24| SKILL.md body | 5,000 words | Context saturation, partial execution |
25| Target per description | 300-400 chars | Allows ~40 skills safely |
26
27## Quick Start
28
29### Create a New Plugin
30
31```bash
32mkdir -p my-plugin/.claude-plugin
33mkdir -p my-plugin/skills/my-skill/references
34
35cat > my-plugin/.claude-plugin/plugin.json << 'PLUGIN'
36{
37 "name": "my-plugin",
38 "version": "1.0.0",
39 "description": "What this plugin does"
40}
41PLUGIN
42
43cat > my-plugin/skills/my-skill/SKILL.md << 'SKILL'
44---
45name: my-skill
46description: Use when creating X, configuring Y, or analyzing Z
47---
48
49# My Skill
50
51Instructions for Claude when this skill activates...
52SKILL
53```
54
55### Install and Test
56
57```bash
58# Symlink to Claude's plugin directory
59ln -s $(pwd)/my-plugin ~/.claude/plugins/my-plugin
60
61# Restart Claude Code to load
62/restart
63
64# Test the skill
65/my-plugin:my-skill
66```
67
68## Component Reference
69
70Choose a topic for detailed guidance:
71
72### 📁 **@references/structure.md** - Plugin Directory Structure
73- Standard plugin layout
74- Marketplace vs standalone patterns
75- Auto-discovery rules
76- Portable path references (`${CLAUDE_PLUGIN_ROOT}`)
77- Common troubleshooting
78
79### 🎯 **@references/skills-reference.md** - Creating Skills
80- SKILL.md format and frontmatter
81- Progressive disclosure patterns
82- Bundled resources (scripts/, references/, assets/)
83- Description best practices with trigger phrases
84- Writing style (imperative, not second person)
85- Validation checklist
86
87### 💬 **@references/commands-reference.md** - Slash Commands
88- Command file format with frontmatter
89- Dynamic arguments (`$1`, `$2`, `@$1`)
90- Bash execution inline
91- Tool restrictions (allowed-tools)
92- Organization (flat vs namespaced)
93- Plugin command portability
94
95### 🤖 **@references/agents-reference.md** - Subagents
96- Agent frontmatter (name, description, model, color, tools)
97- Name validation rules
98- Description with examples
99- Color guidelines by purpose
100- Tool restriction patterns
101- System prompt best practices
102
103### 🎣 **@references/hooks-reference.md** - Event Hooks
104- Hook types (prompt-based vs command)
105- Event types (PreToolUse, PostToolUse, Stop, etc.)
106- Configuration (hooks.json format)
107- Matchers (exact, wildcard, regex)
108- Output structure and exit codes
109- Security best practices
110- Environment variables
111
112### 🔌 **@references/mcp-reference.md** - MCP Integration
113- MCP server configuration (.mcp.json)
114- Server types (stdio, SSE, HTTP, WebSocket)
115- Tool naming conventions
116- Environment variable usage
117- Security and testing
118
119### 🏪 **@references/marketplace-reference.md** - Marketplaces
120- Standalone vs marketplace patterns
121- marketplace.json schema
122- Skills array pattern
123- Bundle plugin pattern
124- Common mistakes to avoid
125- Team configuration
126
127### 📋 **@references/plugin-reference.md** - Plugin Manifest
128- plugin.json required fields
129- Optional metadata
130- Custom component paths
131- Installation and deployment
132
133### ⚙️ **@references/settings.md** - Plugin Settings
134- .local.md settings files
135- YAML frontmatter for configuration
136- Reading settings in hooks
137- Best practices and gitignore
138
139## Common Patterns
140
141### Minimal Skill
142
143```yaml
144---
145name: simple-skill
146description: Use when user asks to "do X" or "configure Y"
147---
148
149# Simple Skill
150
151Step-by-step instructions...
152
1531. Check if condition exists
1542. Execute action
1553. Verify result
156
157For detailed patterns, see @references/advanced-patterns.md
158```
159
160### Command with Arguments
161
162```markdown
163---
164description: Review code for security issues
165allowed-tools: Read, Grep
166argument-hint: [file] [severity]
167---
168
169Review @$1 for security issues.
170Focus on severity level: $2
171
172Use these patterns:
173- SQL injection
174- XSS vulnerabilities
175- Hardcoded credentials
176```
177
178### Hook with Validation
179
180```json
181{
182 "hooks": {
183 "PreToolUse": [{
184 "matcher": "Write|Edit",
185 "hooks": [{
186 "type": "command",
187 "command": "bash ${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh",
188 "timeout": 30
189 }]
190 }]
191 }
192}
193```
194
195## File Organization
196
197```
198my-plugin/
199├── .claude-plugin/
200│ └── plugin.json # Manifest
201├── commands/ # Slash commands
202│ └── action.md
203├── agents/ # Subagents
204│ └── analyzer.md
205├── skills/ # Skills
206│ └── my-skill/
207│ ├── SKILL.md # Main skill file
208│ ├── references/ # Detailed docs
209│ ├── scripts/ # Executable code
210│ └── assets/ # Templates, images
211├── hooks/
212│ └── hooks.json # Event handlers
213└── .mcp.json # MCP servers
214```
215
216## Development Workflow
217
2181. **Plan** - Identify what your plugin should do
2192. **Structure** - Create directory layout (see @references/structure.md)
2203. **Implement** - Write skills, commands, or agents
2214. **Configure** - Add hooks or MCP servers if needed
2225. **Test** - Install and verify functionality
2236. **Iterate** - Refine based on usage
2247. **Document** - Update README and examples
225
226## Best Practices
227
228| Practice | Reason |
229|----------|--------|
230| Keep SKILL.md under 2000 words | Move details to references/ for progressive disclosure |
231| Use specific trigger phrases | "when user asks to 'create X'" not "provides guidance" |
232| Imperative writing style | "Parse the config" not "You should parse" |
233| Portable paths | `${CLAUDE_PLUGIN_ROOT}` not hardcoded |
234| Test after changes | `/restart` then invoke skill/command |
235| Single responsibility | One focused purpose per component |
236
237## Common Mistakes
238
239| Mistake | Solution |
240|---------|---------|
241| Vague skill descriptions | Add specific trigger phrases users would say |
242| 8000-word SKILL.md | Move content to references/, keep SKILL.md brief |
243| Hardcoded paths | Use `${CLAUDE_PLUGIN_ROOT}` for portability |
244| Missing frontmatter | All components need valid YAML frontmatter |
245| Wrong directory structure | See @references/structure.md for correct layout |
246
247## Validation
248
249Before releasing a plugin:
250
251- [ ] plugin.json has required `name` field
252- [ ] All SKILL.md files have `name` and `description`
253- [ ] Descriptions include specific trigger phrases
254- [ ] All referenced files exist
255- [ ] No hardcoded paths (use `${CLAUDE_PLUGIN_ROOT}`)
256- [ ] Skills under 2000 words (details in references/)
257- [ ] Commands have `argument-hint` if they take args
258- [ ] Agents have valid name (3-50 chars, lowercase-hyphens)
259- [ ] Hooks return valid JSON with proper exit codes
260- [ ] README documents installation and usage
261
262## Related Tools
263
264- `/plugin-dev:create-plugin` - Interactive plugin scaffolding command
265- `/plugin-dev:plugin-cli` - CLI commands for plugin management
266- `/skill-creator:skill-creation` - Focused skill creation workflow
267- `/agent-creator:agent-design` - Subagent design patterns
268- `/mcp-builder:mcp-servers` - MCP server development
269
270---
271
272**Quick Navigation:**
273
274| Need to... | See |
275|-----------|-----|
276| Understand plugin layout | @references/structure.md |
277| Create a skill | @references/skills-reference.md |
278| Add a slash command | @references/commands-reference.md |
279| Configure a subagent | @references/agents-reference.md |
280| Set up hooks | @references/hooks-reference.md |
281| Integrate MCP server | @references/mcp-reference.md |
282| Build a marketplace | @references/marketplace-reference.md |
283
284**Status:** Consolidated plugin development skill with progressive disclosure pattern