enforce-hooks

enforce-hooks is a skill for Claude Code from Bande-a-Bonnot/Boucle-framework. It costs 86 tokens per session (1,048 once invoked), scanned A, original, MIT.

A skill that reads a CLAUDE.md file and turns selected tagged rules into automatic checks before covered Claude Code tool calls.

In plain words
What is it for?
Use it to scan project rules, install dynamic enforcement hooks, and verify them with smoke tests. The dynamic mode rereads CLAUDE.md whenever a tool is used.
Why use it?
It reduces reliance on an AI agent remembering project instructions by checking enforceable rules at runtime.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

Good fit Use it to scan project rules, install dynamic enforcement hooks, and verify them with smoke tests. The dynamic mode rereads CLAUDE.md whenever a tool is used.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/bande-a-bonnot/boucle-framework/enforce
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Bande-a-Bonnot/Boucle-framework --skill enforce
Clone the repo
git clone --depth 1 https://github.com/Bande-a-Bonnot/Boucle-framework

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for enforce-hooks

README.md
[![agentmods](https://agentmods.dev/badge/skills/bande-a-bonnot/boucle-framework/enforce.svg)](https://agentmods.dev/skills/bande-a-bonnot/boucle-framework/enforce)
Your own site
<a href="https://agentmods.dev/skills/bande-a-bonnot/boucle-framework/enforce"><img src="https://agentmods.dev/badge/skills/bande-a-bonnot/boucle-framework/enforce.svg" alt="Measured on agentmods" height="20"></a>
Per session 86 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,048 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. ✓ AI security review Sonnet 5 · 6 Sept 2026 📄 Read the review Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 4 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 41
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 67
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Tool Misuse · line 91
    Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.
    Fix: Limit tool chaining depth and validate the output of each tool before passing it to the next. Require explicit user approval for multi-step chains.
  • low Supply Chain · line 91
    Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
    Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00086 $0.01048
Opus 5 $0.00043 $0.00524
Sonnet 5 $0.00017 $0.00210
Haiku 4.5 $0.00009 $0.00105

Measured 8d ago against content hash 2d1bb511ffa2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

enforce-hooks scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

The scan reads SKILL.md. This mod also ships 12 executable files (enforce-hooks.py, engine.sh, examples/enforce-knowledge-first.sh, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

tools/enforce/SKILL.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Enforce Hooks

Turn CLAUDE.md rules into runtime checks for covered Claude Code tool calls.

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 checks for project rules
  • User mentions @enforced directives

Default workflow

Use dynamic plugin mode unless the user explicitly asks for individual generated hook scripts.

  1. Read the user's CLAUDE.md, or the file they specify.
  2. Run python3 tools/enforce/enforce-hooks.py --scan from a local checkout, or download enforce-hooks.py and run python3 enforce-hooks.py --scan.
  3. Explain which rules are enforceable, which are skipped, and why.
  4. With the user's confirmation, run python3 enforce-hooks.py --install-plugin.
  5. Verify with python3 .claude/hooks/enforce-hooks.py --verify and python3 .claude/hooks/enforce-hooks.py --smoke-test.
  6. Tell the user to start a fresh Claude Code session from the same project root.

Plugin mode installs one PreToolUse wrapper plus the Python engine in .claude/hooks/. It reads CLAUDE.md on every tool call, so rule changes do not require regenerating scripts.

What is enforceable

A directive is enforceable when the tool call itself contains enough signal to decide before execution.

Enforceable examples:

  • "Never modify .env files" -> file-guard rule for Write/Edit/MultiEdit paths
  • "Don't force push" -> bash-guard rule for push --force and push -f
  • "Always search locally before using web search" -> require-prior-tool rule
  • "Don't commit to main" -> branch-guard rule for protected branches
  • "Never run rm -rf" -> bash-guard rule for dangerous command patterns
  • "Don't edit files in vendor/" -> file-guard path rule
  • "Always run tests before committing" -> require-prior-tool or command rule
  • "Never use sudo" -> bash-guard rule
  • "Don't read files in secrets/" -> file-guard rule including Read
  • "Use TypeScript, not JavaScript" -> content or path rule for generated files

Read the full file on GitHub · 110 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 110 lines · 86 tokens per session scan E 2d1bb511ffa2

Subscribe to this mod's changes

enforce-hooks is a skill published in the GitHub repository Bande-a-Bonnot/Boucle-framework (124 stars, last pushed today), licensed MIT. It adds 86 tokens to every session and 1,048 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

data-analysis

Analyze, explore, clean, and visualize datasets with statistical rigor. Use when user asks to analyze data, find patterns, compute statistics, create visualizations, clean messy data, or explore a dataset. Trigger when user says things like "analyze this data", "what trends do you see", "find patterns in", "create a…

Upsonic/Upsonic · 138 tokens

experiment_management

Set up and manage the experiment folder structure. This is Phase 0 — it runs before any analysis begins. All bookkeeping files are JSON (never markdown).

Upsonic/Upsonic · 0 tokens

summarization

Summarize documents, articles, conversations, code, and technical content into concise, accurate summaries. Use when user asks to summarize, condense, create a TL;DR, write an executive summary, extract key points, or distill content. Trigger when user says things like "summarize this", "give me the key points"…

Upsonic/Upsonic · 144 tokens

evaluate

Compare baseline and new implementation results. Produce the machine-readable final report result.json, update experiments.json, and append a row to comparison.json.

Upsonic/Upsonic · 0 tokens

progress

Maintain a machine-readable progress file so dashboards, CLIs, and notebooks can poll the experiment's state at any time. The file is a JSON document — never markdown, never human-prose-first.

Upsonic/Upsonic · 0 tokens

research

Read the materialized research source and extract actionable information needed to implement the proposed method. Record the findings as a structured JSON entry.

Upsonic/Upsonic · 0 tokens