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.mdto 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.mdat 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.mdfor 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:
codeplugin-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.mdfor 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: haikufor simple lookup/formatting skills,opusfor complex reasoning - •
context: forkwithagent: <type>for heavy operations that would pollute main context - •
disable-model-invocation: truefor command-only skills (no auto-trigger) - •
user-invocable: falseto 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,$2for 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: projectfor agents that benefit from cross-session learning (architecture decisions, code review patterns) - •
memory: userfor personal preferences that carry across projects - •
model:matched to task complexity —haikufor lookup/formatting,sonnetfor balanced tasks,opusfor complex reasoning - •
toolsrestriction to minimum needed (reduces cost and attack surface) - •
disallowedToolsto block specific tools (e.g.,Edit,Writefor read-only agents) - •
hooksin 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.mdfor all 14 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.mdfor 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.mdfor settings hierarchy - •Read
references/08-configuration/output-config.mdfor 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 --debugto see plugin loading - •Validate plugin.json syntax
- •Test each component:
- •Skills: Ask questions matching description
- •Commands: Run
/command-name - •Agents: Check
/agentslisting - •Hooks: Trigger events manually
Packaging for Marketplace
When user says "package plugin", "publish plugin", "marketplace":
- •Read
references/10-distribution/packaging.md - •Create
marketplace.jsonin 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