local-secrets-manage
Skill0 starsChanged 46 days agoMITView on GitHub
Read-only audit of secret-bearing FILES by name (.env, *.pem, *.key, credentials): TRACKED-SECRET / UNIGNORED / OK; proposes .gitignore lines, never applies them. Contents: history-leak-scan. Use when: "is my .env ignored", before a repo goes public.
- Reads credentials
In this repository34 other files it gives its agents.
- audit-codeSkill
- audit-docsSkill
- auditSkill
- bisect-driverSkill
- coding-conventionsSkill
- commit-gateSkill
- compact-ioSkill
- cron-task-manageSkill
- cve-auditSkill
- data-integrity-auditSkill
- decision-logSkill
- deck-builderSkill
- determinism-guardSkill
- etl-validateSkill
- experiment-logSkill
- fetch-firstSkill
- flaky-test-detectorSkill
- github-repo-polishSkill
- golden-lockSkill
- history-leak-scanSkill
- landing-checkSkill
- llm-eval-harnessSkill
- long-taskSkill
- milestone-trackSkill
- opus-workersSkill
- path-quirk-auditSkill
- reorg-proposalSkill
- research-briefSkill
- seed-controlSkill
- shell-portabilitySkill
- skill-vetSkill
- small-taskSkill
- token-squeezeSkill
- venue-fitSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 97
MUST print CANARY PASS n/n before you trust a result.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
local-secrets-manage — is my secret file tracked or ignored?
The engine is local-secrets.js (portable Node, zero deps). It answers a narrow,
high-value question: for every file whose NAME looks like it holds credentials, is
git about to leak it? It walks the working tree, matches basenames against the
secret-file name rules, and for each candidate asks git — ls-files (tracked?) and
check-ignore (ignored?) — then assigns a verdict. That is the whole job.
This is the FILE-STATUS half of secret hygiene. It scans names, never contents:
it never opens a candidate file, never prints a byte of one, never edits
.gitignore. The CONTENT / git-history half — is an actual key string committed
anywhere in history — is history-leak-scan's job (pm-secretscan.js). Run both:
this one catches "my .env is about to be added", that one catches "an AWS key is
already in commit abc123".
Verdicts
| verdict | meaning | fix |
TRACKED-SECRET | the file is in the git index — already leaking (or one push from public) | rotate the credential, then git rm --cached <path> and ignore it |
UNIGNORED | on disk, not tracked yet, and not ignored — one git add . from leaking | add a .gitignore line (--fix-print gives you the exact line) |
OK | ignored — git refuses to add it without -f | none |
Commands
node local-secrets.js [--dir <path>] audit repo at cwd (or <path>)
node local-secrets.js [--dir <path>] --fix-print also print proposed .gitignore lines
node local-secrets.js --canary self-test (the done-check)
node local-secrets.js --help- audit prints a table (verdict / path / matched rule) plus a count line.
Exit 1 if any
TRACKED-SECRETorUNIGNORED; exit 0 clean. - --fix-print appends the
.gitignorelines it WOULD add — the exact path per risky row (/.env,/config/id_rsa, …), so a sibling is never over-ignored. It prints them to stdout only; you copy them in. It never writes the file.
Candidate name rules (basename): .env*, *.pem, *.key, id_rsa*,
id_ed25519*, *_keys.env, credentials*.json, secrets.*. Names containing
example/sample/template/fixture (and .dist/.sample suffixes) are
exempt — a placeholder is not a secret. .git, node_modules, .venv, and
similar build/dep dirs are skipped during the walk.
Examples
- Before making a repo public — confirm no key file is staged:
node local-secrets.js --dir /path/to/repo. A*_keys.env(e.g. a provider API-key file) showingTRACKED-SECRETmeans rotate the credential first, then untrack;UNIGNOREDmeans add the ignore line now. - A backend service holding sensitive user data — a
.envwith a database URL must readOK. If it showsUNIGNORED:node local-secrets.js --dir /path/to/service --fix-printand paste the proposed/.envline into.gitignoreyourself. - This repo — a quick pre-commit sanity check from the repo root:
node local-secrets.js. Clean → exit 0.
Windows notes
- Paths with spaces: quote
--dir(--dir "D:/path with spaces"). Forward slashes work in both PowerShell and Git Bash; git resolves them. - This tool never writes
.gitignore. If you do apply the--fix-printlines by hand in PowerShell, useAdd-Content -Encoding utf8(Set-Content defaults to the ANSI codepage) — a single non-ASCII byte in.gitignoreis harmless, but keep the file UTF-8 to be safe.
Storage / side effects
None. Read-only toward the world: it runs git ls-files / git check-ignore
(both read-only) and fs.readdirSync on directory entries. It writes nothing
outside its own --canary temp dir.
Exit codes
0 clean · 1 any TRACKED-SECRET/UNIGNORED (or canary failure) · 2 usage
error (missing --dir, not a git repo, git unavailable).
Verification (the done-check)
node local-secrets.js --canaryBuilds a throwaway git repo, plants a committed .env (→ TRACKED-SECRET), an
on-disk .env.local (→ UNIGNORED), an ignored .env.ok (→ OK), and an exempt
.env.example; asserts all four verdicts, exit 1, and the exact --fix-print
lines — then asserts a clean repo exits 0 and a non-repo exits 2. Cleans up.
MUST print CANARY PASS n/n before you trust a result.
node local-secrets.js --canary — MUST print CANARY PASS 29/29 before you trust a result.
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.

