Validate .env files against a JSON schema (string, int, bool, enum, url, duration, pattern) and generate a .env.example. Use when checking a .env file, documenting required variables or catching config drift. Prints key names only, never values.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Check that a .env file has the variables an application expects, with the right shapes, and
keep .env.example in sync from the same schema. The bundled script works on its own: nothing to
install or build.
env, printenv or echo $VAR, and never open .env files nobody asked you to check..env file. The script reports key names, line
numbers and issue codes only; keep your own answers to that level too..env file is valid, complete or misconfigured..env.example that matches reality.Find or write the schema (a JSON file). Format and a full example are in
references/schema.md. If none exists, draft one from the code that
reads configuration, mark credentials "secret": true, and show it to the user.
Validate one or more files:
python3 scripts/dotenv_schema.py --schema schema.json .env
python3 scripts/dotenv_schema.py --schema schema.json --json .env .env.productionPut options before the file names. Output is one line per issue, file:line: CODE message
(--json prints an array of {code, key, line, message}). Line 0 means the issue is not
tied to a line, for example a missing required key.
Explain each issue using the codes in references/schema.md: E001
required, E002 type, E003 range or length, E004 pattern, E005 enum, E006 unknown
key, E007 duplicate key. Say which key and line to change and what shape is expected, never
what the current value is.
Generate the template:
python3 scripts/dotenv_schema.py --schema schema.json --example > .env.exampleVariables are sorted by name, each preceded by # <type>[, required][, secret]. Secrets and
variables without a default are written empty.
Exit codes: 0 valid, 1 issues found, 2 usage, I/O, syntax or schema error. A syntax
error in the .env file stops the run and reports the line and reason, not the content.
Blank lines and # comment lines are skipped; an export prefix is accepted; keys match
^[A-Za-z_][A-Za-z0-9_]*$ and = is required. Unquoted values are trimmed and cut at the first
#. Single-quoted values are literal. Double-quoted values support \n, \t, \" and \\
and cannot span lines. There is no variable expansion. Limits: 1 MiB per file, 10,000 lines,
65,536 bytes per value.
^ and $ for a full match..env syntax as described above. No shell semantics, no ${VAR} expansion, no
multi-line values.This skill bundles a standard-library port of the validator implemented by the dotenv-schema Go package: https://github.com/Trysac/u275-dotenv-schema