Auto-Activate Skills with a UserPromptSubmit Hook and skill-rules.json
Skills are supposed to activate automatically based on their descriptions, but in practice they fire only about half the time. Pairing a UserPromptSubmit hook with a skill-rules.json config flips that to near-100% reliability.
The pattern works like this: define trigger keywords and file path patterns in a JSON config file, then add a hook that checks each incoming prompt against those rules and injects a reminder when a match is found.
// .claude/skill-rules.json
{
"rules": [
{
"skill": "backend-dev",
"keywords": ["api", "endpoint", "database", "migration"],
"filePaths": ["src/api/", "src/models/"]
},
{
"skill": "frontend-patterns",
"keywords": ["component", "react", "css", "ui"],
"filePaths": ["src/components/", "src/pages/"]
}
]
}
Then a UserPromptSubmit hook reads your prompt and active files, checks them against these rules, and appends something like "Relevant skill: backend-dev — consider loading it" to the system context before Claude responds.
The key difference between this and a plain CLAUDE.md instruction is that a hook is a guaranteed shell execution, not a suggestion. Claude can de-prioritise text in a long conversation, but it cannot ignore a hook.
Keep your skill-rules.json rules specific. Broad keyword lists create noise and slow down the hook. Start with your most-used 3 to 5 skills and tune from there.
Hooks turn skill activation from a coin flip into a guarantee.
via Claude Code is a Beast – Tips from 6 Months of Hardcore Use
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.