secret-guard
Skill0 starsChanged 22 days agoMITView on GitHub
Keep secrets out of commits, pushes, logs and the chat. Scan the staged diff (or a push range, files, or command output) for API keys and credentials - AWS, Stripe live keys, GitHub, OpenAI, Anthropic, Slack, Google, npm, private keys, database URLs with passwords, .env files, high-entropy secret assignments - refuse when one is found, and print every finding masked. Use before every `git commit` and `git push`, before printing env vars, config files or command output that may contain credentials, when the user pastes or asks for a key, and when they say "check for secrets", "did I commit a key", "is this safe to push", "install a pre-commit hook".
- Reads credentials
- Commits and pushes
2 other projects use a version of this.
Adopted by
Most recently taken up by
- Stophyuk/solutionzip-skillstheir own version, first seen Nov 16, 2026
- kimsb2429/claude-skillstheir own version, first seen Apr 6, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- kimsb2429/claude-skills★ 1same name
- Stophyuk/solutionzip-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- multi-session-gitSkill
- permission-unblockSkill
- post-deploy-smokeSkill
- prove-its-liveSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 27
If it was ever committed, pushed, logged or pasted anywhere: say it must be rotated at the provider.
- Very specific: line 57
Mask command output that may contain secrets: before it reaches the transcript: some-command 2>&1 | node …
- Very specific: line 59
Never ask the user to paste a key into the chat: Ask them to put it in the environment, a gitignored .env, or the platform's secret store …
- Distinctive: line 60
If a secret does appear in the conversation or output, say so plainly and recommend rotating it.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Secret guard
A secret that reaches a commit, a pushed branch, a CI log or a chat transcript is leaked, even if the next commit deletes it. The only fix after that is rotation. So the check runs before, and nothing you print ever shows a full secret.
Before every commit and push
node ${CLAUDE_SKILL_DIR}/scan-secrets.mjs --staged --repo /full/path/to/repo
node ${CLAUDE_SKILL_DIR}/scan-secrets.mjs --diff origin/main..HEAD --repo /full/path/to/repo${CLAUDE_SKILL_DIR} is this skill's folder. Exit 0 = clean, 1 = possible secrets (findings are masked,
e.g. API_TOKEN=Q3v9******** (19 chars)), 2 = could not run (then do not commit; say it was not checked).
On exit 1: stop. Do not commit, do not push, do not "commit now and clean up later".
- Tell the user which file and line, using the masked output only.
- Move the value to an environment variable or a gitignored file (
.envin.gitignore), read it at runtime. - Unstage:
git restore --staged <file>. - If it was ever committed, pushed, logged or pasted anywhere: say it must be rotated at the provider. Rewriting history does not un-leak it.
False positive (test fixture, documented example): add a comment containing secret-guard:allow on that line,
or a path glob to .secretguardignore at the repo root. Say that you did, and why.
Install the hook (optional, recommended)
node ${CLAUDE_SKILL_DIR}/install-hook.mjs --repo /full/path/to/repoWrites a pre-commit hook (respects core.hooksPath) and copies the scanner next to it, so the hook keeps
working after this plugin updates or moves. It will not replace a pre-commit hook it did not write; it prints
the one line to add instead (--force keeps the old one as pre-commit.bak). Never bypass it with
git commit --no-verify unless the user explicitly says so for that commit.
What it detects
AWS access key IDs and secret keys, Stripe live secret and restricted keys and webhook secrets, GitHub tokens
(classic and fine-grained), Anthropic and OpenAI API keys, Slack tokens and webhooks, Google API keys,
SendGrid and npm tokens, PEM private keys, URLs with an inline password (database, Redis, AMQP, HTTP),
high-entropy values assigned to names like *_SECRET, *_TOKEN, API_KEY, PASSWORD, and staged
.env, private key and credentials files. Placeholders (your-key-here, ${VAR}, xxxx) and code
references (process.env.API_KEY) are not flagged. No network calls, no dependencies.
Keep secrets out of chat and logs
- Never print a secret to find out if it is set. Not
echo $API_KEY, notcat .env, notenv, notprintenv, notvercel env pull && cat. Check presence and shape instead:node -e 'const v=process.env.API_KEY||""; console.log(v ? v.slice(0,4)+"... ("+v.length+" chars)" : "missing")' - Read secrets in-process. A script that needs a token reads it from the environment or the tool's own login file and uses it; it never prints it, never passes it as a CLI argument (visible in
psand shell history), never writes it to a log. - Mask command output that may contain secrets before it reaches the transcript:
some-command 2>&1 | node ${CLAUDE_SKILL_DIR}/scan-secrets.mjs --redact - Never ask the user to paste a key into the chat. Ask them to put it in the environment, a gitignored
.env, or the platform's secret store (vercel env add,gh secret set,fly secrets set), where it is entered at a prompt, not on the command line. - If a secret does appear in the conversation or output, say so plainly and recommend rotating it.
- Scan text before you post it anywhere (an issue, a PR description, a Slack message):
node ${CLAUDE_SKILL_DIR}/scan-secrets.mjs - < draft.md.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

