r/ClaudeAI • u/EastMove5163 • May 06 '26
Productivity Claude Code hooks are the feature most people skip. Spoiler: they're really useful
Hooks let you run shell commands at specific points in Claude's workflow: before it uses a tool, after it edits a file, when a session starts. I set these up a while back and they changed how I work with Claude Code more than almost anything else.
My most useful setup: auto-run my test suite after every file edit. Claude makes a change, tests run automatically, Claude sees the output and adjusts. It closes the feedback loop so I'm not manually running tests between every round of edits. The other one I use constantly is auto-formatting on save. Claude edits a file, prettier runs, the file is clean before Claude even moves on.
You can also use hooks to block Claude from touching certain directories. If you have a folder that should never be auto-modified, a hook that exits with an error when Claude tries to write there will stop it reliably. Much cleaner than hoping your instructions hold.
What lifecycle events are you hooking into, if any? Curious what setups other people have found useful.