Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/pr3m/claude-code-bash-smart-approve/testnpx skills add pr3m/claude-code-bash-smart-approve --skill testgit clone --depth 1 https://github.com/pr3m/claude-code-bash-smart-approveWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00056 | $0.01352 |
| Opus 5 | $0.00028 | $0.00676 |
| Sonnet 5 | $0.00011 | $0.00270 |
| Haiku 4.5 | $0.00006 | $0.00135 |
Grade C, and why
bash-smart-approve:test scanned grade C with 2 findings 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 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
| 4 | `bash -c 'rm -rf /'` | pass-through | Shell interpreter — hook declines to approve; native layer decides | Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
| 5 | `curl -L https://api.github.com/zen` | pass-through | `-L` redirect-following — hook declines to approve | How it starts
The opening of the file, as written. The whole thing — 101 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Self-Test
Validate that the hook logic is working by running a fixed set of synthetic inputs through approve.js and checking the decisions match expectations. This does NOT execute any real bash — just exercises the hook.
Step 1 — Locate the hook
Resolve $CLAUDE_PLUGIN_ROOT/hooks/approve.js. If $CLAUDE_PLUGIN_ROOT is not set, fall back to ~/dev/claude-code-bash-smart-approve/hooks/approve.js and ask the user to confirm the path if it doesn't exist.
Step 2 — Run the test cases
For each case below, pipe the JSON into the hook via Bash and capture both stdout and exit code.
echo '<JSON>' | node "<plugin-root>/hooks/approve.js"
Two outcomes matter:
allow— the hook emits a JSONpermissionDecision: "allow"on stdout. The command is auto-approved.- pass-through — the hook exits 0 with empty stdout. Claude Code's native permission system (settings.json) then decides. This is the hook's posture for anything it can't positively approve; it is NOT a denial.
Cases (expected outcomes)
| # | Command | Expect | Why it matters |
|---|---|---|---|
| 1 | git diff --stat HEAD && echo "---" && git log --oneline -3 |
allow |
Compound && with two well-known binaries |
| 2 | ls /tmp | head -5 | sort |
allow |
Pipe chain |
| 3 | FOO=$(date +%s) && echo "tick $FOO" |
allow |
Env-var prefix + subshell + compound |
| 4 | bash -c 'rm -rf /' |
pass-through | Shell interpreter — hook declines to approve; native layer decides |
| 5 | curl -L https://api.github.com/zen |
pass-through | -L redirect-following — hook declines to approve |
| 6 | $CMD arg |
pass-through | Variable-indirected binary name |
| 7 | node -e "console.log(1)" |
pass-through | Inline-exec flag |
| 8 | obscuretool --flag |
pass-through | Unknown binary |
Sample invocations
echo '{"tool_name":"Bash","tool_input":{"command":"git diff --stat HEAD && echo \"---\" && git log --oneline -3"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"ls /tmp | head -5 | sort"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"FOO=$(date +%s) && echo \"tick $FOO\""}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"bash -c '\''rm -rf /'\''"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"curl -L https://api.github.com/zen"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"$CMD arg"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"node -e \"console.log(1)\""}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
echo '{"tool_name":"Bash","tool_input":{"command":"obscuretool --flag"}}' \
| node "$CLAUDE_PLUGIN_ROOT/hooks/approve.js"
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.
- 2d ago First seen · 101 lines · 56 tokens per session scan C f109736c73ad
bash-smart-approve:test is a skill published in the GitHub repository pr3m/claude-code-bash-smart-approve (1 stars, last pushed 4mo ago), licensed MIT. It adds 56 tokens to every session and 1,352 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it C with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
ondb
A logical analysis and reasoning tool for AI. Use when decomposing documents into structured knowledge, querying entities and relations, validating consistency, or indexing files. Trigger on "remember", "what do I know about", "link X to Y", "show dependencies", "analyze this document", entity CRUD, or cross-skill…
x-mankier
Search and browse man pages from ManKier.com. Command line interface for ManKier man page repository. Dependency: This is an x-cmd module. Install x-cmd first (see x-cmd skill for installation options). see x-cmd skill for installation.
claw-heartbeat-delegation
Task delegation to the heartbeat agent via HEARTBEAT.md. Use when scheduling follow-ups, recurring checks, or recording background jobs for later monitoring.
rule
Skill "rule" from x-cmd/x-cmd, covering rule — rules to rule, 核心命令, 规则文件格式, 示例 and 验证规则文件格式.
wikipedia
Search and read Wikipedia via x wkp — MediaWiki API, no API key, zero install; query, extract, suggest, and DDG route in one module. Load for wiki, wikipedia, encyclopedia lookup, article summary.
cve
Look up CVE records via x cve — cached, zero-API-key, daily xz TSV. Load for cve, vulnerability id, kev, epss, nvd, cvelist, or security advisory.