- Home
- Skills
- Code Quality & Review
- Env Var and Config Validator: .env Drift and Typed Config
Works with the AI Agents you already use
Env Var and Config Validator: .env Drift and Typed Config
Find .env drift between code, .env.example and deploys, secrets leaked via NEXT_PUBLIC_/VITE_, unsafe defaults, then add fail-fast typed config. VALID / DRIFTED / UNSAFE.
$5
Env Var and Config Validator: .env Drift and Typed Config
Example session with this skill installed
Our Next.js app plus a Python worker keeps breaking on deploy because of missing env vars, and I'm worried something secret is exposed to the browser. Audit our config and set up proper validation.
- Read your context and instructions
- Compiled the env var
- Generated the UI component
Config audit: shop-platform (2026-10-19)
Verdict: UNSAFE - 1 secret exposed to the browser, 1 unsafe default; 9 drift findings. Fixed in code on branch fix/env-config; 2 actions need you.
Stack: Next.js 15, Python 3.12 worker, deploys: Vercel (web), Fly.io (worker), GitHub Actions.
Counts: 31 variables read in code, 24 in .env.example, 12 findings.
Findings (names only, no values)
| Variable | Code | Where | Fix |
|---|---|---|---|
| NEXT_PUBLIC_STRIPE_SECRET_KEY | CLIENT-SECRET | web/lib/pay.ts:8 | Moved call to a server action; renamed STRIPE_SECRET_KEY |
| JWT_SECRET | UNSAFE-DEFAULT | worker/auth.py:12 (getenv("JWT_SECRET", "secret")) | Required; startup fails if missing |
| RESEND_API_KEY | MISSING-EXAMPLE, MISSING-DEPLOY (Fly) | worker/mail.py:4 | Added to example; set on Fly |
| SENTRY_DSN | MISSING-EXAMPLE | web/sentry.server.config.ts:3 | Added |
| FEATURE_CHECKOUT_V2 | UNTYPED | web/app/cart/page.tsx:15 | Parsed as strict boolean |
| PORT | UNTYPED | worker/main.py:30 | int with 1-65535 check |
| LEGACY_S3_BUCKET + 5 more | STALE-EXAMPLE | .env.example | Removed |
| NEXT_PUBLIC_API_URL | BUILD-TIME | web | Documented: needs rebuild per environment |
| (process.env in 14 files) | SCATTERED | web/** | Replaced with imports from web/src/env.ts |
Changes made
web/src/env.tsusing @t3-oss/env-nextjs: 18 server and 4 client variables, build fails on missing or invalid namesworker/config.pyusing pydantic-settings: 9 variables, typed.env.exampleregenerated: 25 variables, grouped, placeholders only- CI:
python3 scripts/env_inventory.py . --checkadded to the lint job
Action list for you (not done by me)
Rotate the Stripe secret key now. It was shipped in client bundles since the commit on 2026-09-02. Then set STRIPE_SECRET_KEY in Vercel (Production + Preview).
2. Set on Fly (worker): RESEND_API_KEY, JWT_SECRET.
3. Not visible to me: Vercel dashboard-only variables. Compare them with the new .env.example.
Next steps
Merge after rotating, redeploy web and worker, confirm both boot (startup validation will name anything still missing).
page.tsx
TSX · React component
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
A deploy fails at 2 AM because a new environment variable was never added to production. A new teammate needs a Slack thread to get the app running. A Stripe secret ends up in the browser bundle because someone gave it a NEXT_PUBLIC_ prefix. process.env.DEBUG is "false", which JavaScript treats as true. Config problems are boring until they take the site down or leak a key.
This skill gives your coding agent a complete config audit and a bundled inventory script that works with variable names only, never values. It:
- Inventories every variable your code reads across JS/TS (process.env, import.meta.env, Deno, Bun), Python, Go, Rust, Ruby and PHP, and compares them with .env.example
- Checks CI and deploy declarations: GitHub Actions, docker-compose, Dockerfile, Kubernetes and Helm, Vercel/Netlify/Render/Fly config, Terraform
- Flags each variable with a clear code: MISSING-EXAMPLE, STALE-EXAMPLE, MISSING-DEPLOY, CLIENT-SECRET, UNSAFE-DEFAULT, UNTYPED, SCATTERED, COMMITTED, BUILD-TIME
- Knows the client-exposure rules for Next.js, Vite, SvelteKit, Nuxt, Astro, Expo, Gatsby and CRA, including build-time inlining
- Adds one typed config module that fails fast at startup with Zod, t3-env, envalid, pydantic-settings or your stack's equivalent, with a clean server/client split
- Regenerates .env.example with grouped, commented, safe placeholders
- Adds a CI check so a new variable without documentation fails the build
- Gives a verdict: VALID, DRIFTED or UNSAFE, plus a names-only action list of what to set in each environment and what to rotate
For developers and teams with more than one environment, a growing list of third-party keys, or onboarding pain.
Safety and honesty: it never prints, copies or summarizes secret values, not even partially. It does not edit real .env files or deploy settings, and it does not rewrite git history. If a real secret is committed, it stops and tells you to rotate it first. It lists the platforms it could not see (such as dashboard-only variables) instead of guessing.
Dashboard-only variables on hosting platforms are not visible from the repo and are listed as not checked. Dynamically constructed variable names cannot be found by static scan. Secret rotation and git history cleanup are left to you.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 28 days ago
Requires