solana-ai-kit: Hook for Claude Code

.claude/settings.json

PreToolUse is a hook for Claude Code from solanabr/solana-ai-kit. Its token cost is not measured, scanned C, original, MIT.

A pre-command check for Bash actions such as committing code or deploying a Solana program. It runs formatting, linting, type checks, and tests when the project contains the relevant Rust or JavaScript files.

In plain words
What is it for?
Use it to check Rust Solana or Anchor projects, JavaScript and TypeScript projects, and Solana deployments before they run.
Why use it?
It catches common code and deployment problems before changes are committed or sent to the Solana network. It also adds a warning step before deploying to the main network.

Hook for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: positional $N argument.

This is solanabr/solana-ai-kit's own configuration. It tells Claude Code how to work on solana-ai-kit itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything solana-ai-kit configures →

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

Reuse

Borrowing it

Nothing to install: this file belongs to solanabr/solana-ai-kit. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/solanabr/solana-ai-kit/main/.claude/settings.json
Clone the repo
git clone --depth 1 https://github.com/solanabr/solana-ai-kit

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/solanabr/solana-ai-kit/pre-tool-use/github.svg)](https://agentmods.dev/hooks/solanabr/solana-ai-kit/pre-tool-use)
Your own site
<a href="https://agentmods.dev/hooks/solanabr/solana-ai-kit/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/solanabr/solana-ai-kit/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.

agentmods 80×15 button for PreToolUse

Your own site · 80×15
<a href="https://agentmods.dev/hooks/solanabr/solana-ai-kit/pre-tool-use"><img src="https://agentmods.dev/badge/hooks/solanabr/solana-ai-kit/pre-tool-use.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 C 1 finding. 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 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 2mo 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.

Reaches for credential fileshighPrivilege escalation

SSH keys, cloud credentials, git-credentials, .npmrc, /etc/shadow: reading these is how a config file becomes a credential leak.

"command": "INPUT=$(cat)\nCMD=$(printf '%s' \"$INPUT\" | jq -r '.tool_input.command // empty' 2>/dev/null || printf '%s' \"$INPUT\")\nif printf '%s' \"$CMD\" | grep -qE '\\.ssh/|\\.gnupg|\\.aws/|\\.config/solana/id\\.jso
Origin

Copies of this mod

2 near-identical copies found in the catalogue:

.claude/settings.json · 31 lines

How it starts

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

{
  "PreToolUse": [
    {
      "matcher": "Bash",
      "hooks": [
        {
          "type": "command",
          "command": "INPUT=$(cat)\nCMD=$(printf '%s' \"$INPUT\" | jq -r '.tool_input.command // empty' 2>/dev/null || printf '%s' \"$INPUT\")\nif printf '%s' \"$CMD\" | grep -qE '\\.ssh/|\\.gnupg|\\.aws/|\\.config/solana/id\\.json|\\.npmrc|\\.git-credentials|\\.netrc|\\.cargo/credentials|\\.docker/config\\.json|\\.config/gh/hosts|\\.kube/config|\\.pypirc|\\.gem/credentials|Application[\\\\ ]+Support/Google/Chrome|Application[\\\\ ]+Support/BraveSoftware|Application[\\\\ ]+Support/Microsoft[\\\\ ]+Edge|Application[\\\\ ]+Support/Firefox|Application[\\\\ ]+Support/Chromium|Application[\\\\ ]+Support/Vivaldi|Application[\\\\ ]+Support/Arc|Application[\\\\ ]+Support/com\\.operasoftware|\\.config/google-chrome|\\.config/BraveSoftware|\\.config/microsoft-edge|\\.mozilla/firefox|\\.config/chromium|\\.config/vivaldi|\\.config/opera|AppData/Local/Google/Chrome|AppData/Local/BraveSoftware|AppData/Local/Microsoft/Edge|AppData/Roaming/Mozilla/Firefox|AppData/Local/Chromium|AppData/Local/Vivaldi|AppData/Roaming/Opera[\\\\ ]+Software|Local[\\\\ ]+Extension[\\\\ ]+Settings|moz-extension'; then\n  echo '🛑 Blocked: reading private keys, wallet vaults, or credentials is not allowed. Use `solana address` for your pubkey.' >&2\n  exit 2\nfi\nexit 0"
        }
      ]
    },
    {
      "matcher": "Bash",
      "hooks": [
        {
          "type": "command",
          "command": "INPUT=$(cat)\nCMD=$(printf '%s' \"$INPUT\" | jq -r '.tool_input.command // empty' 2>/dev/null || printf '%s' \"$INPUT\")\nprintf '%s' \"$CMD\" | grep -qE 'git commit' || exit 0\n\necho \"🔍 Running pre-commit checks...\"\n\nif [ -f \"Anchor.toml\" ] || grep -q \"solana-program\" Cargo.toml 2>/dev/null; then\n  cargo fmt --check || { cargo fmt; echo \"❌ rustfmt reformatted files — review and re-run the commit\" >&2; exit 2; }\n  cargo clippy --all-targets -- -D warnings || { echo \"❌ cargo clippy failed

Read the full file on GitHub · 31 lines

Same file

What else settings.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. 2mo ago Changed · -9 lines 5c0b8f40c360
  2. 2mo ago Changed · +12 lines scan A → C f1680df3af9e
  3. 3mo ago First seen · 28 lines scan A 1a66e77597fb

Subscribe to this mod's changes

PreToolUse is a hook published in the GitHub repository solanabr/solana-ai-kit (104 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 (reaches for credential files). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

PreToolUse compared with hooks from other repositories

PreToolUse next to 6 hooks from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
PreToolUsesolanabr/solana-ai-kitHook1042mo agoMITC—Claude Code
PreToolUsefusengine/agentsHook341mo agoMITA—Claude Code
SubagentStopfusengine/agentsHook341mo agoMITA—Claude Code
SessionEndfusengine/agentsHook341mo agoMITA—Claude Code
PostToolUsefusengine/agentsHook341mo agoMITA—Claude Code
PostToolUsesupabase/supabaseHook116ktodayApache-2.0A—Claude Code
SessionStartgoogle-gemini/gemini-cliHook110ktodayApache-2.0A—Claude Code