Getting it into your agent
This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.
/plugin marketplace add xiaobei930/cc-best/plugin install cc-bestWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/hooks/xiaobei930/cc-best/pre-tool-use)<a href="https://agentmods.dev/hooks/xiaobei930/cc-best/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/xiaobei930/cc-best/pre-tool-use.svg" alt="Measured on agentmods" height="20"></a>Grade C, and why
PreToolUse scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.
A static scan of the commands this hook runs, not an audit. A hook is shell that executes on your machine at the event it names, which is why every command in it is printed with what was found.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
"description": "命令验证: 阻止危险命令 (rm -rf /, git push --force 等)" This is a copy
55% identical to SessionStart — 68 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
What it actually says
{
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/validate-command.js\"",
"timeout": 5
}
],
"description": "命令验证: 阻止危险命令 (rm -rf /, git push --force 等)"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/pause-before-push.js\"",
"timeout": 5
}
],
"description": "推送确认: git push 前暂停确认"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/check-secrets.js\"",
"timeout": 10,
"statusMessage": "检查密钥泄露..."
}
],
"description": "密钥检测: 检查命令中是否包含 API 密钥等敏感信息"
},
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/protect-files.js\"",
"timeout": 3
}
],
"description": "文件保护: 阻止修改敏感文件 (.env, .key, .git/ 等)"
},
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/block-random-md.js\"",
"timeout": 3
}
],
"description": "Markdown 文件保护: 阻止在根目录创建随机 .md 文件"
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/node/hooks/long-running-warning.js\"",
"timeout": 5
}
],
"description": "长时间命令警告: 检测开发服务器、watch 等长时间运行命令"
}
]
}What else hooks.json configures
This page is one entry in a file that holds 20. Installing the file brings all of them; each is measured and scanned on its own page.
- Hook ConfigChange A not measured
- Hook CwdChanged A not measured
- Hook FileChanged A not measured
- Hook InstructionsLoaded A not measured
- Hook MessageDisplay A not measured
- Hook Notification A not measured
- Hook PermissionDenied A not measured
- Hook PermissionRequest A not measured
- Hook PostCompact A not measured
- Hook PostToolUse A not measured
- Hook PostToolUseFailure A not measured
- Hook PreCompact A not measured
- Hook SessionEnd A not measured
- Hook SessionStart A not measured
- Hook Stop A not measured
- Hook SubagentStart A not measured
- Hook SubagentStop A not measured
- Hook TaskCompleted A not measured
- Hook UserPromptSubmit A not measured
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 5d ago First seen · 71 lines scan C 04da23624fd2
PreToolUse is a hook published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it C with 1 finding (recursive force delete). It is 55% identical to SessionStart, differing in 68 lines, and is treated as a copy.
Other hooks, from other repositories
PostToolUse
Runs after a tool call finishes for Edit and Write tool calls, executing auto-format.sh, version-consistency-check.sh and activity-logger.sh via bash (3 commands). From FlorianBruniaux/claude-code-ultimate-guide.
PreToolUse
Runs before the agent uses a tool for Bash, Edit and Write tool calls, executing dangerous-actions-blocker.sh via bash. From FlorianBruniaux/claude-code-ultimate-guide.
SessionStart
Runs when a session starts, executing rtk-baseline.sh. From FlorianBruniaux/claude-code-ultimate-guide.
Notification
Runs when the agent sends a notification, executing notification.sh via bash. From FlorianBruniaux/claude-code-ultimate-guide.
UserPromptSubmit
Runs when you submit a prompt, before the agent sees it, executing smart-suggest.sh. From FlorianBruniaux/claude-code-ultimate-guide.
Stop
Runs when the agent finishes a response, executing index-sync-reminder.sh via bash. From FlorianBruniaux/claude-code-ultimate-guide.