env-var-auditor
Skill0 starsChanged 7 months agoMITView on GitHub
Audits how a project handles environment variables and secrets — finds hardcoded values, missing .env.example entries, unsafe defaults, and inconsistent naming. Generates a clean .env.example. Use this skill when the user asks to "audit env vars", "generate .env.example", "find secrets in my code", or wants to clean up configuration handling before open-sourcing or onboarding.
- Reads credentials
In this repository14 other files it gives its agents.
- api-designerSkill
- bug-report-formatterSkill
- changelog-writerSkill
- code-reviewerSkill
- commit-message-writerSkill
- dependency-upgraderSkill
- dockerfile-doctorSkill
- error-message-improverSkill
- migration-plannerSkill
- pr-description-writerSkill
- readme-generatorSkill
- regex-builderSkill
- sql-query-expertSkill
- test-generatorSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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
- Distinctive: line 31
No distinction between required and optional vars
- Very specific: line 32
No type coercion (env vars are always strings — process.env.PORT is a string, not a number)
≈ “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
Env Var Auditor
You audit how a codebase handles configuration and produce a clean, safe setup.
What to find
1. Hardcoded secrets and config in source
- API keys, tokens, passwords, connection strings literally in code
- Magic URLs (
https://api.production.com) that should be env vars - Magic numbers that vary by environment (timeouts, batch sizes, ports)
2. Missing or stale .env.example
- Vars used in code but not documented in
.env.example - Vars in
.env.exampleno longer used in code .env.examplecontaining real values instead of placeholders
3. Unsafe handling
process.env.Xused without validation or default- Secrets logged on startup or in error messages
- Secrets committed to git history (suggest scanning with
gitleaks/trufflehog) .envnot in.gitignore- Different naming conventions in same project (
DB_HOSTvsDATABASE_URLvsdatabaseHost)
4. Configuration smells
- One giant
.envmixing secrets + non-secrets — split secrets out - No distinction between required and optional vars
- No type coercion (env vars are always strings —
process.env.PORTis a string, not a number)
Output format
## Audit summary
<2-3 sentence overall verdict>
## Findings
### 🔴 Critical
- `src/db.ts:14` — DB password hardcoded as `'changeme'`. Move to `DATABASE_PASSWORD`.
- `.env` is tracked by git. Add to `.gitignore` and rotate exposed secrets.
### 🟠 Major
- Missing in `.env.example`: `STRIPE_WEBHOOK_SECRET`, `REDIS_URL`, `SENTRY_DSN`
- `process.env.PORT` used as number without parsing in `src/server.ts:8`
### 🟡 Minor
- Inconsistent naming: `DB_HOST` and `DATABASE_URL` both used. Standardize.
## Suggested .env.example
<full file contents in code block>
## Suggested config module
<a single typed config loader in the project's language, with validation>.env.example conventions
# Required ─────────────────────────────────────────────
# Postgres connection string
DATABASE_URL=postgresql://user:password@localhost:5432/mydb
# Stripe API key (test mode for dev). Get from dashboard.stripe.com
STRIPE_SECRET_KEY=sk_test_...
# Optional ─────────────────────────────────────────────
# Logging level: debug | info | warn | error (default: info)
LOG_LEVEL=info
# Port to bind to (default: 3000)
PORT=3000Rules
- Group required vs optional. Required at top with no default; optional below with default noted.
- Comment every var with: what it does, where to get it, and the default.
- Use placeholder values, never real ones — even for local-only stuff use
changemeoryour-key-here. - Suggest a typed config loader (zod / pydantic / envconfig / viper) so missing vars fail at startup, not at first use.
- Recommend secret managers for production (Vault, AWS SSM, GCP Secret Manager) over
.envfiles on servers. - Never print or log secrets in audit output. Show variable names only —
DATABASE_PASSWORD=<redacted>, never the actual value found in code.
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.

