secrets-discipline
Skill12 starsChanged 47 days agoMITView on GitHub
Enforce safe handling of API keys, tokens, passwords, and credentials — env files, `.gitignore` coverage, `.env.example` upkeep, rotation after exposure. This is the PREVENTIVE workflow; `secrets-scan` is the detection pass that finds what already leaked. Run when adding an integration, before commits, before a first deploy, and when the user pastes something that looks like a credential or says "essa é minha chave da OpenAI", "onde eu coloco esse token?", "posso commitar o .env?".
- Reads credentials
In this repository28 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- business-plan-impact-reviewSkill
- codemapSkill
- cost-watchdogSkill
- daily-standupSkill
- decision-logSkill
- deploy-vercel-supabaseSkill
- feature-scaffoldSkill
- first-100-usersSkill
- grow-sustainablySkill
- multi-ai-reviewSkill
- os-self-testSkill
- pitchSkill
- plain-portuguese-explainerSkill
- privacy-auditSkill
- processizeSkill
- product-briefSkill
- project-genesisSkill
- prototype-labSkill
- registry-pickSkill
- release-checkSkill
- research-wavesSkill
- rollback-safeSkill
- secrets-scanSkill
- sprint-managementSkill
- sprint-roadmapSkill
- usage-monitorSkill
- verify-build-worksSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Before any commit if any file in the changeset contains an = followed by a long opaque string.
- Very specific: line 17
Never paste real secrets into source code: Always use process.env.X (or framework equivalent).
- Very specific: line 18
Always update
.env.example: when introducing a new env var. - Distinctive: line 21
One secret, one env var: Don't reuse the same key for unrelated services.
- Distinctive: line 22
Rotate after exposure: If a secret was committed at any point (even in a deleted file), rotate it.
- Very specific: line 34
Run a quick scan: search for accidental literal API keys — the patterns in .claude/rules/secrets.md (sk-, ghp_, github_pat_, AKIA, …
- Distinctive: line 35
If any literal secret is found in a tracked file, stop and ask the user to rotate.
≈ “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
Secrets Discipline
When to run this skill
- The user is adding a new integration (Stripe, Supabase, OpenAI, etc.).
- The user pastes a string that looks like a secret (long random, starts with
sk-,sk_,pk_,re_,ghp_,AKIA, etc.). - Before any commit if any file in the changeset contains an
=followed by a long opaque string. - The user says "vou colocar a chave" / "where do I put my key".
Rules
- Never paste real secrets into source code. Always use
process.env.X(or framework equivalent). - Always update
.env.examplewhen introducing a new env var. The example file documents the existence of the variable, not its value. - Never commit
.envor any.env.<stage>—.env.local,.env.development,.env.staging,.env.production. Only the templates (.env.example,.sample,.template,.dist) are committed. The rest are gitignored — verify before commit. - Server-only secrets must stay server-only. In Next.js, anything starting with
NEXT_PUBLIC_is shipped to the browser. If it's a secret, do NOT prefix it. - One secret, one env var. Don't reuse the same key for unrelated services.
- Rotate after exposure. If a secret was committed at any point (even in a deleted file), rotate it. Git history retains it.
Vibe coder explanation
Secrets are like the keys to your house. The
.envfile is the keychain you keep at home. The.env.exampleis the description of what keys you need (front door, garage, mailbox) without showing what they look like. When you share your project on GitHub, you share the description — never the actual keys.
Workflow
- Identify all secret-like values in the proposed change.
- Confirm each is referenced via
process.env.X(or equivalent). - Confirm
.env.exampledocuments each new variable with a comment explaining purpose. - Confirm
.envand.env.*are in.gitignore, with the templates excepted (git check-ignore .env.developmentmust print the name). - Run a quick scan: search for accidental literal API keys — the patterns in
.claude/rules/secrets.md(sk-,ghp_,github_pat_,AKIA, private-key headers) — the hook in.claude/hooks/blocks the same set at commit time — plussk_[a-zA-Z0-9]{20,},pk_[a-zA-Z0-9]{20,},re_[a-zA-Z0-9]{20,},AIza[a-zA-Z0-9\-_]{35}. - If any literal secret is found in a tracked file, stop and ask the user to rotate.
Output
✅ secrets-discipline check
- New variables documented in .env.example: STRIPE_WEBHOOK_SECRET
- No literal secrets in source code
- .gitignore covers .env files
- Server-only vars not exposed via NEXT_PUBLIC_
⚠️ If you committed a real key earlier, rotate it now in the provider dashboard.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.

