Stop Hook - Claude Code
Fires when Claude finishes responding. Can prevent the stop.
The Stop hook fires when Claude is about to stop responding at the end of a turn. It can observe the finish, or actively block the stop and push Claude to keep going.
What it does
Hooked on Stop, you can inspect the final response, check if a required condition is met, and if not, return instructions telling Claude what's still missing. The turn continues until the hook allows it to stop, or until a loop-prevention cap fires. This is how you enforce "don't stop until tests pass" style policies.
When to use it
- Requiring tests pass before Claude declares a task done.
- Enforcing completion checklists (tests + types + lint).
- Forcing specific output formats before a turn closes.
- Building review bots that push Claude to iterate.
Gotchas
- It's easy to loop infinitely if the stop condition is unreachable. Always include a retry cap.
- Heavy Stop checks make every turn feel slow. Keep them fast and cached where possible.
- A noisy Stop hook that always demands more is worse than no hook at all.
Official docs: https://code.claude.com/docs/en/hooks.md#stop
Technical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.
Get the weekly deep dive
Tutorials on Claude Code, AI agents, and dev tools - delivered free every week.
Was this helpful?




