You told Claude Code “always run the formatter after editing” and “never run rm -rf ”. It listened, until it didn’t. A rule in a prompt is a request — it can be forgotten, skipped, or missed after a context compaction.
A hook is not a request. It’s a shell command that runs automatically at a specific point in the agent’s workflow, and it can actually block an action before it happens. This guide covers real, practical hook setups you can have running in about 2 minutes, not just the concept.
What the full guide covers:
- What You’ll Need
- Step-by-Step Setup
- What Each Piece Does
- Verify a Hook Actually Fires
The commands, our own test notes, and the troubleshooting steps are in the full guide, which we keep up to date:
Top comments (0)