Claude Code Plugin Development
Guide for building Claude Code plugins with proper structure, conventions, and best practices.
Quick Start
Use the /create-plugin command for a guided 8-phase workflow:
code
/create-plugin my-plugin
This interactive workflow guides you through discovery, planning, implementation, validation, and documentation.
Plugin Structure
code
my-plugin/ ├── .claude-plugin/ │ └── plugin.json # Required: name, version, description ├── skills/ # SKILL.md in subdirectories ├── agents/ # AGENT.md files ├── commands/ # Slash command files ├── hooks/hooks.json # Event handlers ├── .mcp.json # MCP server configs ├── .local.example.md # Configuration template └── README.md
Manifest (plugin.json)
json
{
"name": "my-plugin",
"version": "1.0.0",
"description": "What this plugin does"
}
Testing
bash
claude --plugin-dir ./my-plugin
Components
| Component | Location | Purpose |
|---|---|---|
| Skills | skills/name/SKILL.md | Extend Claude's knowledge |
| Agents | agents/name/AGENT.md | Specialized subagents |
| Commands | commands/name.md | User-triggered actions |
| Hooks | hooks/hooks.json | Event automation |
| MCP | .mcp.json | External tool integration |
| Settings | .local.md | User configuration |
Focused Skills
| Topic | Skill | Purpose |
|---|---|---|
| Directory layout | /claude-plugin-dev:plugin-structure | Plugin directories |
| Creating skills | /claude-plugin-dev:skill-development | SKILL.md files |
| Creating agents | /claude-plugin-dev:agent-development | AGENT.md files |
| Creating commands | /claude-plugin-dev:command-development | Slash commands |
| Event hooks | /claude-plugin-dev:hook-development | Automation |
| MCP servers | /claude-plugin-dev:mcp-integration | External tools |
| User config | /claude-plugin-dev:plugin-settings | .local.md patterns |
Agents
| Agent | Purpose |
|---|---|
plugin-validator | Validate plugin structure and conventions |
agent-creator | Interactive agent generation |
skill-reviewer | Skill quality review |
Key Conventions
Naming
- •Plugin names: kebab-case (
my-plugin) - •Skill names: match directory name
- •Use descriptive names
Skill Descriptions (Critical)
Always use third-person with trigger phrases:
yaml
description: This skill should be used when the user asks to "create X", "configure Y", "add Z", or needs guidance on [topic].
Progressive Disclosure
- •SKILL.md: Core concepts (~1,000-1,500 words)
- •references/: Detailed documentation
- •examples/: Working code samples
Development Workflow
- •Plan: Use
/create-pluginfor guided setup - •Implement: Use focused skills for each component
- •Validate: Run
plugin-validatoragent - •Test: Use
claude --plugin-dir ./my-plugin - •Review: Use
skill-reviewerfor quality check
Reference Files
- •
references/docs-cache.md- Official documentation - •
references/conventions.md- Patterns from official plugins - •
references/examples.md- Complete plugin examples
Common Mistakes
- •Components in .claude-plugin/: Only plugin.json goes there
- •Vague descriptions: Include specific trigger phrases
- •Too much in SKILL.md: Move details to references/
- •Missing example blocks: Agents need
<example>for triggers - •Wrong hook paths: Use
${CLAUDE_PLUGIN_ROOT}