plugin-development
Complete guide to building Claude Code plugins — manifest schema, command/skill/agent/hook authoring, MCP server development, marketplace publishing, and testing
What this skill does
# Plugin Development Complete Guide
Building Claude Code plugins means creating directories, manifests, and markdown files that extend Claude's capabilities through commands, skills, agents, and hooks.
## Plugin Anatomy
Every plugin follows this directory structure:
```
my-plugin/
├── .claude-plugin/
│ └── plugin.json # Manifest (REQUIRED)
├── commands/ # Slash commands
│ ├── index.json # Command index (optional)
│ └── my-command.md
├── skills/ # Knowledge packs
│ ├── skill-name/
│ │ └── SKILL.md
│ └── another-skill/
│ └── SKILL.md
├── agents/ # Specialized workers
│ ├── index.json # Agent index (optional)
│ ├── my-agent.md
│ └── another-agent.md
├── hooks/ # Lifecycle scripts
│ ├── hooks.json # Hook configuration
│ ├── my-hook.sh
│ └── scripts/
│ └── helper.sh
├── mcp-server/ # Optional: custom MCP server
│ ├── src/
│ │ └── index.js
│ ├── package.json
│ └── dist/
├── CLAUDE.md # Plugin routing guide (recommended)
├── CONTEXT_SUMMARY.md # Bootstrap context (recommended, 700 tokens max)
└── README.md # Marketplace documentation
```
## Manifest Schema (plugin.json)
Located at `.claude-plugin/plugin.json`, the manifest defines plugin identity, permissions, and capabilities.
### Required Fields
| Field | Type | Example |
|-------|------|---------|
| `$schema` | string | `"https://claude.local/schemas/plugin.schema.json"` |
| `name` | string | `"my-awesome-plugin"` |
| `version` | string | `"1.0.0"` (semver) |
| `description` | string | One-line summary (50-80 chars) |
| `author.name` | string | Your name or org |
| `license` | string | `"MIT"` or other SPDX |
| `permissions.requires` | string[] | Minimum permissions needed |
### Example Manifest
```json
{
"$schema": "https://claude.local/schemas/plugin.schema.json",
"name": "my-awesome-plugin",
"version": "1.0.0",
"description": "Does something amazing with Claude Code",
"author": {
"name": "Your Name"
},
"license": "MIT",
"repository": "https://github.com/user/my-awesome-plugin",
"keywords": [
"automation",
"productivity",
"development"
],
"permissions": {
"requires": [
"read",
"write"
],
"optional": [
"bash",
"agent",
"mcp"
]
},
"capabilities": {
"provides": [
"my-custom-capability"
],
"requires": []
},
"contextEntry": "CONTEXT_SUMMARY.md",
"context": {
"entry": "CONTEXT_SUMMARY.md",
"title": "My Awesome Plugin",
"summary": "Essential context for using the plugin",
"tags": [
"automation",
"claude-code"
],
"bootstrapFiles": [
"CONTEXT_SUMMARY.md"
],
"maxTokens": 700,
"excludeGlobs": [
"**/node_modules/**",
"**/.git/**"
],
"lazyLoadSections": [
"CLAUDE.md",
"commands/advanced.md",
"skills/expert-mode/SKILL.md"
]
}
}
```
### Manifest Fields Explained
**`$schema`**: Validates against Claude's plugin schema. Use as shown above.
**`name`**: Unique identifier (lowercase, hyphens). Used in `claude plugin install` commands.
**`version`**: Semantic versioning. Increment when publishing updates (1.0.0 → 1.0.1 for patches, 1.1.0 for features, 2.0.0 for breaking changes).
**`permissions.requires`**: Minimum permissions needed. Plugin will not load without these:
- `read` — read files
- `write` — write files
- `bash` — execute shell commands
- `agent` — spawn subagents
- `mcp` — use MCP servers
- `network` — external HTTP
**`permissions.optional`**: Nice-to-have permissions. Plugin works without them but features are limited.
**`capabilities.provides`**: Custom capabilities your plugin exposes. Use for plugin discovery and dependency resolution.
**`contextEntry`**: Points to the bootstrap file. Always `"CONTEXT_SUMMARY.md"`.
**`context.bootstrapFiles`**: Files loaded into context when plugin installs. Keep to 700 tokens.
**`context.lazyLoadSections`**: Files loaded on-demand when user references them. Helps large plugins stay responsive.
**`context.excludeGlobs`**: Patterns to exclude from context scanning (node_modules, build artifacts, etc.).
## Command Authoring
Commands are markdown files in the `commands/` directory with YAML frontmatter and implementation body.
### Command Frontmatter Schema
```yaml
---
name: my-command
intent: What this command does (one sentence)
inputs:
- name: description
- task: what the user wants
- query: optional search term
flags:
- name: force
type: boolean
description: Skip confirmations
- name: output
type: choice
choices: [json, text, html]
description: Output format
risk: low
cost: low
tags:
- my-plugin
- productivity
---
```
### Command Body Structure
After frontmatter, the body contains:
1. **Usage Examples** (code blocks with bash syntax)
2. **Operating Protocol** (numbered phases)
3. **Output Contract** (what the command produces)
### Full Command Example
```yaml
---
name: batch-process
intent: Process multiple files with transformation rules
inputs:
- files: pattern matching files to process
- rule: transformation function (e.g., "uppercase", "snake_case")
flags:
- name: dry-run
type: boolean
description: Show changes without applying
- name: workers
type: string
description: Number of parallel workers (default 4)
risk: medium
cost: medium
tags:
- my-plugin
- batch
---
# Batch Process Command
Process multiple files with transformation rules applied in parallel.
## Usage
```bash
/batch-process --files "src/**/*.ts" --rule uppercase
/batch-process --files "*.md" --rule snake_case --dry-run
/batch-process --files "src/**/*.js" --rule lowercase --workers 8
```
## Operating Protocol
1. **Parse** input flags and file pattern
2. **Validate** files exist and are readable
3. **Check dry-run** — if set, show preview without modifying
4. **Scan** matching files into queue
5. **Apply rule** to each file (parallel if workers > 1)
6. **Report** changes: files modified, skipped, failed
7. **Rollback** if failures exceed threshold (--continue-on-error overrides)
## Output Contract
Returns JSON object:
```json
{
"processed": 42,
"modified": 40,
"skipped": 2,
"failed": 0,
"duration_ms": 1234,
"files": [
{"path": "src/file.ts", "status": "modified", "size_before": 100, "size_after": 120}
]
}
```
```
### Command Naming
Prefix commands with plugin name for namespacing:
- Good: `/my-plugin-batch`, `/my-plugin-audit`
- Avoid: `/batch`, `/process` (too generic)
## Skill Authoring
Skills are knowledge packs in `skills/SKILLNAME/SKILL.md` with frontmatter and progressive loading.
### Skill Frontmatter
```yaml
---
name: my-skill
description: What this skill teaches (one sentence)
allowed-tools:
- Read
- Write
- Bash
- Grep
triggers:
- use my skill
- teach me about skill
- how to use skill
disable-model-invocation: false
---
```
Set `disable-model-invocation: true` for user-only reference skills (no model can invoke them).
### Skill Body Structure
1. **Goal** (why someone uses this skill)
2. **Core Loop** (numbered steps, 5-10 steps typical)
3. **Examples** (real code snippets)
### Full Skill Example
```yaml
---
name: database-migrations
description: Safely design and test database migrations with rollback paths
allowed-tools:
- Read
- Write
- Bash
triggers:
- database migration
- db migration
- migration strategy
- rollback plan
---
# Database Migrations
Design, test, and execute database migrations safely with automatic rollback paths.
## Goal
Write migrations that are **testable**, **reversible**, and **traceable**. Catch issues in development, not production.
## Core Loop
1. **Analyze** existing schema using introspection (PRAGMA for SQLite, DESCRIBE for MySQL)
2.Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.