enforce-hooks

Solid

Analyze a CLAUDE.md file and generate PreToolUse hook scripts that enforce its rules at the tool-call level. Use when users want their CLAUDE.md directives enforced as code rather than relying on prompt compliance. Reads the CLAUDE.md, identifies enforceable rules, generates standalone bash hook scripts, and wires them into .claude/settings.json.

AI & Automation 120 stars 9 forks Updated today MIT

Install

View on GitHub

Quality Score: 86/100

Stars 20%
69
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Enforce Hooks Generate PreToolUse hook scripts from CLAUDE.md directives. ## When to use - User says "enforce my CLAUDE.md rules" or "generate hooks from my CLAUDE.md" - User complains about Claude ignoring CLAUDE.md instructions - User wants code-level enforcement of their rules - User mentions `@enforced` directives ## How it works 1. Read the user's CLAUDE.md (or the file they specify) 2. Classify each directive as enforceable or not 3. For each enforceable directive, generate a standalone bash hook script 4. Show the user what you found and what hooks you would create 5. On confirmation, write the hooks and update .claude/settings.json ## What is enforceable A directive is enforceable if it can be checked at tool-call time. The hook receives the tool name and input JSON before execution and can block it. **Enforceable (yes):** - "Never modify .env files" -> file-guard hook (block Write/Edit to .env) - "Don't force push" -> bash-guard hook (block `push --force` in Bash) - "Always search locally before using web search" -> require-prior-tool hook - "Don't commit to main" -> branch-guard hook (block git commit on main) - "Never run rm -rf" -> bash-guard hook (block pattern in Bash commands) - "Don't edit files in vendor/" -> file-guard hook (block by path pattern) - "Always run tests before committing" -> require-prior-tool hook - "Never use sudo" -> bash-guard hook - "Don't read files in secrets/" -> file-guard hook (block Read too) - "Use TypeScript, not JavaScri...

Details

Author
Bande-a-Bonnot
Repository
Bande-a-Bonnot/Boucle-framework
Created
4 months ago
Last Updated
today
Language
Shell
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category