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/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<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="Reviewed on agentmods" width="80" 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 3mo 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 等)" Copies of this mod
1 near-identical copy found in the catalogue:
- PreToolUse — 86% identical, 63 lines differ
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.
- 3mo ago First seen · 71 lines scan C 04da23624fd2
PreToolUse is a hook published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 5mo 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). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
PreToolUse compared with hooks from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| PreToolUsexiaobei930/cc-best | Hook | 50 | 5mo ago | MIT | C | — | Claude Code |
| SessionStartsupabase/supabase | Hook | 116k | today | Apache-2.0 | A | — | Claude Code |
| PostToolUsesupabase/supabase | Hook | 116k | today | Apache-2.0 | A | — | Claude Code |
| SessionStartgoogle-gemini/gemini-cli | Hook | 110k | today | Apache-2.0 | A | — | Claude Code |
| PreToolUseapache/superset | Hook | 76k | today | Apache-2.0 | A | — | Claude Code |
| PreToolUseheygen-com/hyperframes | Hook | 95k | today | Apache-2.0 | A | — | Claude Code |
| PostToolUseanthropics/claude-plugins-official | Hook | 49k | today | Apache-2.0 | A | — | Claude Code |