Comprehensive guide for creating Claude Code plugins with commands, agents, skills, hooks, and MCP servers. Use when users want to create, modify, or understand plugins, marketplaces, or any plugin components.
This skill provides comprehensive guidance for creating Claude Code plugins - the universal container for extending Claude Code functionality.
Plugins are the universal extension mechanism for Claude Code. A single plugin can contain any combination of:
/command-name)Key Understanding:
Plugins follow a three-level loading system:
Follow this structured process to create effective plugins:
Before creating anything, clearly understand:
Ask the user:
Based on the purpose, determine which components to include:
Use Commands when:
/command-nameUse Skills when:
Use Agents when:
Use Hooks when:
Use MCP Servers when:
Use the init_plugin.py script to scaffold the plugin:
python scripts/init_plugin.py <plugin-name> --path <output-directory>
The script creates:
plugin-name/
├── .claude-plugin/
│ └── plugin.json # Required: plugin metadata
├── commands/ # Optional: slash commands
├── agents/ # Optional: subagents
├── skills/ # Optional: Agent Skills
├── hooks/ # Optional: event handlers
│ └── hooks.json
├── .mcp.json # Optional: MCP servers
└── README.md # Documentation
Important: Only plugin.json is required. All other directories are optional - create only what you need.
Edit .claude-plugin/plugin.json:
{
"name": "plugin-name", // Required: kebab-case identifier
"version": "1.0.0", // Recommended: semantic versioning
"description": "Brief description", // Recommended
"author": { // Optional but recommended
"name": "Your Name",
"email": "you@example.com"
}
}
For complete schema, see references/Plugins reference.md.
For Commands:
See references/Slash Commands.md for complete details on:
commands/ directory For Skills: For skill creation, use the skill-creator skill from this plugin:
Use the skill-creator skill to create a new skill in this plugin
Skills go in skills/skill-name/SKILL.md within your plugin. The skill-creator skill provides complete guidance.
For Agents:
See references/Subagents.md for complete details on:
For Hooks:
See references/Hooks reference.md for complete details on:
hooks/hooks.jsonFor MCP Servers:
See references/Connect Claude Code to tools via MCP.md for complete details on:
.mcp.jsonCreate a local marketplace for testing:
Directory structure:
dev-marketplace/
├── .claude-plugin/
│ └── marketplace.json
└── your-plugin/
└── (your plugin files)
Create marketplace.json:
{
"name": "dev-marketplace",
"owner": {
"name": "Developer"
},
"plugins": [
{
"name": "your-plugin",
"source": "./your-plugin",
"description": "Plugin under development"
}
]
}
Test workflow:
# From parent directory of dev-marketplace
claude
# In Claude Code:
/plugin marketplace add ./dev-marketplace
/plugin install your-plugin@dev-marketplace
# Test your plugin components
# Then uninstall/reinstall after changes:
/plugin uninstall your-plugin@dev-marketplace
/plugin install your-plugin@dev-marketplace
Create a comprehensive README.md:
For personal use:
/plugin marketplace add ./path/to/pluginFor team use:
.claude-plugin/marketplace.json at repo root/plugin marketplace add your-org/plugin-repo.claude/settings.jsonFor community:
See references/Plugin marketplaces.md for complete distribution details.
This skill includes comprehensive reference documentation:
Plugin System:
references/Plugins.md - Main plugin overview and quickstartreferences/Plugins reference.md - Complete technical specificationsPlugin Components:
references/Slash Commands.md - Command creation and featuresreferences/Subagents.md - Agent configuration and usagereferences/Hooks reference.md - Event handling and automationreferences/Connect Claude Code to tools via MCP.md - MCP server integrationDistribution:
references/Plugin marketplaces.md - Creating and managing marketplacesNote: For Skills specifically, use the skill-creator skill included in this plugin rather than writing them manually.
plugin-name/
├── .claude-plugin/
│ └── plugin.json # REQUIRED - Must be here
├── commands/ # At plugin root, NOT in .claude-plugin/
├── agents/ # At plugin root
├── skills/ # At plugin root
├── hooks/ # At plugin root
│ └── hooks.json
└── .mcp.json # At plugin root
Critical: Only .claude-plugin/plugin.json goes in the .claude-plugin/ directory. All component directories (commands/, agents/, skills/, hooks/) must be at the plugin root.
Use ${CLAUDE_PLUGIN_ROOT} in plugin configurations to reference plugin-relative paths:
{
"hooks": {
"PostToolUse": [{
"hooks": [{
"type": "command",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh"
}]
}]
}
}
commands/ directoryagents/ directoryskills/ directoryhooks/hooks.json or inline in plugin.json.mcp.json or inline in plugin.jsonPlugin with just one type of component:
formatter-plugin/
├── .claude-plugin/plugin.json
└── commands/
└── format.md
Plugin with multiple component types:
development-plugin/
├── .claude-plugin/plugin.json
├── commands/ # User-invoked workflows
├── agents/ # Specialized subagents
├── skills/ # Model-invoked capabilities
├── hooks/ # Event automation
└── .mcp.json # External integrations
Plugin for standardized team workflows:
team-tools/
├── .claude-plugin/plugin.json
├── commands/
│ ├── deploy.md
│ └── review.md
├── skills/
│ └── code-standards/
│ ├── SKILL.md
│ └── references/
└── hooks/
└── hooks.json
Plugin not loading:
plugin.json syntaxclaude --debug to see loading errorsComponents not appearing:
.claude-plugin/Hooks not firing:
chmod +x script.sh)${CLAUDE_PLUGIN_ROOT} for all plugin pathsPath errors:
./${CLAUDE_PLUGIN_ROOT} for plugin-relative pathsscripts/init_plugin.py to scaffoldclaude plugin validate . before distributionAfter creating your plugin:
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer