Paths Subjects Questions Quizzes Pricing Search
Intermediate Open Pro

Choosing the Right Hook Event for a Guardrail

A team wants three guardrails on their shared Claude Code setup:

  1. Never let an edit touch prod-config.yaml.
  2. Every file Claude edits should be auto-formatted with the project's formatter.
  3. Whenever Claude finishes a turn, verify the test suite still passes and, if not, feed the failure back so Claude keeps working instead of reporting done.

For each guardrail, name the correct hook event, explain why the "obvious" alternative event would not work correctly, and sketch the key exit-code/JSON behavior the hook needs.

Share this question

← Back to Settings, Permissions & Hooks practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.