Create and manage Claude Code skills following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns, file paths, content patterns), enforcement levels (block, suggest, warn), hook mechanisms (UserPromptSubmit, PreToolUse), session tracking, and the 500-line rule.
Add this skill
npx mdskills install sickn33/skill-developerComprehensive meta-skill for building Claude Code skills with excellent progressive disclosure architecture
1---2name: skill-developer3description: Create and manage Claude Code skills following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns, file paths, content patterns), enforcement levels (block, suggest, warn), hook mechanisms (UserPromptSubmit, PreToolUse), session tracking, and the 500-line rule.4---56# Skill Developer Guide78## Purpose910Comprehensive guide for creating and managing skills in Claude Code with auto-activation system, following Anthropic's official best practices including the 500-line rule and progressive disclosure pattern.1112## When to Use This Skill1314Automatically activates when you mention:15- Creating or adding skills16- Modifying skill triggers or rules17- Understanding how skill activation works18- Debugging skill activation issues19- Working with skill-rules.json20- Hook system mechanics21- Claude Code best practices22- Progressive disclosure23- YAML frontmatter24- 500-line rule2526---2728## System Overview2930### Two-Hook Architecture3132**1. UserPromptSubmit Hook** (Proactive Suggestions)33- **File**: `.claude/hooks/skill-activation-prompt.ts`34- **Trigger**: BEFORE Claude sees user's prompt35- **Purpose**: Suggest relevant skills based on keywords + intent patterns36- **Method**: Injects formatted reminder as context (stdout → Claude's input)37- **Use Cases**: Topic-based skills, implicit work detection3839**2. Stop Hook - Error Handling Reminder** (Gentle Reminders)40- **File**: `.claude/hooks/error-handling-reminder.ts`41- **Trigger**: AFTER Claude finishes responding42- **Purpose**: Gentle reminder to self-assess error handling in code written43- **Method**: Analyzes edited files for risky patterns, displays reminder if needed44- **Use Cases**: Error handling awareness without blocking friction4546**Philosophy Change (2025-10-27):** We moved away from blocking PreToolUse for Sentry/error handling. Instead, use gentle post-response reminders that don't block workflow but maintain code quality awareness.4748### Configuration File4950**Location**: `.claude/skills/skill-rules.json`5152Defines:53- All skills and their trigger conditions54- Enforcement levels (block, suggest, warn)55- File path patterns (glob)56- Content detection patterns (regex)57- Skip conditions (session tracking, file markers, env vars)5859---6061## Skill Types6263### 1. Guardrail Skills6465**Purpose:** Enforce critical best practices that prevent errors6667**Characteristics:**68- Type: `"guardrail"`69- Enforcement: `"block"`70- Priority: `"critical"` or `"high"`71- Block file edits until skill used72- Prevent common mistakes (column names, critical errors)73- Session-aware (don't repeat nag in same session)7475**Examples:**76- `database-verification` - Verify table/column names before Prisma queries77- `frontend-dev-guidelines` - Enforce React/TypeScript patterns7879**When to Use:**80- Mistakes that cause runtime errors81- Data integrity concerns82- Critical compatibility issues8384### 2. Domain Skills8586**Purpose:** Provide comprehensive guidance for specific areas8788**Characteristics:**89- Type: `"domain"`90- Enforcement: `"suggest"`91- Priority: `"high"` or `"medium"`92- Advisory, not mandatory93- Topic or domain-specific94- Comprehensive documentation9596**Examples:**97- `backend-dev-guidelines` - Node.js/Express/TypeScript patterns98- `frontend-dev-guidelines` - React/TypeScript best practices99- `error-tracking` - Sentry integration guidance100101**When to Use:**102- Complex systems requiring deep knowledge103- Best practices documentation104- Architectural patterns105- How-to guides106107---108109## Quick Start: Creating a New Skill110111### Step 1: Create Skill File112113**Location:** `.claude/skills/{skill-name}/SKILL.md`114115**Template:**116```markdown117---118name: my-new-skill119description: Brief description including keywords that trigger this skill. Mention topics, file types, and use cases. Be explicit about trigger terms.120---121122# My New Skill123124## Purpose125What this skill helps with126127## When to Use128Specific scenarios and conditions129130## Key Information131The actual guidance, documentation, patterns, examples132```133134**Best Practices:**135- ✅ **Name**: Lowercase, hyphens, gerund form (verb + -ing) preferred136- ✅ **Description**: Include ALL trigger keywords/phrases (max 1024 chars)137- ✅ **Content**: Under 500 lines - use reference files for details138- ✅ **Examples**: Real code examples139- ✅ **Structure**: Clear headings, lists, code blocks140141### Step 2: Add to skill-rules.json142143See [SKILL_RULES_REFERENCE.md](SKILL_RULES_REFERENCE.md) for complete schema.144145**Basic Template:**146```json147{148 "my-new-skill": {149 "type": "domain",150 "enforcement": "suggest",151 "priority": "medium",152 "promptTriggers": {153 "keywords": ["keyword1", "keyword2"],154 "intentPatterns": ["(create|add).*?something"]155 }156 }157}158```159160### Step 3: Test Triggers161162**Test UserPromptSubmit:**163```bash164echo '{"session_id":"test","prompt":"your test prompt"}' | \165 npx tsx .claude/hooks/skill-activation-prompt.ts166```167168**Test PreToolUse:**169```bash170cat <<'EOF' | npx tsx .claude/hooks/skill-verification-guard.ts171{"session_id":"test","tool_name":"Edit","tool_input":{"file_path":"test.ts"}}172EOF173```174175### Step 4: Refine Patterns176177Based on testing:178- Add missing keywords179- Refine intent patterns to reduce false positives180- Adjust file path patterns181- Test content patterns against actual files182183### Step 5: Follow Anthropic Best Practices184185✅ Keep SKILL.md under 500 lines186✅ Use progressive disclosure with reference files187✅ Add table of contents to reference files > 100 lines188✅ Write detailed description with trigger keywords189✅ Test with 3+ real scenarios before documenting190✅ Iterate based on actual usage191192---193194## Enforcement Levels195196### BLOCK (Critical Guardrails)197198- Physically prevents Edit/Write tool execution199- Exit code 2 from hook, stderr → Claude200- Claude sees message and must use skill to proceed201- **Use For**: Critical mistakes, data integrity, security issues202203**Example:** Database column name verification204205### SUGGEST (Recommended)206207- Reminder injected before Claude sees prompt208- Claude is aware of relevant skills209- Not enforced, just advisory210- **Use For**: Domain guidance, best practices, how-to guides211212**Example:** Frontend development guidelines213214### WARN (Optional)215216- Low priority suggestions217- Advisory only, minimal enforcement218- **Use For**: Nice-to-have suggestions, informational reminders219220**Rarely used** - most skills are either BLOCK or SUGGEST.221222---223224## Skip Conditions & User Control225226### 1. Session Tracking227228**Purpose:** Don't nag repeatedly in same session229230**How it works:**231- First edit → Hook blocks, updates session state232- Second edit (same session) → Hook allows233- Different session → Blocks again234235**State File:** `.claude/hooks/state/skills-used-{session_id}.json`236237### 2. File Markers238239**Purpose:** Permanent skip for verified files240241**Marker:** `// @skip-validation`242243**Usage:**244```typescript245// @skip-validation246import { PrismaService } from './prisma';247// This file has been manually verified248```249250**NOTE:** Use sparingly - defeats the purpose if overused251252### 3. Environment Variables253254**Purpose:** Emergency disable, temporary override255256**Global disable:**257```bash258export SKIP_SKILL_GUARDRAILS=true # Disables ALL PreToolUse blocks259```260261**Skill-specific:**262```bash263export SKIP_DB_VERIFICATION=true264export SKIP_ERROR_REMINDER=true265```266267---268269## Testing Checklist270271When creating a new skill, verify:272273- [ ] Skill file created in `.claude/skills/{name}/SKILL.md`274- [ ] Proper frontmatter with name and description275- [ ] Entry added to `skill-rules.json`276- [ ] Keywords tested with real prompts277- [ ] Intent patterns tested with variations278- [ ] File path patterns tested with actual files279- [ ] Content patterns tested against file contents280- [ ] Block message is clear and actionable (if guardrail)281- [ ] Skip conditions configured appropriately282- [ ] Priority level matches importance283- [ ] No false positives in testing284- [ ] No false negatives in testing285- [ ] Performance is acceptable (<100ms or <200ms)286- [ ] JSON syntax validated: `jq . skill-rules.json`287- [ ] **SKILL.md under 500 lines** ⭐288- [ ] Reference files created if needed289- [ ] Table of contents added to files > 100 lines290291---292293## Reference Files294295For detailed information on specific topics, see:296297### [TRIGGER_TYPES.md](TRIGGER_TYPES.md)298Complete guide to all trigger types:299- Keyword triggers (explicit topic matching)300- Intent patterns (implicit action detection)301- File path triggers (glob patterns)302- Content patterns (regex in files)303- Best practices and examples for each304- Common pitfalls and testing strategies305306### [SKILL_RULES_REFERENCE.md](SKILL_RULES_REFERENCE.md)307Complete skill-rules.json schema:308- Full TypeScript interface definitions309- Field-by-field explanations310- Complete guardrail skill example311- Complete domain skill example312- Validation guide and common errors313314### [HOOK_MECHANISMS.md](HOOK_MECHANISMS.md)315Deep dive into hook internals:316- UserPromptSubmit flow (detailed)317- PreToolUse flow (detailed)318- Exit code behavior table (CRITICAL)319- Session state management320- Performance considerations321322### [TROUBLESHOOTING.md](TROUBLESHOOTING.md)323Comprehensive debugging guide:324- Skill not triggering (UserPromptSubmit)325- PreToolUse not blocking326- False positives (too many triggers)327- Hook not executing at all328- Performance issues329330### [PATTERNS_LIBRARY.md](PATTERNS_LIBRARY.md)331Ready-to-use pattern collection:332- Intent pattern library (regex)333- File path pattern library (glob)334- Content pattern library (regex)335- Organized by use case336- Copy-paste ready337338### [ADVANCED.md](ADVANCED.md)339Future enhancements and ideas:340- Dynamic rule updates341- Skill dependencies342- Conditional enforcement343- Skill analytics344- Skill versioning345346---347348## Quick Reference Summary349350### Create New Skill (5 Steps)3513521. Create `.claude/skills/{name}/SKILL.md` with frontmatter3532. Add entry to `.claude/skills/skill-rules.json`3543. Test with `npx tsx` commands3554. Refine patterns based on testing3565. Keep SKILL.md under 500 lines357358### Trigger Types359360- **Keywords**: Explicit topic mentions361- **Intent**: Implicit action detection362- **File Paths**: Location-based activation363- **Content**: Technology-specific detection364365See [TRIGGER_TYPES.md](TRIGGER_TYPES.md) for complete details.366367### Enforcement368369- **BLOCK**: Exit code 2, critical only370- **SUGGEST**: Inject context, most common371- **WARN**: Advisory, rarely used372373### Skip Conditions374375- **Session tracking**: Automatic (prevents repeated nags)376- **File markers**: `// @skip-validation` (permanent skip)377- **Env vars**: `SKIP_SKILL_GUARDRAILS` (emergency disable)378379### Anthropic Best Practices380381✅ **500-line rule**: Keep SKILL.md under 500 lines382✅ **Progressive disclosure**: Use reference files for details383✅ **Table of contents**: Add to reference files > 100 lines384✅ **One level deep**: Don't nest references deeply385✅ **Rich descriptions**: Include all trigger keywords (max 1024 chars)386✅ **Test first**: Build 3+ evaluations before extensive documentation387✅ **Gerund naming**: Prefer verb + -ing (e.g., "processing-pdfs")388389### Troubleshoot390391Test hooks manually:392```bash393# UserPromptSubmit394echo '{"prompt":"test"}' | npx tsx .claude/hooks/skill-activation-prompt.ts395396# PreToolUse397cat <<'EOF' | npx tsx .claude/hooks/skill-verification-guard.ts398{"tool_name":"Edit","tool_input":{"file_path":"test.ts"}}399EOF400```401402See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for complete debugging guide.403404---405406## Related Files407408**Configuration:**409- `.claude/skills/skill-rules.json` - Master configuration410- `.claude/hooks/state/` - Session tracking411- `.claude/settings.json` - Hook registration412413**Hooks:**414- `.claude/hooks/skill-activation-prompt.ts` - UserPromptSubmit415- `.claude/hooks/error-handling-reminder.ts` - Stop event (gentle reminders)416417**All Skills:**418- `.claude/skills/*/SKILL.md` - Skill content files419420---421422**Skill Status**: COMPLETE - Restructured following Anthropic best practices ✅423**Line Count**: < 500 (following 500-line rule) ✅424**Progressive Disclosure**: Reference files for detailed information ✅425426**Next**: Create more skills, refine patterns based on usage427
Full transparency — inspect the skill content before installing.