CommandOpen
Database Configuration
Set up environment configuration files from templates with validation.
Set up environment configuration files from templates with validation.
Steps
- Scan for environment template files:
.env.example,.env.template,.env.sample. - If no template exists, analyze the codebase for environment variable usage:
- Search for
process.env.,os.environ,env::var,os.Getenvpatterns. - Extract all referenced variable names.
- Generate
.env.examplewith all required variables:
- Group by category (database, API keys, feature flags, etc.).
- Add descriptions as comments.
- Include sensible defaults for non-sensitive values.
- Mark required vs optional variables.
- If
.envdoes not exist, create it from the template:
- Copy
.env.exampleto.env. - Prompt for values of required variables without defaults.
- Verify
.envis in.gitignore. - Generate a TypeScript/Python config module that validates env vars at startup.
Format
# Database Configuration
DATABASE_URL=postgresql://localhost:5432/myapp # Required
DATABASE_POOL_SIZE=10 # Optional, default: 10
# API Keys
API_KEY= # Required, no defaultRules
- Never commit
.envfiles; always verify.gitignoreincludes them. - Always provide an
.env.examplewith placeholder values, never real credentials. - Mark each variable as required or optional with clear comments.
- Generate runtime validation that fails fast on missing required variables.
- Use consistent naming: UPPER_SNAKE_CASE with logical prefixes.
Author: rohitg00, Claude Code toolkit (rohitg00). License: Apache-2.0.
Shown here with formatting for the web. Keep the author and license notice when you reuse it.
Related entries
There are more like this in the members library
The Codex library holds 7,009 entries. Members can search all of them by meaning and read every one in full.