Notes on building software.

A personal blog of technical articles about software development.

What Hooks Are and Why They're Deterministic

September 8, 2026· 2 min read·claude-codehooksautomation

Hooks are shell commands Claude Code runs at set points in a session, giving you rules that always fire instead of hoping the model remembers.

Your First PreToolUse Hook

September 8, 2026· 2 min read·claude-codehooksautomation

Build a simple PreToolUse hook that logs every Bash command Claude is about to run, and learn how event data arrives on stdin.

Formatting Code Automatically with a PostToolUse Hook

September 8, 2026· 2 min read·claude-codehooksautomation

Wire up a PostToolUse hook so every file Claude edits gets formatted right away, keeping your diffs clean without asking.

Blocking Dangerous Commands with Hooks

September 8, 2026· 2 min read·claude-codehooksautomation

Use a PreToolUse hook and exit code 2 to stop Claude from running commands you never want it to touch.

Controlling Claude with Hook Exit Codes and JSON

September 8, 2026· 2 min read·claude-codehooksautomation

Exit codes give hooks blunt control; JSON on stdout gives them structured decisions like denying a tool call with a reason.

Notifying Yourself with Notification Hooks

September 8, 2026· 2 min read·claude-codehooksautomation

A Notification hook can send a desktop alert or sound when Claude needs your attention, so you can step away and still stay in the loop.