Claude Code Secret Guard — AI skill for Claude Code
Claude Code mod that keeps API keys, tokens and passwords out of the model's context: gitleaks scans every tool output, prompt and attachment before Claude reads it, and you decide what it sees.
How to install Claude Code Secret Guard
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open legostin/claude-code-secret-guard and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Secret Guard does
Claude Code mod that keeps API keys, tokens and passwords out of the model's context: gitleaks scans every tool output, prompt and attachment before Claude reads it, and you decide what it sees.
Alternatives in AI
- Hol Guard — Open-source antivirus for AI agents: block risky tools, secret access, prompt injection, malicious packages, M 485 ★
- Tokentab — A CLI that reads Claude Code, Codex, and Gemini CLI session logs and works out how much they cost, by model, p 226 ★
- Context Attachment Manager — Codex and Claude Code plugin (works in Claude Desktop): choose which past images go to the model with your nex 221 ★
README
secret-guard: keep secrets out of Claude Code's context
[](https://github.com/legostin/claude-code-secret-guard/actions/workflows/ci.yml) [](LICENSE)
**secret-guard** is a [Claude Code](https://claude.com/claude-code) mod (a plugin of function hooks) that stops API keys, tokens, passwords and private keys from reaching the model. Every tool output, prompt and attachment is scanned with [gitleaks](https://github.com/gitleaks/gitleaks) *before* the model reads it. When a secret turns up, the agent pauses and you decide: cut the secret out, hide the whole output, or let it through.
[Русская версия](README.ru.md) · [Website](https://legostin.github.io/claude-code-secret-guard/)
Bash: cat .env: secrets found (github-pat ghp_…[40]). What should the model see?
1. Cut the secrets
2. Hide the whole output
3. Let the model see it
4. Not a secret, allow
The model then reads `GITHUB_TOKEN=[SECRET:github-pat#1]` instead of the token, and never learns the value.
Why
A coding agent reads whatever is in front of it: `cat .env`, a config file, a `curl -v` with an `Authorization` header, a stack trace, a log. Everything it reads is sent to the model and kept in the session transcript. A secret that gets in once is in the conversation for good.
secret-guard puts a checkpoint between your machine and the model:
- Before the model reads anything. It hooks the points where text enters the context, not the transcript afterwards. Once a secret has been sent, removing it later does not take it back.
- The value never reaches the model. Dialogs and the journal show a mask (
ghp_…[40]) and a hash. The pane shows the value itself only when you press show the value, and hides it again after 30 seconds. The value is kept in the mod's memory alone: not in the session state, not on disk, never in a d
Related Skills
Safe Keys
Paste an API key into Claude Code. Nothing keeps it. A Claude Code mod that keeps credentials out of the chat,
Claude Code Secret Gate
The pre-commit secret gate for AI coding agents — content-scans staged changes and blocks any commit containin
Guard Layer
Runtime guardrails between an AI agent and its tools: scan what it reads, gate what it does, and track the ses
Opensecretmask
Secret masking for Claude Code. Every credential becomes a format-preserving fake before the model reads it, a
Infisical Skill
Infisical secret management skill for AI agents — keep API keys out of agent context
Rapg
Local-first secret manager for the AI-agent era — keep API keys out of .env files and out of your agent transc
Related Agents
Secret Purist
The paranoid sentinel of credential security. Use this agent to scan codebases and git history for leaked secr
Secret Guard
MUST be used whenever the user asks to scan for secrets, API keys, credentials, or tokens before a commit or i
Secret Hunter
Hunts publicly-leaked credentials (API tokens, cloud keys, DB strings) that belong to a previously-ingested pr