environment-and-config
Installation
SKILL.md
Environment & Config
Overview
Untyped process.env is a runtime landmine: a missing STRIPE_SECRET_KEY shows up as undefined three layers deep at 2am. Validate the whole environment once at boot with zod, expose a typed env object, and make a misconfiguration a startup crash with an actionable message.
When to use
- Adding any new secret or config value.
- A bug traces back to an undefined/empty env var.
- You need to keep server secrets out of the client bundle.
The pattern
// src/env.ts
import { z } from "zod";