Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for developing custom skills (plugins) for Claude Code from the official Anthropic repository.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: Skill Development3description: This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.4version: 0.1.05---67# Skill Development for Claude Code Plugins89This skill provides guidance for creating effective skills for Claude Code plugins.1011## About Skills1213Skills are modular, self-contained packages that extend Claude's capabilities by providing14specialized knowledge, workflows, and tools. Think of them as "onboarding guides" for specific15domains or tasks—they transform Claude from a general-purpose agent into a specialized agent16equipped with procedural knowledge that no model can fully possess.1718### What Skills Provide19201. Specialized workflows - Multi-step procedures for specific domains212. Tool integrations - Instructions for working with specific file formats or APIs223. Domain expertise - Company-specific knowledge, schemas, business logic234. Bundled resources - Scripts, references, and assets for complex and repetitive tasks2425### Anatomy of a Skill2627Every skill consists of a required SKILL.md file and optional bundled resources:2829```30skill-name/31├── SKILL.md (required)32│ ├── YAML frontmatter metadata (required)33│ │ ├── name: (required)34│ │ └── description: (required)35│ └── Markdown instructions (required)36└── Bundled Resources (optional)37├── scripts/ - Executable code (Python/Bash/etc.)38├── references/ - Documentation intended to be loaded into context as needed39└── assets/ - Files used in output (templates, icons, fonts, etc.)40```4142#### SKILL.md (required)4344**Metadata Quality:** The `name` and `description` in YAML frontmatter determine when Claude will use the skill. Be specific about what the skill does and when to use it. Use the third-person (e.g. "This skill should be used when..." instead of "Use this skill when...").4546#### Bundled Resources (optional)4748##### Scripts (`scripts/`)4950Executable code (Python/Bash/etc.) for tasks that require deterministic reliability or are repeatedly rewritten.5152- **When to include**: When the same code is being rewritten repeatedly or deterministic reliability is needed53- **Example**: `scripts/rotate_pdf.py` for PDF rotation tasks54- **Benefits**: Token efficient, deterministic, may be executed without loading into context55- **Note**: Scripts may still need to be read by Claude for patching or environment-specific adjustments5657##### References (`references/`)5859Documentation and reference material intended to be loaded as needed into context to inform Claude's process and thinking.6061- **When to include**: For documentation that Claude should reference while working62- **Examples**: `references/finance.md` for financial schemas, `references/mnda.md` for company NDA template, `references/policies.md` for company policies, `references/api_docs.md` for API specifications63- **Use cases**: Database schemas, API documentation, domain knowledge, company policies, detailed workflow guides64- **Benefits**: Keeps SKILL.md lean, loaded only when Claude determines it's needed65- **Best practice**: If files are large (>10k words), include grep search patterns in SKILL.md66- **Avoid duplication**: Information should live in either SKILL.md or references files, not both. Prefer references files for detailed information unless it's truly core to the skill—this keeps SKILL.md lean while making information discoverable without hogging the context window. Keep only essential procedural instructions and workflow guidance in SKILL.md; move detailed reference material, schemas, and examples to references files.6768##### Assets (`assets/`)6970Files not intended to be loaded into context, but rather used within the output Claude produces.7172- **When to include**: When the skill needs files that will be used in the final output73- **Examples**: `assets/logo.png` for brand assets, `assets/slides.pptx` for PowerPoint templates, `assets/frontend-template/` for HTML/React boilerplate, `assets/font.ttf` for typography74- **Use cases**: Templates, images, icons, boilerplate code, fonts, sample documents that get copied or modified75- **Benefits**: Separates output resources from documentation, enables Claude to use files without loading them into context7677### Progressive Disclosure Design Principle7879Skills use a three-level loading system to manage context efficiently:80811. **Metadata (name + description)** - Always in context (~100 words)822. **SKILL.md body** - When skill triggers (<5k words)833. **Bundled resources** - As needed by Claude (Unlimited*)8485*Unlimited because scripts can be executed without reading into context window.8687## Skill Creation Process8889To create a skill, follow the "Skill Creation Process" in order, skipping steps only if there is a clear reason why they are not applicable.9091### Step 1: Understanding the Skill with Concrete Examples9293Skip this step only when the skill's usage patterns are already clearly understood. It remains valuable even when working with an existing skill.9495To create an effective skill, clearly understand concrete examples of how the skill will be used. This understanding can come from either direct user examples or generated examples that are validated with user feedback.9697For example, when building an image-editor skill, relevant questions include:9899- "What functionality should the image-editor skill support? Editing, rotating, anything else?"100- "Can you give some examples of how this skill would be used?"101- "I can imagine users asking for things like 'Remove the red-eye from this image' or 'Rotate this image'. Are there other ways you imagine this skill being used?"102- "What would a user say that should trigger this skill?"103104To avoid overwhelming users, avoid asking too many questions in a single message. Start with the most important questions and follow up as needed for better effectiveness.105106Conclude this step when there is a clear sense of the functionality the skill should support.107108### Step 2: Planning the Reusable Skill Contents109110To turn concrete examples into an effective skill, analyze each example by:1111121. Considering how to execute on the example from scratch1132. Identifying what scripts, references, and assets would be helpful when executing these workflows repeatedly114115Example: When building a `pdf-editor` skill to handle queries like "Help me rotate this PDF," the analysis shows:1161171. Rotating a PDF requires re-writing the same code each time1182. A `scripts/rotate_pdf.py` script would be helpful to store in the skill119120Example: When designing a `frontend-webapp-builder` skill for queries like "Build me a todo app" or "Build me a dashboard to track my steps," the analysis shows:1211221. Writing a frontend webapp requires the same boilerplate HTML/React each time1232. An `assets/hello-world/` template containing the boilerplate HTML/React project files would be helpful to store in the skill124125Example: When building a `big-query` skill to handle queries like "How many users have logged in today?" the analysis shows:1261271. Querying BigQuery requires re-discovering the table schemas and relationships each time1282. A `references/schema.md` file documenting the table schemas would be helpful to store in the skill129130**For Claude Code plugins:** When building a hooks skill, the analysis shows:1311. Developers repeatedly need to validate hooks.json and test hook scripts1322. `scripts/validate-hook-schema.sh` and `scripts/test-hook.sh` utilities would be helpful1333. `references/patterns.md` for detailed hook patterns to avoid bloating SKILL.md134135To establish the skill's contents, analyze each concrete example to create a list of the reusable resources to include: scripts, references, and assets.136137### Step 3: Create Skill Structure138139For Claude Code plugins, create the skill directory structure:140141```bash142mkdir -p plugin-name/skills/skill-name/{references,examples,scripts}143touch plugin-name/skills/skill-name/SKILL.md144```145146**Note:** Unlike the generic skill-creator which uses `init_skill.py`, plugin skills are created directly in the plugin's `skills/` directory with a simpler manual structure.147148### Step 4: Edit the Skill149150When editing the (newly-created or existing) skill, remember that the skill is being created for another instance of Claude to use. Focus on including information that would be beneficial and non-obvious to Claude. Consider what procedural knowledge, domain-specific details, or reusable assets would help another Claude instance execute these tasks more effectively.151152#### Start with Reusable Skill Contents153154To begin implementation, start with the reusable resources identified above: `scripts/`, `references/`, and `assets/` files. Note that this step may require user input. For example, when implementing a `brand-guidelines` skill, the user may need to provide brand assets or templates to store in `assets/`, or documentation to store in `references/`.155156Also, delete any example files and directories not needed for the skill. Create only the directories you actually need (references/, examples/, scripts/).157158#### Update SKILL.md159160**Writing Style:** Write the entire skill using **imperative/infinitive form** (verb-first instructions), not second person. Use objective, instructional language (e.g., "To accomplish X, do Y" rather than "You should do X" or "If you need to do X"). This maintains consistency and clarity for AI consumption.161162**Description (Frontmatter):** Use third-person format with specific trigger phrases:163164```yaml165---166name: Skill Name167description: This skill should be used when the user asks to "specific phrase 1", "specific phrase 2", "specific phrase 3". Include exact phrases users would say that should trigger this skill. Be concrete and specific.168version: 0.1.0169---170```171172**Good description examples:**173```yaml174description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", "implement prompt-based hooks", or mentions hook events (PreToolUse, PostToolUse, Stop).175```176177**Bad description examples:**178```yaml179description: Use this skill when working with hooks. # Wrong person, vague180description: Load when user needs hook help. # Not third person181description: Provides hook guidance. # No trigger phrases182```183184To complete SKILL.md body, answer the following questions:1851861. What is the purpose of the skill, in a few sentences?1872. When should the skill be used? (Include this in frontmatter description with specific triggers)1883. In practice, how should Claude use the skill? All reusable skill contents developed above should be referenced so that Claude knows how to use them.189190**Keep SKILL.md lean:** Target 1,500-2,000 words for the body. Move detailed content to references/:191- Detailed patterns → `references/patterns.md`192- Advanced techniques → `references/advanced.md`193- Migration guides → `references/migration.md`194- API references → `references/api-reference.md`195196**Reference resources in SKILL.md:**197```markdown198## Additional Resources199200### Reference Files201202For detailed patterns and techniques, consult:203- **`references/patterns.md`** - Common patterns204- **`references/advanced.md`** - Advanced use cases205206### Example Files207208Working examples in `examples/`:209- **`example-script.sh`** - Working example210```211212### Step 5: Validate and Test213214**For plugin skills, validation is different from generic skills:**2152161. **Check structure**: Skill directory in `plugin-name/skills/skill-name/`2172. **Validate SKILL.md**: Has frontmatter with name and description2183. **Check trigger phrases**: Description includes specific user queries2194. **Verify writing style**: Body uses imperative/infinitive form, not second person2205. **Test progressive disclosure**: SKILL.md is lean (~1,500-2,000 words), detailed content in references/2216. **Check references**: All referenced files exist2227. **Validate examples**: Examples are complete and correct2238. **Test scripts**: Scripts are executable and work correctly224225**Use the skill-reviewer agent:**226```227Ask: "Review my skill and check if it follows best practices"228```229230The skill-reviewer agent will check description quality, content organization, and progressive disclosure.231232### Step 6: Iterate233234After testing the skill, users may request improvements. Often this happens right after using the skill, with fresh context of how the skill performed.235236**Iteration workflow:**2371. Use the skill on real tasks2382. Notice struggles or inefficiencies2393. Identify how SKILL.md or bundled resources should be updated2404. Implement changes and test again241242**Common improvements:**243- Strengthen trigger phrases in description244- Move long sections from SKILL.md to references/245- Add missing examples or scripts246- Clarify ambiguous instructions247- Add edge case handling248249## Plugin-Specific Considerations250251### Skill Location in Plugins252253Plugin skills live in the plugin's `skills/` directory:254255```256my-plugin/257├── .claude-plugin/258│ └── plugin.json259├── commands/260├── agents/261└── skills/262└── my-skill/263├── SKILL.md264├── references/265├── examples/266└── scripts/267```268269### Auto-Discovery270271Claude Code automatically discovers skills:272- Scans `skills/` directory273- Finds subdirectories containing `SKILL.md`274- Loads skill metadata (name + description) always275- Loads SKILL.md body when skill triggers276- Loads references/examples when needed277278### No Packaging Needed279280Plugin skills are distributed as part of the plugin, not as separate ZIP files. Users get skills when they install the plugin.281282### Testing in Plugins283284Test skills by installing plugin locally:285286```bash287# Test with --plugin-dir288cc --plugin-dir /path/to/plugin289290# Ask questions that should trigger the skill291# Verify skill loads correctly292```293294## Examples from Plugin-Dev295296Study the skills in this plugin as examples of best practices:297298**hook-development skill:**299- Excellent trigger phrases: "create a hook", "add a PreToolUse hook", etc.300- Lean SKILL.md (1,651 words)301- 3 references/ files for detailed content302- 3 examples/ of working hooks303- 3 scripts/ utilities304305**agent-development skill:**306- Strong triggers: "create an agent", "agent frontmatter", etc.307- Focused SKILL.md (1,438 words)308- References include the AI generation prompt from Claude Code309- Complete agent examples310311**plugin-settings skill:**312- Specific triggers: "plugin settings", ".local.md files", "YAML frontmatter"313- References show real implementations (multi-agent-swarm, ralph-wiggum)314- Working parsing scripts315316Each demonstrates progressive disclosure and strong triggering.317318## Progressive Disclosure in Practice319320### What Goes in SKILL.md321322**Include (always loaded when skill triggers):**323- Core concepts and overview324- Essential procedures and workflows325- Quick reference tables326- Pointers to references/examples/scripts327- Most common use cases328329**Keep under 3,000 words, ideally 1,500-2,000 words**330331### What Goes in references/332333**Move to references/ (loaded as needed):**334- Detailed patterns and advanced techniques335- Comprehensive API documentation336- Migration guides337- Edge cases and troubleshooting338- Extensive examples and walkthroughs339340**Each reference file can be large (2,000-5,000+ words)**341342### What Goes in examples/343344**Working code examples:**345- Complete, runnable scripts346- Configuration files347- Template files348- Real-world usage examples349350**Users can copy and adapt these directly**351352### What Goes in scripts/353354**Utility scripts:**355- Validation tools356- Testing helpers357- Parsing utilities358- Automation scripts359360**Should be executable and documented**361362## Writing Style Requirements363364### Imperative/Infinitive Form365366Write using verb-first instructions, not second person:367368**Correct (imperative):**369```370To create a hook, define the event type.371Configure the MCP server with authentication.372Validate settings before use.373```374375**Incorrect (second person):**376```377You should create a hook by defining the event type.378You need to configure the MCP server.379You must validate settings before use.380```381382### Third-Person in Description383384The frontmatter description must use third person:385386**Correct:**387```yaml388description: This skill should be used when the user asks to "create X", "configure Y"...389```390391**Incorrect:**392```yaml393description: Use this skill when you want to create X...394description: Load this skill when user asks...395```396397### Objective, Instructional Language398399Focus on what to do, not who should do it:400401**Correct:**402```403Parse the frontmatter using sed.404Extract fields with grep.405Validate values before use.406```407408**Incorrect:**409```410You can parse the frontmatter...411Claude should extract fields...412The user might validate values...413```414415## Validation Checklist416417Before finalizing a skill:418419**Structure:**420- [ ] SKILL.md file exists with valid YAML frontmatter421- [ ] Frontmatter has `name` and `description` fields422- [ ] Markdown body is present and substantial423- [ ] Referenced files actually exist424425**Description Quality:**426- [ ] Uses third person ("This skill should be used when...")427- [ ] Includes specific trigger phrases users would say428- [ ] Lists concrete scenarios ("create X", "configure Y")429- [ ] Not vague or generic430431**Content Quality:**432- [ ] SKILL.md body uses imperative/infinitive form433- [ ] Body is focused and lean (1,500-2,000 words ideal, <5k max)434- [ ] Detailed content moved to references/435- [ ] Examples are complete and working436- [ ] Scripts are executable and documented437438**Progressive Disclosure:**439- [ ] Core concepts in SKILL.md440- [ ] Detailed docs in references/441- [ ] Working code in examples/442- [ ] Utilities in scripts/443- [ ] SKILL.md references these resources444445**Testing:**446- [ ] Skill triggers on expected user queries447- [ ] Content is helpful for intended tasks448- [ ] No duplicated information across files449- [ ] References load when needed450451## Common Mistakes to Avoid452453### Mistake 1: Weak Trigger Description454455❌ **Bad:**456```yaml457description: Provides guidance for working with hooks.458```459460**Why bad:** Vague, no specific trigger phrases, not third person461462✅ **Good:**463```yaml464description: This skill should be used when the user asks to "create a hook", "add a PreToolUse hook", "validate tool use", or mentions hook events. Provides comprehensive hooks API guidance.465```466467**Why good:** Third person, specific phrases, concrete scenarios468469### Mistake 2: Too Much in SKILL.md470471❌ **Bad:**472```473skill-name/474└── SKILL.md (8,000 words - everything in one file)475```476477**Why bad:** Bloats context when skill loads, detailed content always loaded478479✅ **Good:**480```481skill-name/482├── SKILL.md (1,800 words - core essentials)483└── references/484├── patterns.md (2,500 words)485└── advanced.md (3,700 words)486```487488**Why good:** Progressive disclosure, detailed content loaded only when needed489490### Mistake 3: Second Person Writing491492❌ **Bad:**493```markdown494You should start by reading the configuration file.495You need to validate the input.496You can use the grep tool to search.497```498499**Why bad:** Second person, not imperative form500501✅ **Good:**502```markdown503Start by reading the configuration file.504Validate the input before processing.505Use the grep tool to search for patterns.506```507508**Why good:** Imperative form, direct instructions509510### Mistake 4: Missing Resource References511512❌ **Bad:**513```markdown514# SKILL.md515516[Core content]517518[No mention of references/ or examples/]519```520521**Why bad:** Claude doesn't know references exist522523✅ **Good:**524```markdown525# SKILL.md526527[Core content]528529## Additional Resources530531### Reference Files532- **`references/patterns.md`** - Detailed patterns533- **`references/advanced.md`** - Advanced techniques534535### Examples536- **`examples/script.sh`** - Working example537```538539**Why good:** Claude knows where to find additional information540541## Quick Reference542543### Minimal Skill544545```546skill-name/547└── SKILL.md548```549550Good for: Simple knowledge, no complex resources needed551552### Standard Skill (Recommended)553554```555skill-name/556├── SKILL.md557├── references/558│ └── detailed-guide.md559└── examples/560└── working-example.sh561```562563Good for: Most plugin skills with detailed documentation564565### Complete Skill566567```568skill-name/569├── SKILL.md570├── references/571│ ├── patterns.md572│ └── advanced.md573├── examples/574│ ├── example1.sh575│ └── example2.json576└── scripts/577└── validate.sh578```579580Good for: Complex domains with validation utilities581582## Best Practices Summary583584✅ **DO:**585- Use third-person in description ("This skill should be used when...")586- Include specific trigger phrases ("create X", "configure Y")587- Keep SKILL.md lean (1,500-2,000 words)588- Use progressive disclosure (move details to references/)589- Write in imperative/infinitive form590- Reference supporting files clearly591- Provide working examples592- Create utility scripts for common operations593- Study plugin-dev's skills as templates594595❌ **DON'T:**596- Use second person anywhere597- Have vague trigger conditions598- Put everything in SKILL.md (>3,000 words without references/)599- Write in second person ("You should...")600- Leave resources unreferenced601- Include broken or incomplete examples602- Skip validation603604## Additional Resources605606### Study These Skills607608Plugin-dev's skills demonstrate best practices:609- `../hook-development/` - Progressive disclosure, utilities610- `../agent-development/` - AI-assisted creation, references611- `../mcp-integration/` - Comprehensive references612- `../plugin-settings/` - Real-world examples613- `../command-development/` - Clear critical concepts614- `../plugin-structure/` - Good organization615616### Reference Files617618For complete skill-creator methodology:619- **`references/skill-creator-original.md`** - Full original skill-creator content620621## Implementation Workflow622623To create a skill for your plugin:6246251. **Understand use cases**: Identify concrete examples of skill usage6262. **Plan resources**: Determine what scripts/references/examples needed6273. **Create structure**: `mkdir -p skills/skill-name/{references,examples,scripts}`6284. **Write SKILL.md**:629- Frontmatter with third-person description and trigger phrases630- Lean body (1,500-2,000 words) in imperative form631- Reference supporting files6325. **Add resources**: Create references/, examples/, scripts/ as needed6336. **Validate**: Check description, writing style, organization6347. **Test**: Verify skill loads on expected triggers6358. **Iterate**: Improve based on usage636637Focus on strong trigger descriptions, progressive disclosure, and imperative writing style for effective skills that load when needed and provide targeted guidance.638