Prerequisites
Before you begin:- Claude Code installed and working
- Basic understanding of markdown and YAML
- Text editor of your choice
- (Optional) Git for version control
Quick Start
The fastest way to create a plugin is using the plugin-dev toolkit:Manual Plugin Creation
To understand plugin structure, let’s create a simple plugin manually.Step 1: Create Plugin Directory
Create a directory for your plugin:Step 2: Create Plugin Manifest
Every plugin needs a manifest at.claude-plugin/plugin.json:
.claude-plugin/plugin.json:
The
name field must be unique and use kebab-case (lowercase with hyphens).Step 3: Add a Command
Create a simple slash command incommands/hello.md:
commands/hello.md:
Step 4: Test Your Plugin
Load your plugin locally:Plugin Structure
Your plugin now has this structure:Next Steps
Add an Agent
Create a specialized agent in
agents/See Agent DevelopmentAdd a Skill
Create auto-activating expertise in
skills/See Skill DevelopmentAdd Hooks
Create event handlers in
hooks/See Hook DevelopmentWrite Documentation
Create a comprehensive README.mdSee Plugin Structure
Development Workflow
1. Develop Locally
Use--plugin-dir to test changes:
2. Add to Project
Once working, add to your project’s.claude/settings.json:
3. Publish
When ready to share:- Push to GitHub
- Create a release with version tag
- Submit to plugin marketplace
Common Patterns
Simple Command Plugin
Just commands, no agents or hooks:Agent-Focused Plugin
Primarily provides specialized agents:Skill Plugin
Provides auto-activating expertise:Full-Featured Plugin
Uses all component types:Best Practices
Start Simple
Begin with just a command or agent, add complexity as needed
Use ${CLAUDE_PLUGIN_ROOT}
Always use this variable for portable path references
Test Thoroughly
Test on different operating systems and projects
Document Well
Clear README with examples and usage instructions
Debugging Tips
Enable Debug Mode
- Plugin loading process
- Component discovery
- Hook execution
- Agent triggering
Check Plugin Loaded
Ask Claude:Verify Component Discovery
Common Issues
Plugin not loading:- Check
plugin.jsonsyntax - Verify directory structure
- Ensure
.claude-plugindirectory exists
- Check file is in
commands/directory - Verify
.mdextension - Check YAML frontmatter syntax
- Review
descriptionfield for trigger phrases - Add
<example>blocks to description - Make description more specific
Resources
Plugin Structure
Detailed guide to plugin organization
Commands
Creating slash commands
Agents
Building specialized agents
Skills
Auto-activating expertise
Hooks
Event-driven automation
MCP Integration
Connecting external tools
Examples
Study these bundled plugins for examples:- commit-commands: Simple command-based plugin
- hookify: Hooks and configuration files
- feature-dev: Commands, agents, and workflow
- plugin-dev: Skills, agents, and comprehensive toolkit
Get Help
For more guidance:- 7 expert skills covering all aspects
- Guided creation workflow
- Validation and testing utilities
- Working examples and templates