Agent skill
buildingplugins
Use when creating, developing, or troubleshooting Claude Code plugins, skills, hooks, agents, commands, or MCP servers. For questions like "How do I create a plugin?", "What goes in plugin.json?", "How do skills work?", "Create a hook", or "Help me build a marketplace".
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/buildingplugins
SKILL.md
Building Plugins for Claude Code
Expert guidance for creating well-structured plugins, skills, hooks, agents, commands, and MCP configurations.
Core Principles (Anthropic Official)
- Composable - Multiple skills work together seamlessly, Claude coordinates automatically
- Portable - Same format works across Claude apps, Claude Code, and Claude API
- Efficient - Progressive disclosure loads only what's needed (description → SKILL.md → references)
- Powerful - Combines prompts + executable code for complete workflows
- Secure - Never hardcode secrets, use
${CLAUDE_PLUGIN_ROOT}for paths
Critical Budget Limits
| Limit | Value | Consequence if Exceeded |
|---|---|---|
| All skill descriptions combined | 15,000 chars | Silent filtering, skills won't activate |
| Individual description | 1,024 chars | Truncation |
| SKILL.md body | 5,000 words | Context saturation, partial execution |
| Target per description | 300-400 chars | Allows ~40 skills safely |
Plugin Structure
my-plugin/
├── plugin.json # Manifest (at root for marketplace plugins)
├── commands/ # Slash commands (.md files)
├── skills/ # Skills with SKILL.md
│ └── skill-name/
│ ├── SKILL.md
│ └── references/
├── agents/ # Sub-agents (.md files)
├── hooks/
│ └── hooks.json # Event handlers
├── .mcp.json # MCP servers
└── README.md
Quick Reference
plugin.json (Minimum)
{
"name": "plugin-name",
"version": "1.0.0",
"description": "What this plugin does"
}
SKILL.md Frontmatter
---
name: skill-name
description: Use when [trigger]. For [use cases].
allowed-tools: Read, Glob, Grep
model: sonnet
context: fork
user-invocable: true
---
Agent Frontmatter
---
name: agent-name
description: Expert in [domain]. Use for [tasks].
tools: [Read, Grep, Glob]
disallowedTools: [Write]
model: sonnet
permissionMode: default
color: blue
---
Command Frontmatter
---
description: What this command does
allowed-tools: Read, Write, Edit
argument-hint: "<required> [optional]"
---
Hook Configuration
{
"hooks": {
"PreToolUse": [{
"matcher": "Write|Edit",
"hooks": [{ "type": "command", "command": "${CLAUDE_PLUGIN_ROOT}/scripts/validate.sh" }]
}]
}
}
Detailed References
Load these for comprehensive documentation:
| Topic | Reference |
|---|---|
| Plugin manifest, installation, validation | references/plugin-reference.md |
| SKILL.md format, progressive disclosure, scoped hooks | references/skills-reference.md |
| Agent configuration, permission modes, built-ins | references/agents-reference.md |
| Slash command format, arguments, execution | references/commands-reference.md |
| Hook events, matchers, response formats | references/hooks-reference.md |
| MCP server types, CLI, configuration | references/mcp-reference.md |
| Marketplace creation and distribution | references/marketplace-reference.md |
Common Tasks
Creating a New Plugin
- Create directory with
plugin.jsonat root - Add skills in
skills/skill-name/SKILL.md - Add commands in
commands/command-name.md - Test with
claude --plugin-dir ./my-plugin - Validate with
claude plugin validate .
Creating a Skill
- Create
skills/my-skill/SKILL.mdwith frontmatter - Write concise instructions (<500 lines)
- Add
references/for detailed documentation - Test by invoking
/my-skill
Adding Hooks
- Create
hooks/hooks.json - Define event matchers and hook types
- Restart Claude Code (hooks load at session start)
Creating a Marketplace
- Create
.claude-plugin/marketplace.jsonat repo root - Add plugins with
plugin.jsonat each plugin root - Test:
/plugin marketplace add ./my-marketplace
Development Methodology (Anthropic Engineering)
Evaluation-First Approach:
- Run representative tasks WITHOUT skills first
- Observe where Claude struggles or requires additional context
- Build skills incrementally to address specific gaps
- Use Claude-assisted skill authoring (ask Claude to draft skills after successful workflows)
Self-Reflection Pattern: After completing a task successfully, ask Claude:
"What worked well? Draft a SKILL.md that captures this workflow for next time."
Best Practices Checklist
- Plugin name is lowercase with hyphens, 3-64 characters
- Description includes trigger phrases for auto-discovery
- Description under 400 chars (not 1024 max) to preserve budget
- Description uses third person voice
- Secrets use environment variables, never hardcoded
- Main files are concise, details in reference files
- Uses
${CLAUDE_PLUGIN_ROOT}for all internal paths - Semantic versioning (MAJOR.MINOR.PATCH)
- README with examples
- Tested with Haiku, Sonnet, and Opus
- Skills trigger on expected phrases (test auto-activation)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?