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.
77
77%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
Complete reference for configuring skill triggers in Claude Code's skill auto-activation system.
Case-insensitive substring matching in user's prompt.
Topic-based activation where user explicitly mentions the subject.
"promptTriggers": {
"keywords": ["layout", "grid", "toolbar", "submission"]
}project-catalog-developerRegex pattern matching to detect user's intent even when they don't mention the topic explicitly.
Action-based activation where user describes what they want to do rather than the specific topic.
"promptTriggers": {
"intentPatterns": [
"(create|add|implement).*?(feature|endpoint)",
"(how does|explain).*?(layout|workflow)"
]
}Database Work:
(add).*?(feature)database-verification, error-trackingComponent Creation:
(create).*?(component) (if component in pattern)frontend-dev-guidelines(create|add|modify|build|implement)(feature|endpoint|component|workflow).*? instead of .*# Database Work
(add|create|implement).*?(user|login|auth|feature)
# Explanations
(how does|explain|what is|describe).*?
# Frontend Work
(create|add|make|build).*?(component|UI|page|modal|dialog)
# Error Handling
(fix|handle|catch|debug).*?(error|exception|bug)
# Workflow Operations
(create|add|modify).*?(workflow|step|branch|condition)Glob pattern matching against the file path being edited.
Domain/area-specific activation based on file location in the project.
"fileTriggers": {
"pathPatterns": [
"frontend/src/**/*.tsx",
"form/src/**/*.ts"
],
"pathExclusions": [
"**/*.test.ts",
"**/*.spec.ts"
]
}** = Any number of directories (including zero)* = Any characters within a directory namefrontend/src/**/*.tsx = All .tsx files in frontend/src and subdirs**/schema.prisma = schema.prisma anywhere in projectform/src/**/*.ts = All .ts files in form/src subdirsfrontend/src/components/Dashboard.tsxfrontend/src/**/*.tsxfrontend-dev-guidelines**/*.test.tsform/src/services/** not form/**# Frontend
frontend/src/**/*.tsx # All React components
frontend/src/**/*.ts # All TypeScript files
frontend/src/components/** # Only components directory
# Backend Services
form/src/**/*.ts # Form service
email/src/**/*.ts # Email service
users/src/**/*.ts # Users service
# Database
**/schema.prisma # Prisma schema (anywhere)
**/migrations/**/*.sql # Migration files
database/src/**/*.ts # Database scripts
# Workflows
form/src/workflow/**/*.ts # Workflow engine
form/src/workflow-definitions/**/*.json # Workflow definitions
# Test Exclusions
**/*.test.ts # TypeScript tests
**/*.test.tsx # React component tests
**/*.spec.ts # Spec filesRegex pattern matching against the file's actual content (what's inside the file).
Technology-specific activation based on what the code imports or uses (Prisma, controllers, specific libraries).
"fileTriggers": {
"contentPatterns": [
"import.*[Pp]risma",
"PrismaService",
"\\.findMany\\(",
"\\.create\\("
]
}Prisma Detection:
import { PrismaService } from '@project/database'import.*[Pp]rismadatabase-verificationController Detection:
export class UserController {export class.*Controllererror-trackingimport.*[Pp]risma (case-insensitive with [Pp])\\.findMany\\( not .findMany(# Prisma/Database
import.*[Pp]risma # Prisma imports
PrismaService # PrismaService usage
prisma\. # prisma.something
\.findMany\( # Prisma query methods
\.create\(
\.update\(
\.delete\(
# Controllers/Routes
export class.*Controller # Controller classes
router\. # Express router
app\.(get|post|put|delete|patch) # Express app routes
# Error Handling
try\s*\{ # Try blocks
catch\s*\( # Catch blocks
throw new # Throw statements
# React/Components
export.*React\.FC # React functional components
export default function.* # Default function exports
useState|useEffect # React hooks✅ Use specific, unambiguous keywords
✅ Test all patterns with real examples
✅ Include common variations
✅ Use non-greedy regex: .*?
✅ Escape special characters in content patterns
✅ Add exclusions for test files
✅ Make file path patterns narrow and specific
❌ Use overly generic keywords ("system", "work")
❌ Make intent patterns too broad (false positives)
❌ Make patterns too specific (false negatives)
❌ Forget to test with regex tester (https://regex101.com/)
❌ Use greedy regex: .* instead of .*?
❌ Match too broadly in file paths
Test keyword/intent triggers:
echo '{"session_id":"test","prompt":"your test prompt"}' | \
npx tsx .claude/hooks/skill-activation-prompt.tsTest file path/content triggers:
cat <<'EOF' | npx tsx .claude/hooks/skill-verification-guard.ts
{
"session_id": "test",
"tool_name": "Edit",
"tool_input": {"file_path": "/path/to/test/file.ts"}
}
EOFRelated Files: