PreToolUse

PreToolUse is a hook for Claude Code from Sungmin-Cho/deep-suite. Its token cost is not measured, scanned E, original, MIT.

A pre-command safety check for Bash commands run by the coding agent. It calls a script when commands such as force-pushing Git changes, resetting files, or deleting files match its rules.

In plain words
What is it for?
It is for adding guardrails around dangerous Git and shell commands in an agent project.
Why use it?
It helps catch commands that could overwrite shared Git history or remove data before they run.

Hook for Claude Code

One of 4 entries in settings.json — they are configured in one file and arrive together.

Install

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.

agentmods
npx agentmods add hooks/sungmin-cho/deep-suite/pre-tool-use
Clone the repo
git clone --depth 1 https://github.com/Sungmin-Cho/deep-suite

Made for: Claude Code.

Wrote 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.

agentmods badge for PreToolUse

README.md
[![agentmods](https://agentmods.dev/badge/hooks/sungmin-cho/deep-suite/pre-tool-use.svg)](https://agentmods.dev/hooks/sungmin-cho/deep-suite/pre-tool-use)
Your own site
<a href="https://agentmods.dev/hooks/sungmin-cho/deep-suite/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/sungmin-cho/deep-suite/pre-tool-use.svg" alt="Measured on agentmods" height="20"></a>
Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan E 3 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade E, and why

PreToolUse scanned grade E with 3 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 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.

Downloads and executes remote codehighSupply chain

curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.

"if": "Bash(curl * | sh*)"

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

"if": "Bash(rm -rf *)"

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

"command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh curl-pipe-shell",
examples/hooks-strict-mode/.claude/settings.json · 74 lines

How it starts

The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.

{
  "PreToolUse": [
    {
      "matcher": "Bash",
      "hooks": [
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh force-push",
          "if": "Bash(git push --force *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh force-push",
          "if": "Bash(git push --force)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh force-push",
          "if": "Bash(git push -f *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh force-push",
          "if": "Bash(git push -f)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh hard-reset-remote",
          "if": "Bash(git reset --hard origin/*)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh rm-rf",
          "if": "Bash(rm -rf *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh sql-destructive",
          "if": "Bash(* DROP TABLE *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh sql-destructive",
          "if": "Bash(* TRUNCATE *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh kubectl-destructive",
          "if": "Bash(kubectl delete *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh kubectl-destructive",
          "if": "Bash(kubectl drain *)"
        },
        {
          "type": "command",
          "command": "${CLAUDE_PROJECT_DIR}/scripts/denylist-guard.sh npm-publish",
          "if": "Bash(npm publish*)"
        },
   

Read the full file on GitHub · 74 lines

Same file

What else settings.json configures

This page is one entry in a file that holds 4. Installing the file brings all of them; each is measured and scanned on its own page.

Changes

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.

  1. 5d ago First seen · 74 lines scan E 6ebde4ef6eb5

Subscribe to this mod's changes

PreToolUse is a hook published in the GitHub repository Sungmin-Cho/deep-suite (8 stars, last pushed yesterday), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it E with 3 findings (downloads and executes remote code, 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.