BeforeTool

BeforeTool is a hook for Claude Code from Jamkris/everything-gemini-code. Its token cost is not measured, scanned A, original, MIT.

A set of automatic checks that run before a coding agent executes shell commands. Shell commands are instructions such as installing packages, running tests, building code, or starting a development server.

In plain words
What is it for?
Use it to guard package-manager commands, builds, tests, Docker commands, Git operations, and development-server launches.
Why use it?
It helps prevent commands from bypassing project checks, starting development servers in unsuitable ways, or using risky command options.

Hook for Claude Code

Written for Claude Code: a Claude Code hooks.json.

One of 6 entries in hooks.json upstream. Installing this one merges just its entry into your config; the other 5 are separate, each on its own page.

Good fit Use it to guard package-manager commands, builds, tests, Docker commands, Git operations, and development-server launches.

Compare 6 hooks from other repositories ↓
Install with agentmods
npx agentmods add hooks/jamkris/everything-gemini-code/before-tool
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.

Clone the repo
git clone --depth 1 https://github.com/Jamkris/everything-gemini-code

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 BeforeTool

README.md
[![agentmods](https://agentmods.dev/badge/hooks/jamkris/everything-gemini-code/before-tool/github.svg)](https://agentmods.dev/hooks/jamkris/everything-gemini-code/before-tool)
Your own site
<a href="https://agentmods.dev/hooks/jamkris/everything-gemini-code/before-tool"><img src="https://agentmods.dev/badge/hooks/jamkris/everything-gemini-code/before-tool/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.

agentmods 80×15 button for BeforeTool

Your own site · 80×15
<a href="https://agentmods.dev/hooks/jamkris/everything-gemini-code/before-tool"><img src="https://agentmods.dev/badge/hooks/jamkris/everything-gemini-code/before-tool.svg" alt="Reviewed on agentmods" width="80" 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 A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

BeforeTool scanned grade A with 0 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 1mo 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

hooks/hooks.json · 64 lines

How it starts

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

{
  "BeforeTool": [
    {
      "matcher": "tool == \"run_shell_command\"",
      "hooks": [
        {
          "type": "command",
          "command": "node \"$HOME/.gemini/extensions/everything-gemini-code/scripts/hooks/block-no-verify.js\""
        }
      ],
      "description": "Block git --no-verify and core.hooksPath= overrides on commit/push/merge/cherry-pick/rebase/am — protects pre-commit, commit-msg, and pre-push hooks from being skipped"
    },
    {
      "matcher": "tool == \"run_shell_command\"",
      "hooks": [
        {
          "type": "command",
          "command": "node \"$HOME/.gemini/extensions/everything-gemini-code/scripts/hooks/pre-bash-dev-server-block.js\""
        }
      ],
      "description": "Block dev servers outside tmux — quote/subshell/brace-aware via scripts/hooks/pre-bash-dev-server-block.js. Allows tmux new-session -d -s dev \"npm run dev\" launchers and ignores literal mentions inside quoted strings (git commit messages, echo args, grep patterns)."
    },
    {
      "matcher": "tool == \"run_shell_command\" && tool_input.command matches \"^\\\\s*(npm (install|test|i|ci)|pnpm (install|test|i)|yarn (install|test|add|remove|upgrade)|bun (install|test|i|add|remove)|cargo build|make|docker|pytest|vitest|playwright)\\\\b\"",
      "hooks": [
        {
          "type": "command",
          "command": "node -e \"if(!process.env.TMUX){console.error('[Hook] Consider running in tmux for session persistence');console.error('[Hook] tmux new -s dev  |  tmux attach -t dev')}\""
        }
      ],
      "description": "Reminder to use tmux for long-running commands. Anchored at start (^\\s*) so literal mentions inside quoted strings don't trigger it; includes the short forms `pnpm i`, `npm ci`, `bun i`, and `yarn add/remove/upgrade` that the previous matcher silently skipped."
    },
    {
      "matcher": "tool == \"run_shell_command\" && tool_input.command matches \"^\\\\s*git\\\\s+push\\\\b\"",
      "hooks": [
        {
          "t

Read the full file on GitHub · 64 lines

Same file

What else hooks.json configures

This page is one entry in a file that holds 6. 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. 1mo ago First seen · 64 lines scan A 60e02cd64023

Subscribe to this mod's changes

BeforeTool is a hook published in the GitHub repository Jamkris/everything-gemini-code (89 stars, last pushed 4mo ago), licensed MIT. Its token cost is not measured: a hook is shell that never enters the context. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.