| name | skill-developer |
| description | Create, modify, and manage Claude Code skills. Covers SKILL.md YAML frontmatter, skill-rules.json trigger patterns (keywords/intent/path/content), enforcement levels (block/suggest/warn), hook mechanisms (UserPromptSubmit/PreToolUse), session tracking, and 500-line rule with resources/ progressive disclosure. |
| triggers | ["skill system","create skill","add skill","skill triggers","skill rules","hook system","skill development","skill-rules.json","SKILL.md","skill activation"] |
Skill Developer Guide
Purpose
Comprehensive 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.
When to Use This Skill
Automatically activates when you mention:
- Creating or adding skills
- Modifying skill triggers or rules
- Understanding how skill activation works
- Debugging skill activation issues
- Working with skill-rules.json
- Hook system mechanics
- Claude Code best practices
- Progressive disclosure
- YAML frontmatter
- 500-line rule
System Overview
Two-Hook Architecture
1. UserPromptSubmit Hook (Proactive Suggestions)
- File:
.claude/hooks/skill-activation-prompt.ts
- Trigger: BEFORE Claude sees user's prompt
- Purpose: Suggest relevant skills based on keywords + intent patterns
- Method: Injects formatted reminder as context (stdout โ Claude's input)
- Use Cases: Topic-based skills, implicit work detection
2. Stop Hook - Error Handling Reminder (Gentle Reminders)
- File:
.claude/hooks/error-handling-reminder.ts
- Trigger: AFTER Claude finishes responding
- Purpose: Gentle reminder to self-assess error handling in code written
- Method: Analyzes edited files for risky patterns, displays reminder if needed
- Use Cases: Error handling awareness without blocking friction
Design Decision: Blocking PreToolUse hooks create workflow friction. Prefer gentle post-response reminders (Stop hook) that maintain code quality awareness without interrupting the developer flow.
Configuration File
Location: .claude/skills/skill-rules.json
Defines:
- All skills and their trigger conditions
- Enforcement levels (block, suggest, warn)
- File path patterns (glob)
- Content detection patterns (regex)
- Skip conditions (session tracking, file markers, env vars)
Skill Types
1. Guardrail Skills
Purpose: Enforce critical best practices that prevent errors
Characteristics:
- Type:
"guardrail"
- Enforcement:
"block"
- Priority:
"critical" or "high"
- Block file edits until skill used
- Prevent common mistakes (column names, critical errors)
- Session-aware (don't repeat nag in same session)
Examples:
database-verification - Verify table/column names before Prisma queries
frontend-dev-guidelines - Enforce React/TypeScript patterns
When to Use:
- Mistakes that cause runtime errors
- Data integrity concerns
- Critical compatibility issues
2. Domain Skills
Purpose: Provide comprehensive guidance for specific areas
Characteristics:
- Type:
"domain"
- Enforcement:
"suggest"
- Priority:
"high" or "medium"
- Advisory, not mandatory
- Topic or domain-specific
- Comprehensive documentation
Examples:
backend-dev-guidelines - Node.js/Express/TypeScript patterns
frontend-dev-guidelines - React/TypeScript best practices
error-tracking - Sentry integration guidance
When to Use:
- Complex systems requiring deep knowledge
- Best practices documentation
- Architectural patterns
- How-to guides
Quick Start: Creating a New Skill
Step 1: Create Skill File
Location: .claude/skills/{skill-name}/SKILL.md
Template:
---
name: my-new-skill
description: Brief description including keywords that trigger this skill. Mention topics, file types, and use cases. Be explicit about trigger terms.
triggers:
- keyword1
- keyword2
- keyword3
- keyword4
- keyword5
---
# My New Skill
## Purpose
What this skill helps with
## When to Use
Specific scenarios and conditions
## Key Information
The actual guidance, documentation, patterns, examples
Best Practices:
- โ
Name: Lowercase, hyphens, gerund form (verb + -ing) preferred
- โ
Description: Include ALL trigger keywords/phrases (max 1024 chars)
- โ
Content: Under 500 lines - use reference files for details
- โ
Examples: Real code examples
- โ
Structure: Clear headings, lists, code blocks
Step 2: Add to skill-rules.json
See SKILL_RULES_REFERENCE.md for complete schema.
Basic Template:
{
"my-new-skill": {
"type": "domain",
"enforcement": "suggest",
"priority": "medium",
"promptTriggers": {
"keywords": ["keyword1", "keyword2"],
"intentPatterns": ["(create|add).*?something"]
}
}
}
Step 3: Test Triggers
Test UserPromptSubmit:
echo '{"session_id":"test","prompt":"your test prompt"}' | \
npx tsx .claude/hooks/skill-activation-prompt.ts
Test Stop (Error Handling Reminder):
echo '{"session_id":"test","transcript_path":"","cwd":".","permission_mode":"default","hook_event_name":"stop"}' | \
npx tsx .claude/hooks/error-handling-reminder.ts
Step 4: Refine Patterns
Based on testing:
- Add missing keywords
- Refine intent patterns to reduce false positives
- Adjust file path patterns
- Test content patterns against actual files
Step 5: Follow Anthropic Best Practices
โ
Keep SKILL.md under 500 lines
โ
Use progressive disclosure with reference files
โ
Add table of contents to reference files > 100 lines
โ
Write detailed description with trigger keywords
โ
Test with 3+ real scenarios before documenting
โ
Iterate based on actual usage
Enforcement Levels
BLOCK (Critical Guardrails)
- Physically prevents Edit/Write tool execution
- Exit code 2 from hook, stderr โ Claude
- Claude sees message and must use skill to proceed
- Use For: Critical mistakes, data integrity, security issues
Example: Database column name verification
SUGGEST (Recommended)
- Reminder injected before Claude sees prompt
- Claude is aware of relevant skills
- Not enforced, just advisory
- Use For: Domain guidance, best practices, how-to guides
Example: Frontend development guidelines
WARN (Optional)
- Low priority suggestions
- Advisory only, minimal enforcement
- Use For: Nice-to-have suggestions, informational reminders
Rarely used - most skills are either BLOCK or SUGGEST.
Skip Conditions & User Control
1. Session Tracking
Purpose: Don't nag repeatedly in same session
How it works:
- First edit โ Hook blocks, updates session state
- Second edit (same session) โ Hook allows
- Different session โ Blocks again
State File: .claude/hooks/state/skills-used-{session_id}.json
2. File Markers
Purpose: Permanent skip for verified files
Marker: // @skip-validation
Usage:
import { PrismaService } from './prisma';
NOTE: Use sparingly - defeats the purpose if overused
3. Environment Variables
Purpose: Emergency disable, temporary override
Global disable:
export SKIP_SKILL_GUARDRAILS=true
Skill-specific:
export SKIP_DB_VERIFICATION=true
export SKIP_ERROR_REMINDER=true
Testing Checklist
When creating a new skill, verify:
Anti-Patterns
1. SKILL.md 500์ค ์ด๊ณผ
- BAD: ๋ชจ๋ ์์ธ ๋ด์ฉ์ SKILL.md ํ๋์ ์ธ๋ผ์ธ
# My Skill (780 lines)
## Pattern 1 ... (200 lines of code)
## Pattern 2 ... (200 lines of code)
## Full API Reference ... (300 lines)
- GOOD: ํต์ฌ๋ง SKILL.md์ ์ ์ง, ์์ธ ๋ด์ฉ์
resources/๋ก ๋ถ๋ฆฌ
# My Skill (350 lines)
## Pattern 1 (ํต์ฌ ์ฝ๋ 10์ค)
## Pattern 2 (ํต์ฌ ์ฝ๋ 10์ค)
See [Full API Reference](resources/api-reference.md)
2. Frontmatter triggers ๋๋ฝ
- BAD: name + description๋ง ์์ฑ, triggers ๋ฏธ์ง์
---
name: my-skill
description: Some description
---
- GOOD: triggers 5๊ฐ ์ด์ ๋ช
์ํ์ฌ ์๋ ํ์ฑํ ๋ณด์ฅ
---
name: my-skill
description: Some description
triggers:
- nestjs guard
- nestjs module
- nestjs controller
- nestjs service
- nestjs interceptor
---
3. ๊ณผ๋ํ๊ฒ ๋์ ํธ๋ฆฌ๊ฑฐ
- BAD: ๋ฒ์ฉ ํค์๋๋ก ์ค๋ฐ๋ ์ ๋ฐ
{ "keywords": ["code", "programming", "backend", "frontend"] }
- GOOD: ๊ตฌ์ฒด์ ํค์๋๋ก ์ ํํ ํ์ฑํ
{ "keywords": ["nestjs guard", "nestjs module", "passport jwt"] }
Reference Files
For detailed information on specific topics, see:
Complete guide to all trigger types:
- Keyword triggers (explicit topic matching)
- Intent patterns (implicit action detection)
- File path triggers (glob patterns)
- Content patterns (regex in files)
- Best practices and examples for each
- Common pitfalls and testing strategies
Complete skill-rules.json schema:
- Full TypeScript interface definitions
- Field-by-field explanations
- Complete guardrail skill example
- Complete domain skill example
- Validation guide and common errors
Deep dive into hook internals:
- UserPromptSubmit flow (detailed)
- PreToolUse flow (detailed)
- Exit code behavior table (CRITICAL)
- Session state management
- Performance considerations
Comprehensive debugging guide:
- Skill not triggering (UserPromptSubmit)
- PreToolUse not blocking
- False positives (too many triggers)
- Hook not executing at all
- Performance issues
Ready-to-use pattern collection:
- Intent pattern library (regex)
- File path pattern library (glob)
- Content pattern library (regex)
- Organized by use case
- Copy-paste ready
Future enhancements and ideas:
- Dynamic rule updates
- Skill dependencies
- Conditional enforcement
- Skill analytics
- Skill versioning
Quick Reference Summary
Create New Skill (5 Steps)
- Create
.claude/skills/{name}/SKILL.md with frontmatter
- Add entry to
.claude/skills/skill-rules.json
- Test with
npx tsx commands
- Refine patterns based on testing
- Keep SKILL.md under 500 lines
Trigger Types
- Keywords: Explicit topic mentions
- Intent: Implicit action detection
- File Paths: Location-based activation
- Content: Technology-specific detection
See TRIGGER_TYPES.md for complete details.
Enforcement
- BLOCK: Exit code 2, critical only
- SUGGEST: Inject context, most common
- WARN: Advisory, rarely used
Skip Conditions
- Session tracking: Automatic (prevents repeated nags)
- File markers:
// @skip-validation (permanent skip)
- Env vars:
SKIP_SKILL_GUARDRAILS (emergency disable)
Anthropic Best Practices
โ
500-line rule: Keep SKILL.md under 500 lines
โ
Progressive disclosure: Use reference files for details
โ
Table of contents: Add to reference files > 100 lines
โ
One level deep: Don't nest references deeply
โ
Rich descriptions: Include all trigger keywords (max 1024 chars)
โ
Test first: Build 3+ evaluations before extensive documentation
โ
Gerund naming: Prefer verb + -ing (e.g., "processing-pdfs")
Troubleshoot
Test hooks manually:
echo '{"prompt":"test"}' | npx tsx .claude/hooks/skill-activation-prompt.ts
cat <<'EOF' | npx tsx .claude/hooks/skill-activation-prompt.ts
{"tool_name":"Edit","tool_input":{"file_path":"test.ts"}}
EOF
See TROUBLESHOOTING.md for complete debugging guide.
Related Files
Configuration:
.claude/skills/skill-rules.json - Master configuration
.claude/hooks/state/ - Session tracking
.claude/settings.json - Hook registration
Hooks:
.claude/hooks/skill-activation-prompt.ts - UserPromptSubmit
.claude/hooks/error-handling-reminder.ts - Stop event (gentle reminders)
All Skills:
.claude/skills/*/SKILL.md - Skill content files
Skill Status: COMPLETE - Restructured following Anthropic best practices โ
Line Count: < 500 (following 500-line rule) โ
Progressive Disclosure: Reference files for detailed information โ
Next: Create more skills, refine patterns based on usage