wowprompt

Environment config loader that validates settings at startup

Writes one typed configuration module that reads every setting from environment variables, checks it at startup, and fails with a clear message when something is missing or wrong. Use it when settings are read all over the codebase, a typo in a variable name only shows up in production, or secrets have crept into the code.

A table of every setting with type, default and whether it is secret, a config module that validates on startup, a sample env file with placeholders, and tests
The output this prompt produced, unedited.

The prompt

What to give

  • Language and framework: [e.g. TypeScript with Node.js, Python with FastAPI, Go]
  • Settings the app uses now: [paste the places where settings are read, or list them]
  • Environments: [e.g. local, staging, production]
  • Validation library allowed: [e.g. zod, pydantic, none]

Task

Collect every setting into one config module that is checked when the app starts.

Checklist

  1. List every setting with its name, type, whether it is required, a safe default if any, and whether it is a secret.
  2. Read values only from environment variables; no hardcoded secrets, hosts or absolute paths.
  3. Parse types: numbers, booleans written as true or false, lists, URLs, durations.
  4. Validate ranges and formats, such as a port between 1 and 65535 or a URL starting with https in production.
  5. Collect every error and stop at startup with one message listing them all.
  6. Export a frozen, typed object; the rest of the code imports it and never reads the environment directly.
  7. Mask secrets when the config is printed or logged.
  8. Produce a sample env file with placeholder values only, and make sure the real env file is in the ignore list.

Output format

  1. | Setting | Type | Required | Default | Secret | Used for |
  2. The config module with comments.
  3. The sample env file.
  4. A short list of the places in the code to change to use the module.
  5. Tests: all settings valid, one missing, one wrong type, a secret masked in logs.

Guardrails

  • Never put a real key, password or token in any output; use placeholders such as [your-api-key].
  • Defaults must be safe; never default to debug mode on or to a production database.
environment variablesapp configurationconfig validationsecrets managementtwelve factor appstartup checks

How to run this

Copy the prompt and paste it into Gemini, then set the aspect ratio to 3:4. No reference photo is needed for this one.

The prompt is written in Markdown with each part under its own heading, which is what the copy action hands over. Change one section at a time, keeping the rest intact, so you can tell which change did the work.

Related prompts

All productivity