Make a Hook Prove Its Failure Behavior
A hook that succeeds on good input may still let bad work through. Test its failure path before making it part of your workflow.
Create a disposable example that violates the rule the hook is meant to enforce. Run the real event and inspect the exit status or structured decision required by that event. Then repeat with a valid example. A message printed to the terminal may be informational rather than blocking.
Keep these fixtures with the hook. Check what happens when its helper command is missing or times out, and ensure repeated invocations do not damage files. Claude Code's hook events have different contracts, so copy the relevant event's current response shape rather than adapting a snippet from an unrelated event by intuition.