What is the key difference between hooks and other Claude code features?	Hooks are deterministic and always run, whereas other features like instructions in Claude.md are not guaranteed to execute every time.
Where are hooks configured in Claude code?	Hooks are configured in the settings.json file, specifically in .Claude/settings.json for project-level hooks.
What are the five types of hook events available?	User prompt submit, pre-tool use, post-tool use, notification, and stop.
When does the post-tool use hook fire?	After a tool call completes, commonly used for auto-formatting files after edits.
How can pre-tool use hooks block dangerous operations?	By exiting with code 2, which blocks the action and sends the stderr message back to Claude as feedback explaining why it was blocked.
What exit codes are used in pre-tool use hooks and what do they mean?	Exit code 0 means proceed with the tool call; exit code 2 means block the tool call.
What is a common use case for post-tool use hooks with a matcher?	Auto-formatting files after edits by matching on "edit" or "multi-edit" tools and running the appropriate formatter (prettier, go format, ruff, etc.).
Why should hooks be checked into your repository?	So that your entire team automatically gets the same hooks configured at the project level.
What environment variable should be used in hook commands to reference project scripts?	The Claude project dir environment variable, which ensures scripts work regardless of Claude's current working directory.
When should you use hooks instead of putting instructions in a prompt?	When something needs to happen every time without fail, as hooks guarantee execution while prompt instructions do not.
