Ask Claude to Generate Your .env.example from Application Source
Keeping .env.example in sync with the variables your app actually uses is an easy thing to forget and an annoying thing to fix when someone clones the repo and nothing works. Ask Claude to scan your codebase and generate a fresh .env.example with every variable, sensible placeholder values, and explanatory comments.
claude -p "Scan this codebase for all environment variable usages and generate a complete .env.example with placeholder values and a comment explaining each variable's purpose"
Claude finds every process.env.X, env('X'), $_ENV['X'], and os.environ.get('X') call across the project and produces something like:
# Application
APP_NAME=MyApp
APP_URL=http://localhost:3000
APP_ENV=local
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=myapp_development
DB_USER=postgres
DB_PASSWORD=secret
# External Services
STRIPE_SECRET_KEY=sk_test_your_key_here
SENDGRID_API_KEY=SG.your_key_here
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_BUCKET=your-bucket-name
This also doubles as a light security audit — Claude will flag any variable that looks like it might contain a real secret rather than a placeholder, and remind you to add the file to .gitignore if it's not already there.
An accurate .env.example is the fastest way to onboard a new developer without a call.
Log in to leave a comment.
The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.