Claude Code Secret Gate — AI skill for Claude Code
The pre-commit secret gate for AI coding agents — content-scans staged changes and blocks any commit containing keys or tokens.
How to install Claude Code Secret Gate
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open roozbeh-bahrami/claude-code-secret-gate and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Secret Gate does
The pre-commit secret gate for AI coding agents — content-scans staged changes and blocks any commit containing keys or tokens.
Alternatives in AI
- Hol Guard — Open-source antivirus for AI agents: block risky tools, secret access, prompt injection, malicious packages, M 485 ★
- Prismor — Self-hosted runtime control plane for AI agents 334 ★
- Forgedock Init — AI-powered forge.yaml config generator — scans codebase, queries GitHub, auto-fills all optional sections from 117 ★
README
claude-code-secret-gate 🔒
**Your AI coding agent commits fast and often. This is the mechanical gate that stops it from committing secrets — before they become permanent history.**
Built for Claude Code and any AI-agent workflow; works in any plain git repo too. One shell script, zero dependencies. It scans what's *staged* (the exact content about to enter git) and blocks the commit if it finds:
- 🔑 Secret-shaped strings inside file content: JWTs, private key blocks, AWS keys, GitHub/Slack/OpenAI/Stripe-style tokens, GoHighLevel PITs
- 📄 Credential-looking filenames:
.env,.pem,id_rsa,credentials*.json…
Why content scanning matters
`.gitignore` only blocks files you *expected* to be secret. The leaks that actually happen are tokens pasted into a config export, an API response saved as JSON, a workflow backup with an embedded key. Filename rules never catch those — **content scanning does**. This gate caught three real leaks in its first day of use (workflow exports with embedded live tokens that every filename rule missed).
Install (once per repo)
cp gate.sh .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
Done. Every `git commit` now runs the gate automatically:
✅ secret-gate: staged content clean. ← commit proceeds
🚨 SECRET-GATE: secret-shaped strings... ← commit BLOCKED, nothing recorded
Or run it manually
git add -A
./gate.sh # ✅ or 🚨
git commit -m "..."
Working with AI coding agents?
Paste this into your agent's instructions:
Between `git add` and `git commit`, ALWAYS run `./gate.sh`. If it fails, ABORT the commit, unstage the flagged files, fix `.gitignore`, and rescan. Never use `--no-verify`.
An AI agent commits fast and often — exactly why it needs a mechanical gate, not a promise to be careful.
Extend it
Patterns live in one variable (`PATTERNS`) — add your platform's token shapes. Keep the rule: **when the gate and your convenience disagree,
Related Skills
Power Coding
Mindful-coding OS for any LLM coding agent (Claude Code, Codex, Gemini CLI) — the Five Forces: session handoff
Git AI
Stop writing commit messages by hand. AI-powered conventional commits from your staged changes — powered by Cl
Skillgate
Deterministic finish-line gates for AI coding agents. A model-independent evaluator that blocks commit/publish
Reflex
Pre-execution risk gate for AI coding agents (Claude Code, Codex, opencode, pi, Hermes). Blocks or asks on ris
Klarion
AI-powered secret scanner for code and git history. Finds leaked API keys, tokens and credentials with near-ze
Harness Gate
Gate the agent setup on corpus-validated rules (gating tier). Fast, no LLM, exits nonzero on errors and warnin
Related Agents
Secret Guard
MUST be used whenever the user asks to scan for secrets, API keys, credentials, or tokens before a commit or i
Sp Reviewer
Use as a pre-push guardrail before committing or pushing. Runs lint, build, tests and a secret scan, reviews t
Forge Speccer Validator
Pre-planning path-validation gate. Scans a spec file for path tokens inside code fences or backticks, checks e