PreToolUse vs PostToolUse
People think both hooks can stop a bad tool call. Only one can. PreToolUse fires before the tool runs, so it can allow, deny or ask. PostToolUse fires after the tool has run, so the change is already made. It can only tell Claude what went wrong. Guard in the first, check and tidy in the second.
PreToolUse Hook
The event before a tool runs. A hook can say yes, no or ask.
PreToolUse is the hook event that fires after Claude picks a tool call and before it runs. A hook here can allow the call, deny it, ask you, or defer it. It can also change the tool's input. When hooks disagree, deny wins, then defer, then ask, then allow. Your deny and ask rules are still checked, whatever the hook says.
PostToolUse Hook
The event right after a tool works. It is often used to tidy code.
PostToolUse is the hook event that fires right after a tool call works. It is the usual place to tidy code, lint it or run a quick test after Claude edits a file. The tool has already run, so the hook cannot undo it. It can send Claude a note to act on. It does that by exiting 2, or with a block decision and a reason.
In one line
- PreToolUse Hook
- The event before a tool runs. A hook can say yes, no or ask.
- PostToolUse Hook
- The event right after a tool works. It is often used to tidy code.