← Browse by Chapter
Get the Book →
#51Chapter 09 — Hooks: Safety Net and Automation
Here is a rule from our memory file: [paste the rule]. I want a Claude Code hook to enforce it, whatever Claude decides. Tell me which hook event should enforce it, and why that event rather than one that runs after the fact. Give the matcher, and say what the script must read from its input and check. Then list every way Claude could still break the rule without this hook firing, one line each. Do not write the script yet.

Mastering Claude Code
These prompts are excerpts from the book. Get the full collection with explanations and use cases.