Claude Code Hooks: The Feature You're Ignoring While Babysitting Your AI
Set it once, forget it exists. Your future self will thank you.
You’re doing it again.
Claude just edited a file. You’re about to type “now run prettier.” For the fourteenth time today. Like some kind of digital hall monitor.
Meanwhile, there’s a feature sitting right there in Claude Code that would do this automatically. It’s called hooks. And based on my extremely scientific survey of Reddit threads, approximately nobody is using them.
What Hooks Actually Are
When Claude Code runs, it fires events. Before it uses a tool. After it uses a tool. When it stops. When it sends a notification.
Hooks let you intercept these events and run shell commands automatically.
That’s it. That’s the whole concept.
Claude edits a file? Run your formatter. Claude finishes a task? Send yourself a Slack message. Claude tries to commit? Run your linter first.
No more babysitting. No more “please remember to run prettier.” You set it once and forget it exists.
The Three Hooks That Actually Matter
I spent way too long reading Reddit threads about hooks. Here’s what power users actually care about:
1. The Formatter Hook
This is the most common one. Claude edits your code, your formatter runs automatically.
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "prettier --write $CLAUDE_FILE_PATH"
}
]
}
]
}
}
No more “can you run prettier on that?” Revolutionary concept, I know.
2. The Notification Hook
You kicked off a task. You walked away to make coffee. Now you’re checking your terminal every 30 seconds like a nervous parent.
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -d 'Claude is done' ntfy.sh/your-topic"
}
]
}
]
}
}
Send it to Slack. Send it to Discord. One person made their Mac speak out loud. Another person made Claude meow. (Allergies. I don’t judge.)
3. The “Please Remember Your Instructions” Hook
This one solves a specific pain that will sound familiar: Claude compacts its context to save tokens. In doing so, it sometimes... forgets things. Important things. Things you put in your CLAUDE.md.
The fix? Re-inject your core rules on every prompt:
{
"hooks": {
"PreToolUse": [
{
"matcher": "UserPromptSubmit",
"hooks": [
{
"type": "command",
"command": "cat .claude/rules.txt"
}
]
}
]
}
}
Your rules show up in the context window. Every time. Claude can’t “forget” what’s staring it in the face.
Where This Goes
Put your hooks in .claude/settings.json in your project, or ~/.claude/settings.json globally.
Project-level hooks are better. Different projects have different formatters, different rules, different needs. Keep it scoped.
The One Gotcha
Someone on Reddit pointed out a real issue: if your formatter changes files, Claude gets a system reminder about those changes. Every. Single. Time.
If you’re formatting aggressively, that’s a lot of noise in your context window. Tokens that could be doing useful work are now just telling Claude that yes, you added a semicolon.
The fix is to be selective. Format on commit, not on every edit. Or accept the tradeoff. Your call.
Why You Should Care
Hooks turn Claude Code from “AI assistant you have to supervise” into “AI assistant that follows your rules automatically.”
The power users on Reddit are calling this a game-changer. The rest of the users are still typing “please run the linter” by hand.
Don’t be the second group.
Set up three hooks. Formatter, notifications, rule enforcement. Takes ten minutes. Saves hours of typing the same commands.
Your future self will thank you.
What’s the most repetitive thing you’re still typing manually in Claude Code?

