CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

trysac/dotenv-schema

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.

Quality

95%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

schema.mdreferences/

Schema format and issue codes

A schema is a JSON object with a vars map and an optional allowUnknown flag. Unknown fields anywhere are rejected.

{
  "allowUnknown": false,
  "vars": {
    "APP_ENV": { "type": "enum", "values": ["development", "staging", "production"], "required": true },
    "PORT": { "type": "int", "min": 1, "max": 65535, "default": "8080" },
    "DEBUG": { "type": "bool", "default": "false" },
    "DATABASE_URL": { "type": "url", "required": true, "secret": true },
    "REQUEST_TIMEOUT": { "type": "duration", "default": "30s" },
    "SESSION_SECRET": { "type": "string", "required": true, "secret": true, "minLength": 32 },
    "SERVICE_NAME": { "type": "string", "pattern": "^[a-z][a-z0-9-]*$", "maxLength": 40 }
  }
}

Variable fields

FieldTypeMeaning
typestring, requiredstring, int, bool, enum, url or duration.
requiredbooleanThe key must appear in the file, unless it has a default.
secretbooleanValue is left empty in the generated .env.example.
defaultstringUsed in .env.example (when not secret); must satisfy the variable's own rules.
min, maxintegerBounds for int (min must not exceed max).
valueslist of stringsAllowed values for enum; at least one is required.
patternstringRegular expression for string, searched in the value.
minLength, maxLengthintegerLength bounds for string, counted in bytes.

Type rules

  • int: optional sign and decimal digits that fit in 64 bits.
  • bool: exactly true, false, 1 or 0.
  • url: has a scheme and a host (https://example.test/path); no spaces or control characters.
  • duration: Go duration syntax such as 30s, 1h30m, 250ms, 1.5s, or 0; units ns, us, ms, s, m, h.
  • enum: exactly one of values, case-sensitive.
  • string: any text, optionally bounded by minLength, maxLength and pattern.

Issue codes

CodeMeaningMessage form
E001Required key missing (line 0).KEY is required
E002Value has the wrong type.KEY must be an int (or bool, url, duration)
E003Number outside min/max or string outside minLength/maxLength.KEY must be >= 1
E004Value does not match pattern.KEY does not match the required pattern
E005Value is not one of the enum values.KEY must be one of a|b|c
E006Key not in the schema (only when allowUnknown is false).KEY is not in the schema
E007Key defined more than once.KEY is defined more than once

Messages never contain the value. Issues are sorted by line, then key, then code.

Generated .env.example

For each variable, sorted by name:

# <type>[, required][, secret]
KEY=<default, or empty for secrets and variables without a default>

references

SKILL.md

tile.json