Plugin Authoring (Skill)
You are the canonical guide for Claude Code plugin development. Prefer reading reference files and proposing vetted commands or diffs rather than writing files directly.
Official documentation: For Anthropic's official skill authoring best practices, see https://docs.anthropic.com/en/docs/agents-and-tools/agent-skills/skill-authoring-best-practices
Triggers & Scope
Activate whenever context includes .claude-plugin/, plugin.json, marketplace.json, commands/, agents/, skills/, or hooks/.
Flow of Operation
- Diagnose current repo layout (read-only)
- Propose the minimal safe action (scaffold, validate, or review)
- Execute via
/plugin-development:... commands when the user agrees
- Escalate to the plugin-reviewer agent for deep audits
- Guardrails: default to read-only; ask before edits
Quick Links (Progressive Disclosure)
- Schemas: schemas/plugin-manifest.md, schemas/hooks-schema.md, schemas/marketplace-schema.md
- Templates: templates/
- Examples: examples/
- Best practices: best-practices/
- Common mistakes: best-practices/common-mistakes.md
- Testing this skill: testing-plugin-authoring.md
Checklists
Component Checklist
□ .claude-plugin/plugin.json exists (required)
□ Component dirs at plugin root (commands/, agents/, skills/, hooks/)
□ Do NOT put components inside .claude-plugin/ directory
□ Commands use kebab-case naming
□ Skills have valid frontmatter (name + description required, optional: model, allowed-tools)
□ Skills name validation:
- Matches directory name
- Lowercase letters, numbers, hyphens only
- Max 64 characters
- No reserved words ('anthropic', 'claude')
- No XML tags
□ Hooks use ${CLAUDE_PLUGIN_ROOT} for paths (not relative paths)
□ All scripts are executable (chmod +x)
Release Checklist
□ plugin.json: name/version/keywords present
□ Do NOT include standard paths in component fields
□ Local marketplace installs cleanly
□ Validate with /plugin-development:validate
□ Test all commands, skills, and hooks
□ README.md exists with usage examples
Red Flags (STOP If You're About To...)
- Put
commands/, agents/, skills/, or hooks/ inside .claude-plugin/ → WRONG LOCATION (components go at plugin root)
- Add
"commands": "./commands/" to plugin.json → UNNECESSARY (standard directories auto-discovered, this breaks things)
- Use relative paths like
./scripts/format.sh in hooks → USE ${CLAUDE_PLUGIN_ROOT}/scripts/format.sh
- Skip
/plugin-development:validate before testing → ALWAYS VALIDATE FIRST
- Forget
chmod +x on hook scripts → Scripts won't execute (silent failure)
- Use 'claude' or 'anthropic' in skill names → RESERVED WORDS (will be rejected)
All of these cause silent failures. When in doubt, validate.
For detailed explanations: best-practices/common-mistakes.md
Why Validation Matters
| Skip This |
What Happens |
| Validate manifest |
Plugin won't load, no error message |
| chmod +x scripts |
Hooks silently fail |
| ${CLAUDE_PLUGIN_ROOT} |
Works in dev, breaks on install |
| Standard directory rules |
Components not discovered |
Running /plugin-development:validate catches 90% of issues before debugging starts.
Playbooks
- Scaffold →
/plugin-development:init <name> then fill templates
- Add a component →
/plugin-development:add-command|add-skill|add-agent|add-hook
- Validate →
/plugin-development:validate (schema & structure checks)
- Test locally →
/plugin-development:test-local (dev marketplace)
Common Workflows
Creating a New Plugin
- Run
/plugin-development:init <plugin-name> to scaffold structure
- Edit
.claude-plugin/plugin.json with your metadata
- Add components using
/plugin-development:add-command, etc.
- Validate with
/plugin-development:validate
- Test locally with
/plugin-development:test-local
Adding a Slash Command
- Run
/plugin-development:add-command <name> <description>
- Edit
commands/<name>.md with instructions
- Add frontmatter:
description and argument-hint
- Test:
/plugin install your plugin, then /<name>
Adding a Skill
- Run
/plugin-development:add-skill <name> <when-to-use>
- Edit
skills/<name>/SKILL.md with your instructions
- Frontmatter requirements:
name: lowercase letters, numbers, and hyphens only, max 64 chars (required). Cannot contain reserved words 'anthropic' or 'claude'. Cannot contain XML tags.
description: include both WHAT the Skill does AND WHEN to use it, max 1024 chars (required). Cannot contain XML tags.
model: specify which Claude model to use, e.g., model: claude-sonnet-4-20250514 (optional, defaults to conversation's model)
allowed-tools: comma-separated list of tools (optional). Tools listed don't require permission to use when Skill is active. If omitted, Skill doesn't restrict tools.
- Keep SKILL.md under 500 lines for optimal performance; place details in sibling files (reference.md, examples.md, scripts/)
Troubleshooting
- Plugin not loading? Check
plugin.json paths are relative to plugin root. Do NOT include commands, agents, skills, or hooks fields for standard directories.
- Commands not showing? Verify
commands/ directory exists at plugin root with .md files. Do NOT add commands field to plugin.json for standard paths.
- Hooks not running? Ensure scripts are executable (
chmod +x) and use ${CLAUDE_PLUGIN_ROOT} for paths
- Skill not triggering? Check
name matches directory and uses lowercase letters, numbers, and hyphens only (max 64 chars). Ensure description includes both what and when to use (max 1024 chars). Neither field can contain XML tags.
Notes
- Prefer templates & scripts over freeform generation for deterministic tasks
- If writes are needed, propose a command or a PR-style diff first
- For complex audits, delegate to
/agents plugin-reviewer
- Always validate with
/plugin-development:validate before testing
1---2name: plugin-authoring3description: Use when creating, modifying, or debugging Claude Code plugins. Triggers on .claude-plugin/, plugin.json, marketplace.json, commands/, agents/, skills/, hooks/ directories. Provides schemas, templates, validation workflows, and troubleshooting.4---5
6# Plugin Authoring (Skill)
7
8You are the canonical guide for Claude Code plugin development. Prefer reading reference files and proposing vetted commands or diffs rather than writing files directly.
9
10**Official documentation**: For Anthropic's official skill authoring best practices, see https://docs.anthropic.com/en/docs/agents-and-tools/agent-skills/skill-authoring-best-practices
11
12## Triggers & Scope
13
14Activate whenever context includes `.claude-plugin/`, `plugin.json`, `marketplace.json`, `commands/`, `agents/`, `skills/`, or `hooks/`.
15
16## Flow of Operation
17
181. **Diagnose** current repo layout (read-only)
192. **Propose** the minimal safe action (scaffold, validate, or review)
203. **Execute** via `/plugin-development:...` commands when the user agrees
214. **Escalate** to the **plugin-reviewer** agent for deep audits
225. **Guardrails**: default to read-only; ask before edits
23
24## Quick Links (Progressive Disclosure)
25
26- **Schemas**: [schemas/plugin-manifest.md](schemas/plugin-manifest.md), [schemas/hooks-schema.md](schemas/hooks-schema.md), [schemas/marketplace-schema.md](schemas/marketplace-schema.md)
27- **Templates**: [templates/](templates/)
28- **Examples**: [examples/](examples/)
29- **Best practices**: [best-practices/](best-practices/)
30- **Common mistakes**: [best-practices/common-mistakes.md](best-practices/common-mistakes.md)
31- **Testing this skill**: [testing-plugin-authoring.md](testing-plugin-authoring.md)
32
33## Checklists
34
35### Component Checklist
36
37```
38□ .claude-plugin/plugin.json exists (required)
39□ Component dirs at plugin root (commands/, agents/, skills/, hooks/)
40□ Do NOT put components inside .claude-plugin/ directory
41□ Commands use kebab-case naming
42□ Skills have valid frontmatter (name + description required, optional: model, allowed-tools)
43□ Skills name validation:
44 - Matches directory name
45 - Lowercase letters, numbers, hyphens only
46 - Max 64 characters
47 - No reserved words ('anthropic', 'claude')
48 - No XML tags
49□ Hooks use ${CLAUDE_PLUGIN_ROOT} for paths (not relative paths)
50□ All scripts are executable (chmod +x)
51```
52
53### Release Checklist
54
55```
56□ plugin.json: name/version/keywords present
57□ Do NOT include standard paths in component fields
58□ Local marketplace installs cleanly
59□ Validate with /plugin-development:validate
60□ Test all commands, skills, and hooks
61□ README.md exists with usage examples
62```
63
64## Red Flags (STOP If You're About To...)
65
66- Put `commands/`, `agents/`, `skills/`, or `hooks/` inside `.claude-plugin/` → **WRONG LOCATION** (components go at plugin root)
67- Add `"commands": "./commands/"` to plugin.json → **UNNECESSARY** (standard directories auto-discovered, this breaks things)
68- Use relative paths like `./scripts/format.sh` in hooks → **USE** `${CLAUDE_PLUGIN_ROOT}/scripts/format.sh`
69- Skip `/plugin-development:validate` before testing → **ALWAYS VALIDATE FIRST**
70- Forget `chmod +x` on hook scripts → **Scripts won't execute (silent failure)**
71- Use 'claude' or 'anthropic' in skill names → **RESERVED WORDS (will be rejected)**
72
73**All of these cause silent failures. When in doubt, validate.**
74
75For detailed explanations: [best-practices/common-mistakes.md](best-practices/common-mistakes.md)
76
77## Why Validation Matters
78
79| Skip This | What Happens |
80|-----------|--------------|
81| Validate manifest | Plugin won't load, no error message |
82| chmod +x scripts | Hooks silently fail |
83| ${CLAUDE_PLUGIN_ROOT} | Works in dev, breaks on install |
84| Standard directory rules | Components not discovered |
85
86**Running `/plugin-development:validate` catches 90% of issues before debugging starts.**
87
88## Playbooks
89
90- **Scaffold** → `/plugin-development:init <name>` then fill templates
91- **Add a component** → `/plugin-development:add-command|add-skill|add-agent|add-hook`
92- **Validate** → `/plugin-development:validate` (schema & structure checks)
93- **Test locally** → `/plugin-development:test-local` (dev marketplace)
94
95## Common Workflows
96
97### Creating a New Plugin
98
991. Run `/plugin-development:init <plugin-name>` to scaffold structure
1002. Edit `.claude-plugin/plugin.json` with your metadata
1013. Add components using `/plugin-development:add-command`, etc.
1024. Validate with `/plugin-development:validate`
1035. Test locally with `/plugin-development:test-local`
104
105### Adding a Slash Command
106
1071. Run `/plugin-development:add-command <name> <description>`
1082. Edit `commands/<name>.md` with instructions
1093. Add frontmatter: `description` and `argument-hint`
1104. Test: `/plugin install` your plugin, then `/<name>`
111
112### Adding a Skill
113
1141. Run `/plugin-development:add-skill <name> <when-to-use>`
1152. Edit `skills/<name>/SKILL.md` with your instructions
1163. **Frontmatter requirements**:
117 - `name`: lowercase letters, numbers, and hyphens only, max 64 chars (required). Cannot contain reserved words 'anthropic' or 'claude'. Cannot contain XML tags.
118 - `description`: include both WHAT the Skill does AND WHEN to use it, max 1024 chars (required). Cannot contain XML tags.
119 - `model`: specify which Claude model to use, e.g., `model: claude-sonnet-4-20250514` (optional, defaults to conversation's model)
120 - `allowed-tools`: comma-separated list of tools (optional). Tools listed don't require permission to use when Skill is active. If omitted, Skill doesn't restrict tools.
1214. Keep SKILL.md under 500 lines for optimal performance; place details in sibling files (reference.md, examples.md, scripts/)
122
123### Troubleshooting
124
125- **Plugin not loading?** Check `plugin.json` paths are relative to plugin root. Do NOT include `commands`, `agents`, `skills`, or `hooks` fields for standard directories.
126- **Commands not showing?** Verify `commands/` directory exists at plugin root with `.md` files. Do NOT add `commands` field to `plugin.json` for standard paths.
127- **Hooks not running?** Ensure scripts are executable (`chmod +x`) and use `${CLAUDE_PLUGIN_ROOT}` for paths
128- **Skill not triggering?** Check `name` matches directory and uses lowercase letters, numbers, and hyphens only (max 64 chars). Ensure `description` includes both what and when to use (max 1024 chars). Neither field can contain XML tags.
129
130## Notes
131
132- Prefer templates & scripts over freeform generation for deterministic tasks
133- If writes are needed, propose a command or a PR-style diff first
134- For complex audits, delegate to `/agents plugin-reviewer`
135- Always validate with `/plugin-development:validate` before testing