name: plugin-creation
version: 3.0.0
description: Use when creating Claude Code plugins - covers skills, commands, agents, hooks, MCP servers, and plugin configuration. Use when user says "create plugin", "make a skill", "add command", "add hooks", "skill authoring", "SKILL.md", "plugin components", "package reusable behavior", "distribute skills", "scaffold plugin", "plugin structure", "write a skill description". NOT for: using existing plugins, installing plugins, plugin marketplace browsing. !ls .claude-plugin/ 2>/dev/null
Plugin Creation
Create complete Claude Code plugins with any combination of components.
When to Use
- "Create a plugin" / "Make a new plugin"
- "Add a skill" / "Create command" / "Make agent"
- "Add hooks" / "Setup MCP server"
- "Configure settings" / "Setup output directory"
- "Package for marketplace"
- NOT for: Using existing plugins (see /plugin command)
Quick Reference
| Component |
Location |
Invocation |
Best For |
| Skills |
skills/name/SKILL.md |
Model-invoked (auto) |
Complex workflows with resources |
| Commands |
commands/name.md |
User (/command) |
Quick, frequently used prompts |
| Agents |
agents/name.md |
Auto + Manual |
Task-specific expertise |
| Hooks |
hooks/hooks.json |
Event-triggered |
Automation and validation |
| MCP |
.mcp.json |
Auto startup |
External tool integration |
Before Creating
- Read
references/01-overview/component-comparison.md to decide which components needed
- Determine if this should be a new plugin or add to existing
Plugin Project Setup
When creating any plugin, also consider:
.claude/rules/ with modular project rules (path-scoped if needed for different component directories)
CLAUDE.md at plugin root for project conventions
- README.md and CHANGELOG.md at plugin root (for humans — never inside skill directories)
Documentation Principles
All plugin documentation should follow lean principles:
- Current truth only — no historical narratives or "previously we did X"
- Replace, don't append — superseded content gets replaced entirely
- Delete what's irrelevant — every edit is a chance to prune
- Read
references/02-philosophy/core-philosophy.md for full philosophy
Plugin Initialization
When user says "create plugin", "initialize plugin", "new plugin":
Option A - Use init script:
python scripts/init_plugin.py my-plugin --path ./plugins --components skill,command,hook
Option B - Manual creation:
Create plugin directory structure:
plugin-name/
├── .claude-plugin/
│ └── plugin.json
├── commands/ # if needed
├── agents/ # if needed
├── skills/ # if needed
│ └── skill-name/
│ └── SKILL.md
├── hooks/ # if needed
│ └── hooks.json
└── .mcp.json # if needed
Copy template from templates/plugin.json.template
Ask user which components they need
Creating Skills
When user says "add skill", "create skill", "make skill":
- Read
references/03-skills/writing-skillmd.md for structure
- Copy template from
templates/skill/SKILL.md.template
- Key requirements:
- Name: lowercase, hyphens, max 64 chars
- Description: WHAT it does + WHEN to use it, max 1024 chars, third person
- Body: imperative instructions, under 500 lines
- Use progressive disclosure - reference files for details
Critical: SKILL.md files are INSTRUCTIONS for Claude, not documentation. Write imperatives telling Claude what to do.
| Documentation (WRONG) |
Instructions (CORRECT) |
| "This skill helps with PDF processing" |
"Process PDF files using this workflow" |
| "The description field is important" |
"Write the description starting with 'Use when...'" |
Consider these optional frontmatter fields:
model: haiku for simple lookup/formatting skills, opus for complex reasoning
context: fork with agent: <type> for heavy operations that would pollute main context
disable-model-invocation: true for command-only skills (no auto-trigger)
user-invocable: false to hide from / menu (Claude can still invoke via Skill tool)
Dynamic context injection: Use !`command` in the skill body to inject runtime state (git status, file contents, etc.) when the skill loads.
Extended thinking: Include "ultrathink" in the skill body for tasks requiring deep reasoning.
Creating Commands
When user says "add command", "create command", "slash command":
- Read
references/04-commands/writing-commands.md
- Copy template from
templates/command/command.md.template
- Key requirements:
- Frontmatter: description, allowed-tools, argument-hint
- Support
$ARGUMENTS, $1, $2 for arguments
- Prefix lines with exclamation mark for bash execution
- Prefix lines with at-sign for file references
Creating Agents
When user says "add agent", "create agent", "make agent":
- Read
references/05-agents/writing-agents.md
- Copy template from
templates/agent/agent.md.template
- Key requirements:
- Frontmatter: name, description, tools, model, permissionMode
- Description should include "Use proactively" for auto-delegation
- One agent = one clear responsibility
Consider these agent-specific features:
memory: project for agents that benefit from cross-session learning (architecture decisions, code review patterns)
memory: user for personal preferences that carry across projects
model: matched to task complexity — haiku for lookup/formatting, sonnet for balanced tasks, opus for complex reasoning
tools restriction to minimum needed (reduces cost and attack surface)
disallowedTools to block specific tools (e.g., Edit, Write for read-only agents)
hooks in agent frontmatter for scoped validation (runs only when that agent is active)
Agent teams: For tasks benefiting from multiple perspectives or parallel research, consider agent teams (competing perspectives, hypothesis investigation, parallel tasks). See references/05-agents/agent-patterns.md for team patterns. Requires CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.
Creating Hooks
When user says "add hooks", "setup hooks", "event handlers":
- Read
references/06-hooks/writing-hooks.md
- Read
references/06-hooks/hook-events.md for all 18 events
- Copy template from
templates/hooks/hooks.json.template
- Key events:
PreToolUse - before tool execution (can block)
PostToolUse - after tool execution (formatting, logging)
SessionStart - setup, output directories
SessionEnd - cleanup
UserPromptSubmit - validation, context injection (can block)
SubagentStart/SubagentStop - agent lifecycle
PreCompact - inject context before compaction
Notification, Stop, TaskCompleted, TeammateIdle
Three handler types — choose the right one:
command — shell script, fastest, no LLM cost. Use for logging, file ops, env setup.
prompt — single-turn LLM evaluation, zero script overhead. Use for lightweight validation.
agent — multi-turn subagent with tools (Read, Grep, Glob). Use for complex verification.
Async execution: Add "async": true on command hooks for background operations (logging, analytics) that shouldn't block the main flow.
MCP tool matching: Use mcp__<server>__<tool> pattern in matchers for PreToolUse/PostToolUse.
Configuring Plugin
When user says "configure plugin", "setup plugin.json":
- Read
references/08-configuration/plugin-json.md for full schema
- Required fields:
name
- Recommended fields:
version, description, author, license
- Component paths:
commands, agents, hooks, mcpServers
Settings and Output
When user says "configure settings", "setup output", "output directory":
- Read
references/08-configuration/settings.md for settings hierarchy
- Read
references/08-configuration/output-config.md for output patterns
- Key environment variables:
${CLAUDE_PLUGIN_ROOT} - plugin installation directory
${CLAUDE_PROJECT_DIR} - project root
${CLAUDE_ENV_FILE} - persistent env vars (SessionStart only)
- Use SessionStart hook to create output directories
Testing Plugin
When user says "test plugin", "validate plugin":
- Read
references/09-testing/testing.md
- Run
claude --debug to see plugin loading
- Validate plugin.json syntax
- Test each component:
- Skills: Ask questions matching description
- Commands: Run
/command-name
- Agents: Check
/agents listing
- Hooks: Trigger events manually
Packaging for Marketplace
When user says "package plugin", "publish plugin", "marketplace":
- Read
references/10-distribution/packaging.md
- Create
marketplace.json in repository root
- Update README with installation instructions
- Version using semantic versioning (MAJOR.MINOR.PATCH)
Decision Framework
Before creating a component, verify it's the right choice:
| Component |
Use When |
| Skill |
Complex workflow, needs resources, auto-triggered by context |
| Command |
User should trigger explicitly, quick one-off prompts |
| Agent |
Specialized expertise, own context window, proactive delegation |
| Hook |
Event-based automation, validation, logging |
| MCP |
External API/service, custom tools, database access |
The 5-10 Rule: Done 5+ times? Will do 10+ more? Create a skill or command.
References
Overview
references/01-overview/what-are-plugins.md - Plugin overview
references/01-overview/what-are-skills.md - Skills overview
references/01-overview/what-are-commands.md - Commands overview
references/01-overview/what-are-agents.md - Agents overview
references/01-overview/what-are-hooks.md - Hooks overview
references/01-overview/what-are-mcp.md - MCP overview
references/01-overview/component-comparison.md - When to use what
Philosophy
references/02-philosophy/core-philosophy.md - Design principles
references/02-philosophy/decision-frameworks.md - Decision trees
references/02-philosophy/anti-patterns.md - What to avoid
Components
references/03-skills/anthropic-skill-standards.md - Official Anthropic skill standards and checklist
references/03-skills/skill-patterns.md - Five skill patterns (Sequential, Multi-MCP, Iterative, Context-Aware, Domain-Specific)
references/03-skills/ - Skill creation guides
references/04-commands/ - Command creation guides
references/05-agents/ - Agent creation guides
references/06-hooks/ - Hook creation guides
references/06-hooks/cross-platform-hooks.md - Windows/macOS/Linux support
references/07-mcp/ - MCP overview
Configuration
references/08-configuration/plugin-json.md - Plugin manifest
references/08-configuration/marketplace-json.md - Marketplace config
references/08-configuration/settings.md - Settings hierarchy
references/08-configuration/output-config.md - Output configuration
Testing & Distribution
references/09-testing/testing.md - Testing guide (all components)
references/09-testing/debugging.md - Debugging guide
references/09-testing/cli-reference.md - CLI commands reference
references/10-distribution/packaging.md - Packaging guide
references/10-distribution/marketplace.md - Marketplace guide
references/10-distribution/versioning.md - Version strategy
references/10-distribution/complete-examples.md - Full plugin examples
Examples
Working example plugins in examples/:
examples/simple-greeter-plugin/ - Minimal plugin with one skill
examples/full-featured-plugin/ - Complete plugin with skill, commands, hooks
Templates
All templates are in the templates/ directory:
templates/skill/SKILL.md.template
templates/command/command.md.template
templates/agent/agent.md.template
templates/hooks/hooks.json.template
templates/hooks/run-hook.cmd.template - Cross-platform hook wrapper
templates/plugin.json.template
templates/marketplace.json.template
templates/settings.json.template
templates/mcp.json.template
Scripts
scripts/init_plugin.py - Initialize new plugin with selected components
scripts/init_skill.py - Initialize standalone skill
scripts/validate_skill.py - Validate skill structure
scripts/package_skill.py - Package skill for distribution
1---2name: plugin-creation3description: Create complete Claude Code plugins with any combination of components.4---5
6---
7name: plugin-creation
8version: 3.0.0
9description: Use when creating Claude Code plugins - covers skills, commands, agents, hooks, MCP servers, and plugin configuration. Use when user says "create plugin", "make a skill", "add command", "add hooks", "skill authoring", "SKILL.md", "plugin components", "package reusable behavior", "distribute skills", "scaffold plugin", "plugin structure", "write a skill description". NOT for: using existing plugins, installing plugins, plugin marketplace browsing. !`ls .claude-plugin/ 2>/dev/null`
10---
11
12# Plugin Creation
13
14Create complete Claude Code plugins with any combination of components.
15
16## When to Use
17
18- "Create a plugin" / "Make a new plugin"
19- "Add a skill" / "Create command" / "Make agent"
20- "Add hooks" / "Setup MCP server"
21- "Configure settings" / "Setup output directory"
22- "Package for marketplace"
23- NOT for: Using existing plugins (see /plugin command)
24
25## Quick Reference
26
27| Component | Location | Invocation | Best For |
28|-----------|----------|------------|----------|
29| Skills | `skills/name/SKILL.md` | Model-invoked (auto) | Complex workflows with resources |
30| Commands | `commands/name.md` | User (`/command`) | Quick, frequently used prompts |
31| Agents | `agents/name.md` | Auto + Manual | Task-specific expertise |
32| Hooks | `hooks/hooks.json` | Event-triggered | Automation and validation |
33| MCP | `.mcp.json` | Auto startup | External tool integration |
34
35## Before Creating
36
371. Read `references/01-overview/component-comparison.md` to decide which components needed
382. Determine if this should be a new plugin or add to existing
39
40## Plugin Project Setup
41
42When creating any plugin, also consider:
43- `.claude/rules/` with modular project rules (path-scoped if needed for different component directories)
44- `CLAUDE.md` at plugin root for project conventions
45- README.md and CHANGELOG.md at plugin root (for humans — never inside skill directories)
46
47## Documentation Principles
48
49All plugin documentation should follow lean principles:
50- **Current truth only** — no historical narratives or "previously we did X"
51- **Replace, don't append** — superseded content gets replaced entirely
52- **Delete what's irrelevant** — every edit is a chance to prune
53- Read `references/02-philosophy/core-philosophy.md` for full philosophy
54
55## Plugin Initialization
56
57When user says "create plugin", "initialize plugin", "new plugin":
58
59**Option A - Use init script**:
60```bash
61python scripts/init_plugin.py my-plugin --path ./plugins --components skill,command,hook
62```
63
64**Option B - Manual creation**:
65
661. Create plugin directory structure:
67 ```
68 plugin-name/
69 ├── .claude-plugin/
70 │ └── plugin.json
71 ├── commands/ # if needed
72 ├── agents/ # if needed
73 ├── skills/ # if needed
74 │ └── skill-name/
75 │ └── SKILL.md
76 ├── hooks/ # if needed
77 │ └── hooks.json
78 └── .mcp.json # if needed
79 ```
80
812. Copy template from `templates/plugin.json.template`
82
833. Ask user which components they need
84
85## Creating Skills
86
87When user says "add skill", "create skill", "make skill":
88
891. Read `references/03-skills/writing-skillmd.md` for structure
902. Copy template from `templates/skill/SKILL.md.template`
913. Key requirements:
92 - Name: lowercase, hyphens, max 64 chars
93 - Description: WHAT it does + WHEN to use it, max 1024 chars, third person
94 - Body: imperative instructions, under 500 lines
95 - Use progressive disclosure - reference files for details
96
97**Critical**: SKILL.md files are INSTRUCTIONS for Claude, not documentation. Write imperatives telling Claude what to do.
98
99| Documentation (WRONG) | Instructions (CORRECT) |
100|----------------------|------------------------|
101| "This skill helps with PDF processing" | "Process PDF files using this workflow" |
102| "The description field is important" | "Write the description starting with 'Use when...'" |
103
104**Consider these optional frontmatter fields:**
105- `model: haiku` for simple lookup/formatting skills, `opus` for complex reasoning
106- `context: fork` with `agent: <type>` for heavy operations that would pollute main context
107- `disable-model-invocation: true` for command-only skills (no auto-trigger)
108- `user-invocable: false` to hide from `/` menu (Claude can still invoke via Skill tool)
109
110**Dynamic context injection**: Use `` !`command` `` in the skill body to inject runtime state (git status, file contents, etc.) when the skill loads.
111
112**Extended thinking**: Include "ultrathink" in the skill body for tasks requiring deep reasoning.
113
114## Creating Commands
115
116When user says "add command", "create command", "slash command":
117
1181. Read `references/04-commands/writing-commands.md`
1192. Copy template from `templates/command/command.md.template`
1203. Key requirements:
121 - Frontmatter: description, allowed-tools, argument-hint
122 - Support `$ARGUMENTS`, `$1`, `$2` for arguments
123 - Prefix lines with exclamation mark for bash execution
124 - Prefix lines with at-sign for file references
125
126## Creating Agents
127
128When user says "add agent", "create agent", "make agent":
129
1301. Read `references/05-agents/writing-agents.md`
1312. Copy template from `templates/agent/agent.md.template`
1323. Key requirements:
133 - Frontmatter: name, description, tools, model, permissionMode
134 - Description should include "Use proactively" for auto-delegation
135 - One agent = one clear responsibility
136
137**Consider these agent-specific features:**
138- `memory: project` for agents that benefit from cross-session learning (architecture decisions, code review patterns)
139- `memory: user` for personal preferences that carry across projects
140- `model:` matched to task complexity — `haiku` for lookup/formatting, `sonnet` for balanced tasks, `opus` for complex reasoning
141- `tools` restriction to minimum needed (reduces cost and attack surface)
142- `disallowedTools` to block specific tools (e.g., `Edit`, `Write` for read-only agents)
143- `hooks` in agent frontmatter for scoped validation (runs only when that agent is active)
144
145**Agent teams**: For tasks benefiting from multiple perspectives or parallel research, consider agent teams (competing perspectives, hypothesis investigation, parallel tasks). See `references/05-agents/agent-patterns.md` for team patterns. Requires `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`.
146
147## Creating Hooks
148
149When user says "add hooks", "setup hooks", "event handlers":
150
1511. Read `references/06-hooks/writing-hooks.md`
1522. Read `references/06-hooks/hook-events.md` for all 18 events
1533. Copy template from `templates/hooks/hooks.json.template`
1544. Key events:
155 - `PreToolUse` - before tool execution (can block)
156 - `PostToolUse` - after tool execution (formatting, logging)
157 - `SessionStart` - setup, output directories
158 - `SessionEnd` - cleanup
159 - `UserPromptSubmit` - validation, context injection (can block)
160 - `SubagentStart`/`SubagentStop` - agent lifecycle
161 - `PreCompact` - inject context before compaction
162 - `Notification`, `Stop`, `TaskCompleted`, `TeammateIdle`
163
164**Three handler types** — choose the right one:
165- `command` — shell script, fastest, no LLM cost. Use for logging, file ops, env setup.
166- `prompt` — single-turn LLM evaluation, zero script overhead. Use for lightweight validation.
167- `agent` — multi-turn subagent with tools (Read, Grep, Glob). Use for complex verification.
168
169**Async execution**: Add `"async": true` on command hooks for background operations (logging, analytics) that shouldn't block the main flow.
170
171**MCP tool matching**: Use `mcp__<server>__<tool>` pattern in matchers for PreToolUse/PostToolUse.
172
173## Configuring Plugin
174
175When user says "configure plugin", "setup plugin.json":
176
1771. Read `references/08-configuration/plugin-json.md` for full schema
1782. Required fields: `name`
1793. Recommended fields: `version`, `description`, `author`, `license`
1804. Component paths: `commands`, `agents`, `hooks`, `mcpServers`
181
182## Settings and Output
183
184When user says "configure settings", "setup output", "output directory":
185
1861. Read `references/08-configuration/settings.md` for settings hierarchy
1872. Read `references/08-configuration/output-config.md` for output patterns
1883. Key environment variables:
189 - `${CLAUDE_PLUGIN_ROOT}` - plugin installation directory
190 - `${CLAUDE_PROJECT_DIR}` - project root
191 - `${CLAUDE_ENV_FILE}` - persistent env vars (SessionStart only)
1924. Use SessionStart hook to create output directories
193
194## Testing Plugin
195
196When user says "test plugin", "validate plugin":
197
1981. Read `references/09-testing/testing.md`
1992. Run `claude --debug` to see plugin loading
2003. Validate plugin.json syntax
2014. Test each component:
202 - Skills: Ask questions matching description
203 - Commands: Run `/command-name`
204 - Agents: Check `/agents` listing
205 - Hooks: Trigger events manually
206
207## Packaging for Marketplace
208
209When user says "package plugin", "publish plugin", "marketplace":
210
2111. Read `references/10-distribution/packaging.md`
2122. Create `marketplace.json` in repository root
2133. Update README with installation instructions
2144. Version using semantic versioning (MAJOR.MINOR.PATCH)
215
216## Decision Framework
217
218Before creating a component, verify it's the right choice:
219
220| Component | Use When |
221|-----------|----------|
222| Skill | Complex workflow, needs resources, auto-triggered by context |
223| Command | User should trigger explicitly, quick one-off prompts |
224| Agent | Specialized expertise, own context window, proactive delegation |
225| Hook | Event-based automation, validation, logging |
226| MCP | External API/service, custom tools, database access |
227
228**The 5-10 Rule**: Done 5+ times? Will do 10+ more? Create a skill or command.
229
230## References
231
232### Overview
233- `references/01-overview/what-are-plugins.md` - Plugin overview
234- `references/01-overview/what-are-skills.md` - Skills overview
235- `references/01-overview/what-are-commands.md` - Commands overview
236- `references/01-overview/what-are-agents.md` - Agents overview
237- `references/01-overview/what-are-hooks.md` - Hooks overview
238- `references/01-overview/what-are-mcp.md` - MCP overview
239- `references/01-overview/component-comparison.md` - When to use what
240
241### Philosophy
242- `references/02-philosophy/core-philosophy.md` - Design principles
243- `references/02-philosophy/decision-frameworks.md` - Decision trees
244- `references/02-philosophy/anti-patterns.md` - What to avoid
245
246### Components
247- `references/03-skills/anthropic-skill-standards.md` - Official Anthropic skill standards and checklist
248- `references/03-skills/skill-patterns.md` - Five skill patterns (Sequential, Multi-MCP, Iterative, Context-Aware, Domain-Specific)
249- `references/03-skills/` - Skill creation guides
250- `references/04-commands/` - Command creation guides
251- `references/05-agents/` - Agent creation guides
252- `references/06-hooks/` - Hook creation guides
253- `references/06-hooks/cross-platform-hooks.md` - Windows/macOS/Linux support
254- `references/07-mcp/` - MCP overview
255
256### Configuration
257- `references/08-configuration/plugin-json.md` - Plugin manifest
258- `references/08-configuration/marketplace-json.md` - Marketplace config
259- `references/08-configuration/settings.md` - Settings hierarchy
260- `references/08-configuration/output-config.md` - Output configuration
261
262### Testing & Distribution
263- `references/09-testing/testing.md` - Testing guide (all components)
264- `references/09-testing/debugging.md` - Debugging guide
265- `references/09-testing/cli-reference.md` - CLI commands reference
266- `references/10-distribution/packaging.md` - Packaging guide
267- `references/10-distribution/marketplace.md` - Marketplace guide
268- `references/10-distribution/versioning.md` - Version strategy
269- `references/10-distribution/complete-examples.md` - Full plugin examples
270
271## Examples
272
273Working example plugins in `examples/`:
274- `examples/simple-greeter-plugin/` - Minimal plugin with one skill
275- `examples/full-featured-plugin/` - Complete plugin with skill, commands, hooks
276
277## Templates
278
279All templates are in the `templates/` directory:
280- `templates/skill/SKILL.md.template`
281- `templates/command/command.md.template`
282- `templates/agent/agent.md.template`
283- `templates/hooks/hooks.json.template`
284- `templates/hooks/run-hook.cmd.template` - Cross-platform hook wrapper
285- `templates/plugin.json.template`
286- `templates/marketplace.json.template`
287- `templates/settings.json.template`
288- `templates/mcp.json.template`
289
290## Scripts
291
292- `scripts/init_plugin.py` - Initialize new plugin with selected components
293- `scripts/init_skill.py` - Initialize standalone skill
294- `scripts/validate_skill.py` - Validate skill structure
295- `scripts/package_skill.py` - Package skill for distribution