env-validation
Installation
SKILL.md
Environment Variable Validation
Use this skill to validate .env files against .env.example or a JSON schema. Catches missing, extra, or invalid environment variables before your app does.
Usage
# Zero config — checks .env against .env.example
npx env-guard
# Custom paths
npx env-guard --env .env.production --example .env.example
# JSON schema validation
npx env-guard --schema env-schema.json
As a Library
import { validate } from "env-guard";
const result = validate({
env: ".env",
example: ".env.example",
});
if (!result.valid) {
console.error(result.errors);
process.exit(1);
}
Key Patterns
- Zero config by default — compares
.envagainst.env.examplein the current directory - JSON schema mode validates types, patterns, and required fields
- Returns structured errors: missing variables, extra variables, type mismatches
- Zero dependencies — no supply chain risk
- Exit code 1 on failure — safe to use in CI pipelines and pre-deploy hooks
Weekly Installs
1
Repository
ofershap/env-guardFirst Seen
Mar 5, 2026
Security Audits
Installed on
mcpjam1
claude-code1
replit1
junie1
windsurf1
zencoder1