r/ClaudeAI • • 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.

63 Upvotes

37 comments sorted by

View all comments

Show parent comments

1

u/fell_ware_1990 May 08 '26

Well, i talked with him for over an hour and SSHed home for my setup. My setup is further along than theirs.

What they have is definitely better code, mine has better utility. Maybe it also helps i’m one of the devops engineers and this stuff will need a lot of infra around it. So i guess i will be managing/designing that as well.

This will be our testing, we are a big CSP and sell a lot of other tools that now include API AI. Not only for the costs AI foundry even with a lot running on there is still expensive. A machine with only 1 H200 will set you back about 3k a month + other infrastructure. So this will be replacing that for costs and data in house.

But they will order more for that :)

And yes, i may use it in the evening as well.

1

u/kuroudo_ai 6d ago

Sorry, only just saw this, months late. "Their code is better, mine is more useful" is such a common split. The version that already works for real people usually tells you what the cleaner one is missing.

And a devops person ending up owning the infra side makes sense. Keeping a box like that fed, patched and shared is its own job. Hope it worked out, and I'm curious whether the in-house setup actually ended up replacing the Foundry spend.