
· Amit Kothari · AI
How Claude Code stop hooks work
A Claude Code stop hook runs the moment Claude finishes a turn and can refuse to let it stop. It is the one hook that inverts control: Claude must pass your check before the turn ends. This post covers what a stop hook is, why exit code 2 is the whole game, the infinite-loop trap to avoid, and the patterns worth wiring up.