Author(s): Narmadha

Originally published on Towards AI.

If you read Part 1, you know the why behind Claude Code Hooks: they turn “Claude will probably follow this rule” into “Claude has no choice but to follow this rule.”

But the most common question after Part 1 was simple: “Okay — what do I actually write?”

This article answers that. But before the recipes, there are two things Part 1 skipped that you need to understand first — otherwise your scripts are just guessing.