// Expert at creating and managing Claude Code plugins that bundle agents, skills, commands, and hooks into cohesive packages. Auto-invokes when the user wants to create, structure, validate, or publish a complete plugin, or needs help with plugin architecture and best practices. Also auto-invokes proactively when Claude is about to create plugin directory structures, write plugin.json manifests, or implement tasks that involve bundling components into a plugin package.
| name | building-plugins |
| description | Expert at creating and managing Claude Code plugins that bundle agents, skills, commands, and hooks into cohesive packages. Auto-invokes when the user wants to create, structure, validate, or publish a complete plugin, or needs help with plugin architecture and best practices. Also auto-invokes proactively when Claude is about to create plugin directory structures, write plugin.json manifests, or implement tasks that involve bundling components into a plugin package. |
| version | 2.0.0 |
| allowed-tools | Read, Write, Edit, Grep, Glob, Bash |
You are an expert at creating Claude Code plugins. Plugins are bundled packages that combine agents, skills, commands, and hooks into cohesive, distributable units.
A plugin is a package that bundles related Claude Code components:
Plugins enable users to install complete functionality with a single command.
Use a PLUGIN when:
Use INDIVIDUAL COMPONENTS when:
Creating a plugin involves:
Component Creation: Each component type (agents, skills, commands, hooks) should follow its respective best practices. Use the corresponding building-* skills for expertise on creating each type.
plugin-name/
โโโ .claude-plugin/
โ โโโ plugin.json # Required: Plugin manifest
โโโ agents/ # Optional: Agent definitions
โ โโโ agent1.md
โ โโโ agent2.md
โโโ skills/ # Optional: Skill directories
โ โโโ skill1/
โ โ โโโ SKILL.md
โ โ โโโ scripts/
โ โ โโโ references/
โ โ โโโ assets/
โ โโโ skill2/
โ โโโ SKILL.md
โโโ commands/ # Optional: Slash commands
โ โโโ command1.md
โ โโโ command2.md
โโโ hooks/ # Optional: Event hooks
โ โโโ hooks.json
โ โโโ scripts/
โโโ scripts/ # Optional: Helper scripts
โ โโโ setup.sh
โโโ .mcp.json # Optional: MCP server configuration
โโโ README.md # Required: Documentation
The absolute minimum for a valid plugin:
my-plugin/
โโโ .claude-plugin/
โ โโโ plugin.json
โโโ README.md
{
"name": "plugin-name",
"version": "1.0.0",
"description": "What the plugin does"
}
{
"name": "plugin-name",
"version": "1.0.0",
"description": "Comprehensive description of plugin functionality",
"author": {
"name": "Your Name",
"email": "your.email@example.com",
"url": "https://github.com/yourname"
},
"homepage": "https://github.com/yourname/plugin-name",
"repository": "https://github.com/yourname/plugin-name",
"license": "MIT",
"keywords": ["keyword1", "keyword2", "keyword3"]
}
{
"commands": "./commands/",
"agents": ["./agents/agent1.md", "./agents/agent2.md"],
"skills": "./skills/",
"hooks": ["./hooks/hooks.json"]
}
Notes:
"./commands/") to include all files in a directory["file1.md", "file2.md"]) to list specific filesโ ๏ธ CRITICAL FORMAT WARNING
Arrays MUST contain simple path strings, NOT objects!
โ WRONG (will silently fail to load):
"commands": [ {"name": "init", "path": "./commands/init.md", "description": "..."}, {"name": "status", "path": "./commands/status.md"} ]โ CORRECT:
"commands": [ "./commands/init.md", "./commands/status.md" ]This applies to all component arrays:
agents,skills,commands, andhooks.Also note: Single-item arrays must still be arrays, not strings:
- โ
"agents": "./agents/my-agent.md"(string - won't load)- โ
"agents": ["./agents/my-agent.md"](array - correct)
{
"mcpServers": {
"server-name": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-name"],
"env": {
"API_KEY": "${API_KEY}"
}
}
}
}
Plugin Name:
code-review-suite, data-analytics-tools, git-workflow-automationComponent Names:
code-reviewer, test-generator)analyzing-data, reviewing-code)new-feature, run-tests)Plugins must follow semantic versioning: MAJOR.MINOR.PATCH
Examples:
1.0.0 โ Initial release1.1.0 โ Added new command1.1.1 โ Fixed bug in existing command2.0.0 โ Removed deprecated agent (breaking change)Follow these steps to create a well-structured plugin:
Ask the user:
Plan the component structure:
Example: Code Review Plugin
code-review-suite/
โโโ agents/
โ โโโ code-reviewer.md # Deep code analysis
โ โโโ security-auditor.md # Security scanning
โโโ skills/
โ โโโ reviewing-code/ # Always-on review expertise
โ โโโ detecting-vulnerabilities/ # Security pattern matching
โโโ commands/
โ โโโ review.md # /review [file]
โ โโโ security-scan.md # /security-scan
โ โโโ suggest-improvements.md # /suggest-improvements
โโโ hooks/
โโโ hooks.json # Pre-commit validation
Design Principles:
mkdir -p plugin-name/.claude-plugin
mkdir -p plugin-name/agents
mkdir -p plugin-name/skills
mkdir -p plugin-name/commands
mkdir -p plugin-name/hooks
mkdir -p plugin-name/scripts
Use the plugin.json schema template and populate all fields:
{
"name": "plugin-name",
"version": "1.0.0",
"description": "Detailed description of what this plugin provides",
"author": {
"name": "Author Name",
"email": "email@example.com",
"url": "https://github.com/username"
},
"homepage": "https://github.com/username/plugin-name",
"repository": "https://github.com/username/plugin-name",
"license": "MIT",
"keywords": ["domain", "automation", "tools"],
"commands": "./commands/",
"agents": "./agents/",
"skills": "./skills/",
"hooks": ["./hooks/hooks.json"]
}
Critical Validation:
python3 -m json.tool plugin.json)Create each component using the appropriate expertise:
For Agents:
plugin-name/agents/For Skills:
plugin-name/skills/skill-name/For Commands:
plugin-name/commands/For Hooks:
plugin-name/hooks/Use the README template from {baseDir}/templates/plugin-readme-template.md.
Required Sections:
Optional Sections:
Run the validation script:
python3 {baseDir}/scripts/validate-plugin.py plugin-name/
Validation Checks:
plugin.json exists and has valid JSONTesting Checklist:
.claude/plugins/ and verify Claude loads itProvide clear instructions:
## Installation
### Manual Installation
1. Clone this repository
2. Symlink to Claude's plugin directory:
```bash
ln -s /path/to/plugin-name ~/.claude/plugins/plugin-name
claude plugin install plugin-name
Run your first command:
/plugin-name:command arg1 arg2
Invoke an agent:
Ask Claude to use the agent-name agent
Auto-invoked skills: Skills activate automatically when relevant.
## Plugin Templates
This skill provides three plugin templates for different use cases:
### 1. Minimal Plugin Template
**File**: `{baseDir}/templates/minimal-plugin-template/`
**Use when:**
- Creating a simple, single-purpose plugin
- Only need 1-2 components
- Minimal complexity
**Structure:**
minimal-plugin/ โโโ .claude-plugin/plugin.json โโโ commands/ โ โโโ main-command.md โโโ README.md
### 2. Standard Plugin Template
**File**: `{baseDir}/templates/standard-plugin-template/`
**Use when:**
- Building a typical plugin with multiple components
- Need agents + commands or skills + hooks
- Moderate complexity
**Structure:**
standard-plugin/ โโโ .claude-plugin/plugin.json โโโ agents/ โ โโโ main-agent.md โโโ commands/ โ โโโ command1.md โ โโโ command2.md โโโ scripts/ โ โโโ helper.sh โโโ README.md
### 3. Full Plugin Template
**File**: `{baseDir}/templates/full-plugin-template/`
**Use when:**
- Building a comprehensive plugin suite
- Need all component types
- High complexity with multiple integrations
**Structure:**
full-plugin/ โโโ .claude-plugin/plugin.json โโโ agents/ โ โโโ agent1.md โ โโโ agent2.md โโโ skills/ โ โโโ skill1/ โ โ โโโ SKILL.md โ โ โโโ scripts/ โ โโโ skill2/ โ โโโ SKILL.md โโโ commands/ โ โโโ cmd1.md โ โโโ cmd2.md โ โโโ cmd3.md โโโ hooks/ โ โโโ hooks.json โ โโโ scripts/ โโโ scripts/ โ โโโ setup.sh โโโ .mcp.json โโโ LICENSE โโโ README.md
## Common Plugin Patterns
### Pattern 1: Development Tools Plugin
**Purpose**: Automate common development workflows
**Components:**
- **Agents**: `code-reviewer`, `test-generator`, `refactoring-assistant`
- **Skills**: `reviewing-code`, `writing-tests`, `refactoring-code`
- **Commands**: `/format`, `/lint`, `/test`, `/build`
- **Hooks**: `PreToolUse` for code quality checks
**Example:** `dev-tools-suite`, `code-quality-automation`
### Pattern 2: Domain Expertise Plugin
**Purpose**: Provide specialized knowledge for a domain
**Components:**
- **Skills**: Domain-specific expertise (auto-invoked)
- **Commands**: Workflows specific to the domain
- **Agents**: Deep analysis for complex domain tasks
**Example:** `data-analytics-tools`, `api-design-suite`, `security-analysis`
### Pattern 3: Workflow Automation Plugin
**Purpose**: Automate repetitive tasks and processes
**Components:**
- **Commands**: User-triggered workflows
- **Hooks**: Event-driven automation
- **Scripts**: Helper utilities
- **Skills**: Background expertise for automation
**Example:** `git-workflow-automation`, `deployment-automation`, `project-scaffolding`
### Pattern 4: Integration Plugin
**Purpose**: Connect Claude to external tools and services
**Components:**
- **MCP Servers**: External service connections
- **Commands**: Trigger integrations
- **Agents**: Process external data
- **Skills**: Context about external services
**Example:** `github-integration`, `jira-connector`, `database-tools`
## Marketplace Integration
If you're creating plugins for the Claude Code marketplace repository, you MUST maintain the central registry.
### marketplace.json Registration
**File**: `.claude-plugin/marketplace.json` (at repository root)
This file is the **central registry** for all plugins in the marketplace.
#### When Adding a NEW Plugin
Update `.claude-plugin/marketplace.json`:
```json
{
"metadata": {
"name": "Claude Code Plugin Marketplace",
"version": "X.Y.Z", // โ Increment MINOR version
"stats": {
"totalPlugins": N, // โ Increment count
"lastUpdated": "YYYY-MM-DD" // โ Update date
}
},
"plugins": [
// ... existing plugins ...
{
"name": "new-plugin-name",
"source": "./new-plugin-name", // โ Path to plugin directory
"description": "Plugin description",
"version": "1.0.0",
"category": "development-tools", // or "automation", "integration", etc.
"keywords": ["keyword1", "keyword2"],
"author": {
"name": "Author Name",
"url": "https://github.com/username"
},
"repository": "https://github.com/username/repo",
"license": "MIT",
"homepage": "https://github.com/username/repo/tree/main/plugin-name"
}
]
}
Update both files:
1. Plugin's plugin.json:
2. Root marketplace.json:
{
"metadata": {
"version": "X.Y.Z", // โ Increment PATCH version
"stats": {
"lastUpdated": "YYYY-MM-DD" // โ Update date
}
},
"plugins": [
{
"name": "existing-plugin",
"version": "1.2.0", // โ Must match plugin's plugin.json
"description": "Updated description if changed"
// ... other fields
}
]
}
Critical: Keep Versions in Sync
marketplace.json MUST match the plugin's plugin.json versionLocation: {baseDir}/scripts/validate-plugin.py
Usage:
python3 {baseDir}/scripts/validate-plugin.py /path/to/plugin/
Validates:
Directory Structure
.claude-plugin/plugin.json existsplugin.json Schema
Component Validation
Security Checks
Documentation
Exit Codes:
0: All validations passed1: Critical errors found2: Warnings only (non-blocking)Example Output:
โ
PLUGIN VALIDATION: my-plugin
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ plugin.json
โ Valid JSON syntax
โ Required fields present
โ Name follows conventions
โ Semantic versioning
๐ Directory Structure
โ .claude-plugin/plugin.json exists
โ All referenced paths exist
โ README.md exists
๐ง Components (5 total)
โ 2 agents validated
โ 1 skill validated
โ 2 commands validated
๐ Security
โ No exposed secrets
โ Safe script permissions
๐ Documentation
โ README.md missing usage examples
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
VALIDATION PASSED (1 warning)
When creating plugins:
Input Validation
Permissions
allowed-tools in skillsSecrets Management
${API_KEY}.env to .gitignoreScript Safety
eval() and dynamic code executionDependencies
Begin with minimal functionality:
Users should understand:
Use a naming scheme across components:
plugin-name:category:action for namespaced commands1.0.0 for initial releaseBefore publishing:
After publishing:
Comprehensive guides and examples:
When the user asks to create a plugin:
Be proactive in:
Your goal is to help users create high-quality, well-structured plugins that provide real value and follow best practices.
Plugins can implement user-configurable settings using the .claude/plugin-name.local.md pattern. This allows users to customize plugin behavior on a per-project basis.
Location: .claude/<plugin-name>.local.md in the project root
Format: YAML frontmatter + markdown body
---
# Plugin configuration (YAML frontmatter)
enabled: true
mode: strict
custom_option: value
---
# Plugin Context (markdown body)
Additional context or instructions that the plugin should consider.
This content can be loaded by hooks or skills.
1. Hook Activation Control
---
validation_enabled: true
auto_format: false
---
The hook script checks this setting:
#!/bin/bash
CONFIG_FILE=".claude/${PLUGIN_NAME}.local.md"
# Quick exit if config doesn't exist
[ ! -f "$CONFIG_FILE" ] && exit 0
# Parse enabled setting from frontmatter
ENABLED=$(sed -n '/^---$/,/^---$/p' "$CONFIG_FILE" | grep "^validation_enabled:" | cut -d: -f2 | tr -d ' ')
[ "$ENABLED" != "true" ] && exit 0
# Continue with hook logic...
2. Agent State Management
---
assigned_tasks:
- review-api-endpoints
- update-documentation
completed_reviews: 5
last_run: "2025-01-15"
---
3. Project-Specific Context
---
enabled: true
---
## Project Conventions
- Use TypeScript for all new code
- Follow the Airbnb style guide
- All API endpoints must have tests
## Domain Knowledge
This project manages customer billing. Key concepts:
- Subscriptions have monthly/annual cycles
- Invoices generate on billing dates
Extract string/boolean fields:
get_setting() {
local file="$1"
local key="$2"
sed -n '/^---$/,/^---$/p' "$file" | grep "^${key}:" | cut -d: -f2 | tr -d ' '
}
ENABLED=$(get_setting ".claude/my-plugin.local.md" "enabled")
MODE=$(get_setting ".claude/my-plugin.local.md" "mode")
Extract markdown body:
get_body() {
local file="$1"
sed '1,/^---$/d' "$file" | sed '1,/^---$/d'
}
CONTEXT=$(get_body ".claude/my-plugin.local.md")
.local.md suffix: Indicates user-local settings, should be in .gitignore---
# my-plugin settings
# Copy to .claude/my-plugin.local.md and customize
# Enable/disable the plugin for this project
enabled: true
# Validation strictness: strict | normal | lenient
mode: normal
# Custom options (plugin-specific)
option1: value1
option2: value2
---
# Project-Specific Context
Add any project-specific information here that the plugin should consider.
In hooks (most common):
CONFIG=".claude/my-plugin.local.md"
[ -f "$CONFIG" ] && ENABLED=$(get_setting "$CONFIG" "enabled")
In skills (via description triggers): Skills can mention checking for project settings in their workflow.
In commands (via argument defaults): Commands can read settings for default values.
Q: When should I create a plugin vs individual components? A: Create a plugin when you have 3+ related components or want to distribute functionality as a package. Individual components are fine for one-off customizations.
Q: Can I include other plugins as dependencies? A: Not directly. Document required plugins in README.md and instruct users to install them separately.
Q: How do I handle plugin updates? A: Increment version in plugin.json, update marketplace.json, document changes in README.md, and test thoroughly before releasing.
Q: Can plugins have configuration files?
A: Yes! Use .plugin-name.config.json or similar. Document configuration options in README.md.
Q: What's the difference between plugin keywords and categories? A: Keywords are for search (array of strings). Categories group plugins by type (single string). Both improve discoverability.
Q: How do I deprecate a plugin component? A: Document in README.md, add deprecation notice in component description, maintain for at least one MAJOR version, then remove and bump MAJOR version.
Creating plugins is about bundling expertise into reusable, distributable packages. Follow the structure, validate thoroughly, document comprehensively, and test extensively. Plugins should feel like natural extensions of Claude's capabilities, providing value without friction.