Notes on building software.
A personal blog of technical articles about software development.
Blocking Dangerous Commands with Hooks
Use a PreToolUse hook and exit code 2 to stop Claude from running commands you never want it to touch.
Hook Matchers and the if Condition
Matchers decide which tool triggers a hook; learn the patterns and how to add your own conditions inside the command.
Controlling Claude with Hook Exit Codes and JSON
Exit codes give hooks blunt control; JSON on stdout gives them structured decisions like denying a tool call with a reason.
Running Checks When a Session Starts
A SessionStart hook can load fresh project context into every session so Claude begins with the state that matters.
Notifying Yourself with Notification Hooks
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.
Debugging Hooks That Don't Fire
A checklist for when a hook stays silent: verify the config, the event, the matcher, the exit code, and the command itself.