echo, validate tool usage, and enforce conventions before any tool runs. ## Two ways to block Exit code 2 (simple): - Write error to stderr - Exit with code 2 - Claude sees the error message and stops the tool JSON output (structured): - Return permissionDecision: "deny" - Provide permissionDecisionReason - Claude sees the reason and can self-correct ## Block with exit code 2 Stop commands with a simple error: https://egghead.io/lessons/block-tool-commands-before-execution-with-pre-tool-use-hooks~erv55