| title | Plugin Development Guide | ||||||
|---|---|---|---|---|---|---|---|
| category | development | ||||||
| target_platform | linux | ||||||
| audience | ai_agent | ||||||
| keywords |
|
||||||
| version | 1.0.33+ |
Plugin Types:
- Skills: Domain knowledge and workflows
- Agents: Specialized subprocesses with tool restrictions
- Hooks: Lifecycle event handlers
- MCP Servers: External tool integrations
- LSP Servers: Language protocol integrations
Architecture Comparison:
| Component | Location | Namespace | Scope |
|---|---|---|---|
| Standalone | .claude/ |
Global /command |
Project-only |
| Plugin | .claude-plugin/ |
/plugin:command |
Shareable/versioned |
mkdir -p my-plugin/.claude-plugin
cd my-pluginplugin.json:
{
"name": "my-plugin",
"version": "1.0.0",
"description": "Plugin description"
}Directory structure:
my-plugin/
├── .claude-plugin/
│ └── plugin.json
├── skills/
│ └── example/
│ └── SKILL.md
└── commands/
└── hello.md
claude --plugin-dir ./my-plugin
# In session:
/my-plugin:hello
/help # List all commands# Verify Claude Code installation
claude --version
# Required: >= 1.0.33
Required fields (.claude-plugin/plugin.json):
{
"name": "plugin-identifier", // lowercase-hyphenated
"version": "1.0.0", // semver
"description": "Brief description" // one-line summary
}Optional fields:
{
"author": { "name": "Your Name", "url": "https://..." },
"homepage": "https://..."
}Strict mode warning:
plugin.jsonuses Zod strict validation — unknown fields are rejected on install. Invalid fields (silently dropped by local tooling but rejected at install):keywords,repository,license,category. MCP and LSP servers use separate sidecar files (.mcp.json,.lsp.json) — notplugin.json.
Location: commands/*.md Format: Markdown files with optional YAML frontmatter
Invocation: /plugin-name:command-name
---
description: Command description
---
Command instructions using $ARGUMENTS placeholder for user input.Location: skills/*/SKILL.md Format: Folder per skill with SKILL.md file
Invocation: Auto-invoked by AI based on context
---
name: skill-name
description: When to use this skill
applyTo:
- '**/*.py'
---
Skill implementation instructions.See skills.md for complete reference.
Location: agents/*.md Purpose: Specialized subprocesses with tool restrictions
Invocation: /agent-name
See sub-agents.md for complete reference.
Location: hooks/hooks.json Purpose: Lifecycle event handlers Events:
SessionStart, SessionEnd, PreToolUse, PostToolUse, etc.
See hooks.md for complete reference.
Location: Configured in .mcp.json at plugin root Purpose: External tool integrations via
Model Context Protocol
See mcp.md for complete reference.
Location: Configured in .lsp.json at plugin root Purpose: Language Server
Protocol for code intelligence
{
"python": {
"command": "pylsp",
"args": [],
"extensionToLanguage": {
".py": "python"
}
}
}plugin-name/
├── .claude-plugin/
│ └── plugin.json # Required metadata
├── commands/ # Optional command skills
│ └── command-name.md
├── skills/ # Optional AI skills
│ └── skill-folder/
│ └── SKILL.md
├── agents/ # Optional custom agents
│ └── agent-name.md
├── hooks/ # Optional hooks
│ └── hooks.json
├── .lsp.json # Optional LSP config
└── README.md # Documentation — use docs/plugin-readme-template.md
Important: Only plugin.json goes inside .claude-plugin/. All other directories
are at plugin root.
Every plugin README.md should follow docs/plugin-readme-template.md. Required sections:
Summary, Principles, Requirements, Installation, How It Works (Mermaid), Usage, Planned
Features, Known Issues, Links. Delete optional sections (Features, Configuration, Design
Decisions, etc.) that don't apply to the specific plugin.
mkdir -p my-plugin/.claude-plugin
cat > my-plugin/.claude-plugin/plugin.json << 'EOF'
{
"name": "my-plugin",
"version": "0.1.0",
"description": "Description"
}
EOF# Add a command
mkdir -p my-plugin/commands
cat > my-plugin/commands/hello.md << 'EOF'
---
description: Greet user
---
Greet the user named "$ARGUMENTS" warmly.
EOF
# Add a skill
mkdir -p my-plugin/skills/example
cat > my-plugin/skills/example/SKILL.md << 'EOF'
---
name: example
description: Example skill
---
Skill implementation.
EOFclaude --plugin-dir ./my-plugin# Make changes
# Restart Claude to reload
claude --plugin-dir ./my-plugin