env-validator

A startup checker for .env files, which store an application's environment settings. It compares required variables with a defined schema and checks their values.

In plain words
What is it for?
Use it when adding environment variables, setting up a deployment, or investigating configuration issues. It can check types and constraints and keep .env.example up to date.
Why use it?
It catches missing, empty, misspelled, or incorrectly formatted settings before the application starts, reducing configuration problems between machines and deployments.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/luqiang-code/claude-code-skills/env-validator
Any agent
npx skills add luqiang-code/claude-code-skills --skill env-validator
Clone the repo
git clone --depth 1 https://github.com/luqiang-code/claude-code-skills

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 625 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00045 $0.00625
Opus 5 $0.00023 $0.00313
Sonnet 5 $0.00009 $0.00125
Haiku 4.5 $0.00005 $0.00063

Measured 2d ago against content hash d128c7d5fa55, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

env-validator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

community-skills/env-validator/SKILL.md · 77 lines

How it starts

The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Environment Variable Validator

Validate .env files against a schema to catch misconfigurations at startup.

When to Use

  • Adding new environment variables to a project
  • Debugging "works on my machine" config issues
  • Setting up a new deployment environment
  • User mentions "env", "environment variables", ".env validation"

When NOT to Use

  • Secrets management (use a vault/secrets manager for production secrets)
  • Runtime config that changes frequently (use a config service)

Workflow

  1. Scan the project for .env.example, .env, and code that reads env vars
  2. Build a schema of all required and optional env vars with types
  3. Generate a validation module that runs at startup:
    • Check required vars are present
    • Validate types (string, number, boolean, URL, email)
    • Validate constraints (min/max length, enum values, regex patterns)
    • Warn on unused or misspelled vars
  4. Create/update .env.example with all vars and descriptions
  5. Add a pre-start check script

Output

// src/config/env.ts
const schema = z.object({
  PORT: z.coerce.number().min(1024).max(65535).default(3000),
  DATABASE_URL: z.string().url().startsWith("postgresql://"),
  REDIS_URL: z.string().url().optional(),
  JWT_SECRET: z.string().min(32),
  LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
  CORS_ORIGIN: z.string().url(),
  SMTP_HOST: z.string().optional(),
  SMTP_PORT: z.coerce.number().optional(),
});

export const env = schema.parse(process.env);

Key Principles

  • Fail fast at startup — don't fail mid-request on missing config
  • Use Zod/joi/yup for schema validation (match project's existing stack)
  • Always provide clear error messages: "Missing DATABASE_URL. Expected: postgresql://..."
  • Generate .env.example with descriptions and defaults
  • Don't log secrets in validation errors

Notes

  • Add .env to .gitignore if not already there
  • .env.example should be committed, .env should never be
  • Consider adding an npm run check-env script for CI

Read the full file on GitHub · 77 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 77 lines · 45 tokens per session scan A d128c7d5fa55

Subscribe to this mod's changes

env-validator is a skill published in the GitHub repository luqiang-code/claude-code-skills (2 stars, last pushed 3mo ago), licensed MIT. It adds 45 tokens to every session and 625 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.