Developing Claude Code Plugins
Overview
This skill provides efficient workflows for creating Claude Code plugins. Use it to make plugin development fast and correct - it synthesizes official docs into actionable steps and provides working examples.
When to Use
Use this skill when:
- Creating a new Claude Code plugin from scratch
- Adding components to an existing plugin (skills, commands, hooks, MCP servers)
- Setting up a development marketplace for testing
- Troubleshooting plugin structure issues
- Understanding plugin architecture and patterns
- Releasing a plugin (versioning, tagging, marketplace distribution)
- Publishing updates or maintaining existing plugins
For comprehensive official documentation, use the working-with-claude-code skill to access full docs.
Quick Reference
| Need to... |
Read This |
Official Docs |
| Understand directory structure |
references/plugin-structure.md |
plugins.md |
| Choose a plugin pattern |
references/common-patterns.md |
plugins.md |
| Debug plugin issues |
references/troubleshooting.md |
Various |
| See working examples |
examples/ directory |
N/A |
Plugin Development Workflow
Phase 1: Plan
Before writing code:
Define your plugin's purpose
- What problem does it solve?
- Who will use it?
- What components will it need?
Choose your pattern (read references/common-patterns.md)
- Simple plugin with one skill?
- MCP integration with guidance?
- Command collection?
- Full-featured platform?
Review examples
examples/simple-greeter-plugin/ - Minimal plugin
examples/full-featured-plugin/ - All components
- Installed plugins in
~/.claude/plugins/
Phase 2: Create Structure
Create directories (see references/plugin-structure.md for details):
mkdir -p my-plugin/.claude-plugin
mkdir -p my-plugin/skills
# Add other component directories as needed
Write plugin.json (required):
{
"name": "my-plugin",
"version": "1.0.0",
"description": "What your plugin does",
"author": {"name": "Your Name"}
}
See references/plugin-structure.md for complete format.
Create development marketplace (for local testing):
Create .claude-plugin/marketplace.json:
{
"name": "my-dev",
"plugins": [{
"name": "my-plugin",
"source": "./"
}]
}
See references/plugin-structure.md for complete format.
Phase 3: Add Components
Use TodoWrite to track component creation:
Example:
- Create skill: main-workflow
- Add command: /hello
- Configure hooks
- Write README
- Test installation
For each component type, see:
- Format/syntax:
references/plugin-structure.md
- When to use:
references/common-patterns.md
- Working code:
examples/ directory
Phase 4: Test Locally
Install for testing:
/plugin marketplace add /path/to/my-plugin
/plugin install my-plugin@my-dev
Then restart Claude Code.
Test each component:
- Skills: Ask for tasks matching skill descriptions
- Commands: Run
/your-command
- MCP servers: Check tools are available
- Hooks: Trigger relevant events
Iterate:
/plugin uninstall my-plugin@my-dev
# Make changes
/plugin install my-plugin@my-dev
# Restart Claude Code
Phase 5: Debug and Refine
If something doesn't work, read references/troubleshooting.md for:
- Plugin not loading
- Skill not triggering
- Command not appearing
- MCP server not starting
- Hooks not firing
Common issues are usually:
- Wrong directory structure
- Hardcoded paths (use
${CLAUDE_PLUGIN_ROOT})
- Forgot to restart Claude Code
- Missing executable permissions on scripts
Phase 6: Release and Distribute
Write README with:
- What the plugin does
- Installation instructions
- Usage examples
- Component descriptions
Version your release using semantic versioning:
- Update
version in .claude-plugin/plugin.json
- Document changes in CHANGELOG.md or RELEASE-NOTES.md
- Example:
"version": "1.2.1" (major.minor.patch)
Commit and tag your release:
git add .
git commit -m "Release v1.2.1: [brief description]"
git tag v1.2.1
git push origin main
git push origin v1.2.1
Choose distribution method:
Option A: Direct GitHub distribution
- Users add:
/plugin marketplace add your-org/your-plugin-repo
- Your plugin.json serves as the manifest
Option B: Marketplace distribution (recommended for multi-plugin collections)
- Create separate marketplace repository
- Add
.claude-plugin/marketplace.json with plugin references:{
"name": "my-marketplace",
"owner": {"name": "Your Name"},
"plugins": [{
"name": "your-plugin",
"source": {
"source": "url",
"url": "https://github.com/your-org/your-plugin.git"
},
"version": "1.2.1",
"description": "Plugin description"
}]
}
- Users add:
/plugin marketplace add your-org/your-marketplace
- Update marketplace manifest for each plugin release
Option C: Private/team distribution
Test the release:
# Test fresh installation
/plugin marketplace add your-marketplace-source
/plugin install your-plugin@marketplace-name
# Verify functionality, then clean up
/plugin uninstall your-plugin@marketplace-name
Announce and maintain:
- GitHub releases (optional)
- Team notifications
- Monitor for issues and user feedback
- Plan maintenance updates
Critical Rules
Always follow these (from references/plugin-structure.md):
.claude-plugin/ contains ONLY manifests (plugin.json and optionally marketplace.json)
- ❌ Don't put skills, commands, or other components inside
- ✅ Put them at plugin root
Use ${CLAUDE_PLUGIN_ROOT} for all paths in config files
- Makes plugin portable across systems
- Required for hooks, MCP servers, scripts
Use relative paths in plugin.json
- Start with
./
- Relative to plugin root
Make scripts executable
chmod +x script.sh
- Required for hooks and MCP servers
Resources in This Skill
references/plugin-structure.md - Directory layout, file formats, component syntax
references/common-patterns.md - When to use each plugin pattern, examples
references/troubleshooting.md - Debug guide for common issues
examples/simple-greeter-plugin/ - Minimal working plugin (one skill)
examples/full-featured-plugin/ - Complete plugin with all components
Cross-References
For deep dives into official documentation, use the working-with-claude-code skill to access:
plugins.md - Plugin development overview
plugins-reference.md - Complete API reference
skills.md - Skill authoring guide
slash-commands.md - Command format
hooks.md, hooks-guide.md - Hook system
mcp.md - MCP server integration
plugin-marketplaces.md - Distribution
Best Practices
- Start simple - Begin with minimal structure, add complexity when needed
- Test frequently - Install → test → uninstall → modify → repeat
- Use examples - Copy patterns from working plugins
- Follow conventions - Match style of existing plugins
- Document everything - Clear README helps users and future you
- Version properly - Use semantic versioning (major.minor.patch)
Workflow Summary
Plan → Choose pattern, review examples
Create → Make structure, write manifests
Add → Build components (skills, commands, etc.)
Test → Install via dev marketplace
Debug → Use troubleshooting guide
Release → Version, tag, distribute via marketplace
Maintain → Monitor, update, support users
The correct path is the fast path. Use references, follow patterns, test frequently.
1---2name: developing-claude-code-plugins3description: Use when working on Claude Code plugins (creating, modifying, testing, releasing, or maintaining) - provides streamlined workflows, patterns, and examples for the complete plugin lifecycle4---5
6# Developing Claude Code Plugins
7
8## Overview
9
10This skill provides efficient workflows for creating Claude Code plugins. Use it to make plugin development fast and correct - it synthesizes official docs into actionable steps and provides working examples.
11
12## When to Use
13
14Use this skill when:
15- Creating a new Claude Code plugin from scratch
16- Adding components to an existing plugin (skills, commands, hooks, MCP servers)
17- Setting up a development marketplace for testing
18- Troubleshooting plugin structure issues
19- Understanding plugin architecture and patterns
20- Releasing a plugin (versioning, tagging, marketplace distribution)
21- Publishing updates or maintaining existing plugins
22
23**For comprehensive official documentation**, use the `working-with-claude-code` skill to access full docs.
24
25## Quick Reference
26
27| Need to... | Read This | Official Docs |
28|-----------|-----------|---------------|
29| Understand directory structure | `references/plugin-structure.md` | `plugins.md` |
30| Choose a plugin pattern | `references/common-patterns.md` | `plugins.md` |
31| Debug plugin issues | `references/troubleshooting.md` | Various |
32| See working examples | `examples/` directory | N/A |
33
34## Plugin Development Workflow
35
36### Phase 1: Plan
37
38Before writing code:
39
401. **Define your plugin's purpose**
41 - What problem does it solve?
42 - Who will use it?
43 - What components will it need?
44
452. **Choose your pattern** (read `references/common-patterns.md`)
46 - Simple plugin with one skill?
47 - MCP integration with guidance?
48 - Command collection?
49 - Full-featured platform?
50
513. **Review examples**
52 - `examples/simple-greeter-plugin/` - Minimal plugin
53 - `examples/full-featured-plugin/` - All components
54 - Installed plugins in `~/.claude/plugins/`
55
56### Phase 2: Create Structure
57
581. **Create directories** (see `references/plugin-structure.md` for details):
59 ```bash
60 mkdir -p my-plugin/.claude-plugin
61 mkdir -p my-plugin/skills
62 # Add other component directories as needed
63 ```
64
652. **Write plugin.json** (required):
66 ```json
67 {
68 "name": "my-plugin",
69 "version": "1.0.0",
70 "description": "What your plugin does",
71 "author": {"name": "Your Name"}
72 }
73 ```
74 See `references/plugin-structure.md` for complete format.
75
763. **Create development marketplace** (for local testing):
77
78 Create `.claude-plugin/marketplace.json`:
79 ```json
80 {
81 "name": "my-dev",
82 "plugins": [{
83 "name": "my-plugin",
84 "source": "./"
85 }]
86 }
87 ```
88
89 See `references/plugin-structure.md` for complete format.
90
91### Phase 3: Add Components
92
93Use TodoWrite to track component creation:
94
95**Example:**
96```
97- Create skill: main-workflow
98- Add command: /hello
99- Configure hooks
100- Write README
101- Test installation
102```
103
104For each component type, see:
105- **Format/syntax**: `references/plugin-structure.md`
106- **When to use**: `references/common-patterns.md`
107- **Working code**: `examples/` directory
108
109### Phase 4: Test Locally
110
1111. **Install for testing**:
112 ```bash
113 /plugin marketplace add /path/to/my-plugin
114 /plugin install my-plugin@my-dev
115 ```
116 Then restart Claude Code.
117
1182. **Test each component**:
119 - Skills: Ask for tasks matching skill descriptions
120 - Commands: Run `/your-command`
121 - MCP servers: Check tools are available
122 - Hooks: Trigger relevant events
123
1243. **Iterate**:
125 ```bash
126 /plugin uninstall my-plugin@my-dev
127 # Make changes
128 /plugin install my-plugin@my-dev
129 # Restart Claude Code
130 ```
131
132### Phase 5: Debug and Refine
133
134If something doesn't work, read `references/troubleshooting.md` for:
135- Plugin not loading
136- Skill not triggering
137- Command not appearing
138- MCP server not starting
139- Hooks not firing
140
141Common issues are usually:
142- Wrong directory structure
143- Hardcoded paths (use `${CLAUDE_PLUGIN_ROOT}`)
144- Forgot to restart Claude Code
145- Missing executable permissions on scripts
146
147### Phase 6: Release and Distribute
148
1491. **Write README** with:
150 - What the plugin does
151 - Installation instructions
152 - Usage examples
153 - Component descriptions
154
1552. **Version your release** using semantic versioning:
156 - Update `version` in `.claude-plugin/plugin.json`
157 - Document changes in CHANGELOG.md or RELEASE-NOTES.md
158 - Example: `"version": "1.2.1"` (major.minor.patch)
159
1603. **Commit and tag your release**:
161 ```bash
162 git add .
163 git commit -m "Release v1.2.1: [brief description]"
164 git tag v1.2.1
165 git push origin main
166 git push origin v1.2.1
167 ```
168
1694. **Choose distribution method**:
170
171 **Option A: Direct GitHub distribution**
172 - Users add: `/plugin marketplace add your-org/your-plugin-repo`
173 - Your plugin.json serves as the manifest
174
175 **Option B: Marketplace distribution** (recommended for multi-plugin collections)
176 - Create separate marketplace repository
177 - Add `.claude-plugin/marketplace.json` with plugin references:
178 ```json
179 {
180 "name": "my-marketplace",
181 "owner": {"name": "Your Name"},
182 "plugins": [{
183 "name": "your-plugin",
184 "source": {
185 "source": "url",
186 "url": "https://github.com/your-org/your-plugin.git"
187 },
188 "version": "1.2.1",
189 "description": "Plugin description"
190 }]
191 }
192 ```
193 - Users add: `/plugin marketplace add your-org/your-marketplace`
194 - Update marketplace manifest for each plugin release
195
196 **Option C: Private/team distribution**
197 - Configure in team's `.claude/settings.json`:
198 ```json
199 {
200 "extraKnownMarketplaces": {
201 "team-tools": {
202 "source": {"source": "github", "repo": "your-org/plugins"}
203 }
204 }
205 }
206 ```
207
2085. **Test the release**:
209 ```bash
210 # Test fresh installation
211 /plugin marketplace add your-marketplace-source
212 /plugin install your-plugin@marketplace-name
213 # Verify functionality, then clean up
214 /plugin uninstall your-plugin@marketplace-name
215 ```
216
2176. **Announce and maintain**:
218 - GitHub releases (optional)
219 - Team notifications
220 - Monitor for issues and user feedback
221 - Plan maintenance updates
222
223## Critical Rules
224
225**Always follow these** (from `references/plugin-structure.md`):
226
2271. **`.claude-plugin/` contains ONLY manifests** (`plugin.json` and optionally `marketplace.json`)
228 - ❌ Don't put skills, commands, or other components inside
229 - ✅ Put them at plugin root
230
2312. **Use `${CLAUDE_PLUGIN_ROOT}` for all paths in config files**
232 - Makes plugin portable across systems
233 - Required for hooks, MCP servers, scripts
234
2353. **Use relative paths in `plugin.json`**
236 - Start with `./`
237 - Relative to plugin root
238
2394. **Make scripts executable**
240 - `chmod +x script.sh`
241 - Required for hooks and MCP servers
242
243## Resources in This Skill
244
245- **`references/plugin-structure.md`** - Directory layout, file formats, component syntax
246- **`references/common-patterns.md`** - When to use each plugin pattern, examples
247- **`references/troubleshooting.md`** - Debug guide for common issues
248- **`examples/simple-greeter-plugin/`** - Minimal working plugin (one skill)
249- **`examples/full-featured-plugin/`** - Complete plugin with all components
250
251## Cross-References
252
253For deep dives into official documentation, use the `working-with-claude-code` skill to access:
254- `plugins.md` - Plugin development overview
255- `plugins-reference.md` - Complete API reference
256- `skills.md` - Skill authoring guide
257- `slash-commands.md` - Command format
258- `hooks.md`, `hooks-guide.md` - Hook system
259- `mcp.md` - MCP server integration
260- `plugin-marketplaces.md` - Distribution
261
262## Best Practices
263
2641. **Start simple** - Begin with minimal structure, add complexity when needed
2652. **Test frequently** - Install → test → uninstall → modify → repeat
2663. **Use examples** - Copy patterns from working plugins
2674. **Follow conventions** - Match style of existing plugins
2685. **Document everything** - Clear README helps users and future you
2696. **Version properly** - Use semantic versioning (major.minor.patch)
270
271## Workflow Summary
272
273```
274Plan → Choose pattern, review examples
275Create → Make structure, write manifests
276Add → Build components (skills, commands, etc.)
277Test → Install via dev marketplace
278Debug → Use troubleshooting guide
279Release → Version, tag, distribute via marketplace
280Maintain → Monitor, update, support users
281```
282
283**The correct path is the fast path.** Use references, follow patterns, test frequently.