PreToolUse
An extension point provided by Claude Code that allows custom logic to be inserted before a tool call is executed and can return a decision that affects the final behavior.
Timeline (last 90 days)
claude-code-setup suggested a PreToolUse hook for this project that blocks direct editing of version-management-related files (manifest.json, src/version.js, package-lock.json, coverage/), because the project synchronizes the version numbers of three files via npm run version:*.
The Claude Agent SDK's PreToolUse and PostToolUse hooks, combined with matchers such as Write|Edit, can block, modify, or log tool calls.
The new version fixes a bug where a PreToolUse hook rejecting a tool call with continue:false would not end the current turn.
PreToolUse triggers before a tool is about to be called but before it has actually executed, making it suitable for safety guardrails.
Harness Router's PreToolUse hook inspects and makes routing decisions for every tool call that is about to occur.
PreToolUse 事件在工具准备被调用前触发,适合安全防呆,可拦截危险的 Git 指令如 git reset --hard
All Facts (6)
The Claude Agent SDK's PreToolUse and PostToolUse hooks, combined with matchers such as Write|Edit, can block, modify, or log tool calls.
50%UnverifiedThe new version fixes a bug where a PreToolUse hook rejecting a tool call with continue:false would not end the current turn.
50%UnverifiedPreToolUse triggers before a tool is about to be called but before it has actually executed, making it suitable for safety guardrails.
50%UnverifiedHarness Router's PreToolUse hook inspects and makes routing decisions for every tool call that is about to occur.
50%UnverifiedPreToolUse 事件在工具准备被调用前触发,适合安全防呆,可拦截危险的 Git 指令如 git reset --hard
50%Unverifiedclaude-code-setup suggested a PreToolUse hook for this project that blocks direct editing of version-management-related files (manifest.json, src/version.js, package-lock.json, coverage/), because the project synchronizes the version numbers of three files via npm run version:*.
50%