Anthropic employee explains how to configure and use Claude Code prompt hooks
Ado from Anthropic's developer relations shares how to use Claude Code prompt hooks: when a rule isn't a mechanical check, adding a description to the hook input sends it to a small Claude background model, which returns { ok, reason }.
Drawing on firsthand use, the author lays out how prompt hooks and command hooks divide the work, and gives concrete configuration approaches for PreToolUse and Stop that can be carried over to your own Claude Code workflow.
Command hooks are great when a rule is mechanical. "Is this command touching production data?" is not. A prompt hook sends the hook input plus your sentence to a Claude model (the small background one by default) and gets back { ok, reason }.
On PreToolUse, add continueOnBlock: true so the reason goes back to Claude as a tool error and it adjusts, instead of ending the turn. On Stop, ok: false makes the reason Claude's next instruction, so it keeps working.
How I use it:
- PreToolUse on Bash: "Block anything that deletes or rewrites shared data"
- Stop: "Did Claude run the tests after its last edit?"
Source: Ado · x.com