Documents and maintains environment variables and config (e.g. .env.example). Use when setting up config, onboarding, or when the user asks for env docs or .env.example.
Keep environment variables and configuration documented and consistent so the app runs correctly in every environment.
process.env, os.environ, env(), config modules, and any loaded config files. List every variable name and where it is used.NAME=example_or_placeholder with comment on same or previous line.# Required. Stripe secret key for payments. Get from dashboard.your-api-key, <secret>, or REPLACE_ME. Never real keys or passwords.Example:
# Database (required)
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
# Auth (required in prod)
JWT_SECRET=your-32-char-secret-minimum
SESSION_KEY=your-session-secret
# Optional; defaults to 3000
PORT=3000
# External API (optional for dev; required for feature X)
STRIPE_API_KEY=sk_test_...
DB_, API_, AUTH_..env, .env.local, and any file with secrets are ignored; do not commit them.| Anti-pattern | Better approach |
|---|---|
| Inventing vars not used in code | Grep for env access; document only what is read |
| Real secrets in .env.example | Use placeholders; document where to get real value |
| No comment on required vs optional | Comment each var so copy-paste works with minimal setup |
| Docs out of sync with validation | Update schema, .env.example, and docs together |