Create and manage Claude Code skills following Anthropic best practices. Use when creating new skills, modifying skill-rules.yaml, 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.
Inherits all available tools
Additional assets for this skill
This skill inherits all available tools. When active, it can use any tool Claude has access to.
references/advanced.mdreferences/hook-mechanisms.mdreferences/patterns-library.mdreferences/skill-rules-reference.mdreferences/trigger-types.mdreferences/troubleshooting.mdComprehensive 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.
Skills must contain NEW information Claude doesn't already know. The model is trained on the entire internet - generic advice adds nothing.
Ask: "Would this help a human contractor on day one?"
| ❌ Useless | ✅ Valuable |
|---|---|
| "Run tests after changes" | "Run bin/rails test test/models/ after touching models" |
| "Be a strategic thinker" | "Here's our quarterly planning template: [actual template]" |
| "Write clean code" | "Max 100 lines per class, 5 lines per method (Sandi Metz rules)" |
| "Think step by step" | "Check these 3 files first: config/routes.rb, then app/controllers/, then app/models/" |
| "You are an expert Rails developer" | "We use Current.user pattern, Solid Queue for jobs, and this naming convention..." |
Critical distinction:
| Use | For |
|---|---|
| Hooks | Process enforcement (deterministic - FORCES behavior) |
| Skills | Knowledge/context (probabilistic - Claude MAY follow) |
If you want Claude to ALWAYS do something (run tests, check types, validate schemas):
Skills are for knowledge Claude needs, not processes you want enforced.
Automatically activates when you mention:
1. UserPromptSubmit Hook (Proactive Suggestions)
.claude/hooks/skill-activation-prompt.ts2. Stop Hook - Error Handling Reminder (Gentle Reminders)
.claude/hooks/error-handling-reminder.tsPhilosophy 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.
Location: .claude/skills/skill-rules.yaml
Defines:
Purpose: Enforce critical best practices that prevent errors
Characteristics:
"guardrail""block""critical" or "high"Examples:
database-verification - Verify table/column names before Prisma queriesfrontend-dev-guidelines - Enforce React/TypeScript patternsWhen to Use:
Purpose: Provide comprehensive guidance for specific areas
Characteristics:
"domain""suggest""high" or "medium"Examples:
backend-dev-guidelines - Node.js/Express/TypeScript patternsfrontend-dev-guidelines - React/TypeScript best practiceserror-tracking - Sentry integration guidanceWhen to Use:
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.
---
# My New Skill
## Purpose
What this skill helps with
## When to Use
Specific scenarios and conditions
## Key Information
The actual guidance, documentation, patterns, examples
Supported Frontmatter Fields:
name (required) - Skill identifierdescription (required) - Trigger keywords and purposeallowed-tools (optional) - Restrict available toolsNOTE: Skills do NOT support the model: field. Skills inherit the conversation's model.
Best Practices:
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"
Test UserPromptSubmit:
echo '{"session_id":"test","prompt":"your test prompt"}' | \
npx tsx .claude/hooks/skill-activation-prompt.ts
Test PreToolUse:
cat <<'EOF' | npx tsx .claude/hooks/skill-verification-guard.ts
{"session_id":"test","tool_name":"Edit","tool_input":{"file_path":"test.ts"}}
EOF
Based on testing:
✅ 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
Example: Database column name verification
Example: Frontend development guidelines
Rarely used - most skills are either BLOCK or SUGGEST.
Purpose: Don't nag repeatedly in same session
How it works:
State File: .claude/hooks/state/skills-used-{session_id}.json
Purpose: Permanent skip for verified files
Marker: // @skip-validation
Usage:
// @skip-validation
import { PrismaService } from './prisma';
// This file has been manually verified
NOTE: Use sparingly - defeats the purpose if overused
Purpose: Emergency disable, temporary override
Global disable:
export SKIP_SKILL_GUARDRAILS=true # Disables ALL PreToolUse blocks
Skill-specific:
export SKIP_DB_VERIFICATION=true
export SKIP_ERROR_REMINDER=true
When creating a new skill, verify:
.claude/skills/{name}/SKILL.mdskill-rules.yamlyq . skill-rules.yamlFor detailed information on specific topics, see:
Complete guide to all trigger types:
Complete skill-rules.yaml schema:
Deep dive into hook internals:
Comprehensive debugging guide:
Ready-to-use pattern collection:
Future enhancements and ideas:
.claude/skills/{name}/SKILL.md with frontmatter.claude/skills/skill-rules.yamlnpx tsx commandsSee trigger-types.md for complete details.
// @skip-validation (permanent skip)SKIP_SKILL_GUARDRAILS (emergency disable)✅ 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")
Test hooks manually:
# UserPromptSubmit
echo '{"prompt":"test"}' | npx tsx .claude/hooks/skill-activation-prompt.ts
# PreToolUse
cat <<'EOF' | npx tsx .claude/hooks/skill-verification-guard.ts
{"tool_name":"Edit","tool_input":{"file_path":"test.ts"}}
EOF
See troubleshooting.md for complete debugging guide.
Configuration:
.claude/skills/skill-rules.yaml - Master configuration.claude/hooks/state/ - Session tracking.claude/settings.json - Hook registrationHooks:
.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 filesSkill 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