
Env Validation
- 1 installs
- Updated March 7, 2026
- ofershap/env-guard
Validates a .env file against .env.example or a JSON schema, reporting missing, extra, or type-mismatched variables with a non-zero exit code on failure.
About
This skill compares a .env file against .env.example or a JSON schema and returns structured errors for missing, extra, or invalid variables. A developer uses it in CI or pre-deploy hooks to catch environment config problems before the app runs.
- Zero-config diff of .env against .env.example
- JSON schema mode plus exit code 1 for CI use
Env Validation by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,173 of 1,435 DevOps & CI/CD skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/ofershap/env-guard --skill env-validationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| Last updated | March 7, 2026 |
| Repository | ofershap/env-guard ↗ |
What it does
Validates a .env file against .env.example or a JSON schema, reporting missing, extra, or type-mismatched variables with a non-zero exit code on failure.
Files
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.jsonAs 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