Video 013 · 2 Dec 2026
How do I use Claude Code hooks?
A hook is a command Claude Code runs by itself, at a set moment. It doesn't have to remember. It just happens.
How to use Claude Code hooks
- It pings me when it's stuck. When Claude needs me, a Notification hook puts up a Mac notification with a sound. So I can walk away while it works.
- It checks my setup first. When a session starts, a SessionStart hook runs my setup check and only prints something if it's wrong. The morning I wrote this, it ran 11 checks and found 3 errors before I typed a single word. What the hook prints goes to Claude too, so it starts the session already knowing.
- It reads its answer out loud. When it finishes, a Stop hook speaks the last reply. If any app starts recording from the microphone, like dictation, it shuts up.
Claude Code hooks examples
Hooks live in your settings file, ~/.claude/settings.json. This is the shape of my three. The ping is exactly what I run. The other two point at my own scripts, so swap in yours.
{
"hooks": {
"Notification": [
{"hooks": [{"type": "command",
"command": "osascript -e 'display notification \"Claude needs your attention\" with title \"Claude Code\" sound name \"Ping\"'"}]}
],
"SessionStart": [
{"hooks": [{"type": "command", "command": "~/bin/check-setup"}]}
],
"Stop": [
{"hooks": [{"type": "command", "command": "~/bin/speak-last-reply"}]}
]
}
}
Every hook gets a bit of JSON on its input, including transcript_path, the file the conversation is saved in. That's how my Stop hook finds the last reply to read out.
It was seven commands across four events when I filmed this. It's nine now. The rest keep my project notes up to date.
Why hooks and not rules?
A rule is a request. My rules file (it's in 009) tells Claude what to do, and Claude can forget a rule. A hook doesn't ask. Claude Code runs it at that moment whatever the model is doing, so it always runs.
More videos
- 001: Will AI ever cite my website?
- 002: Can code edit my videos for me?
- 003: Can AI pick my best stream clips?
- 004: Which AI reads your site first?
- 005: Can AI be a dungeon master?
- 006: Did AI ever cite my website?
- 007: Can AI teach me Python?
- 008: Is AI code reliable?
- 009: How do I use Claude Code?
- 010: Codex vs Claude Code?
- 011: How do I make Claude write like me?
- 012: How do I use Whisper AI?