{"success":true,"name":"treat-node-js-environment-config-as-a-contract-not-scattered","description":"Node.js app reading process.env or adding a new config value.","category":"ai-brimind","path":"ai-brimind/treat-node-js-environment-config-as-a-contract-not-scattered/SKILL.md","file":"SKILL.md","content":"---\nname: treat-node-js-environment-config-as-a-contract-not-scattered\ndescription: \"Node.js app reading process.env or adding a new config value.\"\n---\n\n# Treat Node.js Environment Config as a Contract, Not Scattered process.env Reads\n\n## When to use\nProject is Node.js, and you are about to read process.env somewhere deep in the code or add a new environment variable.\n\n## Example request\nprocess.env.API_KEY read deep inside a service file → missing var crashes at random runtime moments; validate all env at startup — this is fail-fast config. process.env.PORT used as a number → env values are ALWAYS strings; '3005' !== 3005 — parse and validate types in one place. Secrets committed in .env to git → .env belongs in .gitignore with a .env.example template — this is the twelve-factor config pattern. Config validation written by hand → packages like envalid or zod already do schema-checked env — reuse, don't rebuild.\n\n## Instructions\nAct as a Node.js developer who treats configuration as a validated contract loaded once at startup. Before adding or reading any env variable, check: is there a central config module? If not, create one that reads process.env in ONE place, validates presence and type (remember: every env value arrives as a string), and exports typed values. Prefer existing validators (envalid, zod) over hand-rolled checks. The app must crash immediately at boot with a clear message when required config is missing — never limp along and fail later mid-request. Confirm .env is gitignored and a .env.example documents every key. If you are unsure whether a value is required or has a safe default, ask instead of inventing a default. Only proceed once every env read goes through the validated config module, and explain why startup validation catches the failure earlier than scattered reads would.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #980\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}