agentleFS
kakarot-oncloudkakarot-oncloud/claude-dev-skills/skills/env-var-auditor/SKILL.md

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

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
  1. Distinctive:

    No distinction between required and optional vars

    line 31
  2. Very specific:

    No type coercion (env vars are always strings — process.env.PORT is a string, not a number)

    line 32

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.example no longer used in code
  • .env.example containing real values instead of placeholders

3. Unsafe handling

  • process.env.X used without validation or default
  • Secrets logged on startup or in error messages
  • Secrets committed to git history (suggest scanning with gitleaks / trufflehog)
  • .env not in .gitignore
  • Different naming conventions in same project (DB_HOST vs DATABASE_URL vs databaseHost)

4. Configuration smells

  • One giant .env mixing secrets + non-secrets — split secrets out
  • No distinction between required and optional vars
  • No type coercion (env vars are always strings — process.env.PORT is 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=3000

Rules

  1. Group required vs optional. Required at top with no default; optional below with default noted.
  2. Comment every var with: what it does, where to get it, and the default.
  3. Use placeholder values, never real ones — even for local-only stuff use changeme or your-key-here.
  4. Suggest a typed config loader (zod / pydantic / envconfig / viper) so missing vars fail at startup, not at first use.
  5. Recommend secret managers for production (Vault, AWS SSM, GCP Secret Manager) over .env files on servers.
  6. Never print or log secrets in audit output. Show variable names only — DATABASE_PASSWORD=<redacted>, never the actual value found in code.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.