Skill: charlie-morrison/env-config-validator (version 1.0.1)

--- name: env-config-validator description: Validate .env files against schemas, compare environments (dev vs prod), detect common mistakes (trailing spaces, placeholders, invalid ports, missing protocols, duplicate keys, unquoted spaces), auto-generate schemas, and type-check values. Supports text, JSON, and markdown output with CI-friendly exit codes. Use when asked to validate environment config, check .env files for errors, compare env files, diff environments, detect env misconfigurations, generate env schema, audit .env variables, check for missing env vars, or ensure env consistency across environments. Triggers on "validate env", "check .env", "compare environments", "env diff", "env schema", "env audit", "missing env vars", "environment config". --- # Env Config Validator Validate .env files, compare environments, detect common mistakes, and enforce schemas. ## Quick Start ```bash # Validate with auto-detected common checks python3 scripts/validate_env.py .env # Validate against a schema python3 scripts/validate_env.py .env --schema env-schema.json # Compare dev vs prod python3 scripts/validate_env.py --diff .env.development .env.production # Generate schema from existing .env python3 scripts/validate_env.py --generate-schema .env -o env-schema.json # JSON output for CI python3 scripts/validate_env.py .env --output json --severity error ``` ## Common Checks (Auto-Detected) The validator automatically detects these issues without a schema: | Check | Severity | What it catches | |-------|----------|-----------------| | Trailing whitespace | warning | Invisible chars causing bugs | | Unquoted spaces | warning | Values with spaces not wrapped in quotes | | Placeholders | error | `change_me`, `TODO`, `xxx`, `your_*` values | | Empty values | info | Defined but blank variables | | Double-nested quotes | warning | `""value""` quoting errors | | URL missing protocol | warning | URL vars without http(s):// | | Port out of range | error | Port > 65535 or < 1 | | Short secrets | warning | SECRET/PASSWORD/KEY < 8 chars | | Inconsistent booleans | info | `yes`/`1` instead of `true`/`false` | | Mixed case keys | info | `some_Var` instead of `SOME_VAR` | | Inline comments | warning | `value # comment` (not all parsers support) | | Duplicate keys | warning | Same variable defined twice | ## Options | Flag | Default | Description | |------|---------|-------------| | `--schema` | — | JSON schema file for type/required validation | | `--diff FILE FILE` | — | Compare two env files | | `--generate-schema` | — | Auto-generate schema from .env file | | `--output` | text | Output format: text, json, markdown | | `-o` | stdout | Output file path | | `--ignore` | — | Skip specific check IDs (repeatable) | | `--severity` | info | Minimum severity: error, warning, info | ## Exit Codes - `0` — No issues (or only info) - `1` — Warnings found (or diff has differences) - `2` — Errors found ## Workflow ### Pre-deploy Validation 1. Generate schema from working .env: `--generate-schema .env -o schema.json` 2. Add schema to repo, validate in CI: `validate_env.py .env --schema schema.json --severity error` 3. Diff staging vs prod: `--diff .env.staging .env.production` ### Audit Existing Project 1. Run `validate_env.py .env` to find common mistakes 2. Fix errors and warnings 3. Generate schema for future validation ## References - **schema-format.md** — Full JSON schema specification, supported types, field reference

path: STATUS.md
content: # env-config-validator — Status

**Status:** Ready
**Price:** $49
**Built:** 2026-03-30

## Features
- 12 common mistake detectors (placeholders, trailing spaces, invalid ports, etc.)
- Schema validation with type checking, required vars, patterns, ranges
- Environment diff (dev vs prod) with secret masking
- Auto-generate schema from existing .env
- 3 output formats (text, JSON, markdown)
- CI-friendly exit codes
- Handles export prefix, quoted values, comments

## Tested
- Common checks with 15 detected issues
- Schema generation and validation
- Environment diff with secret masking
- JSON and markdown output
- Severity filtering
- Edge cases (empty values, duplicates, inline comments)


path: log.md
content: # env-config-validator — Log

## 2026-03-30

### Done
- Built complete .env validator
- Script: `scripts/validate_env.py` (~400 lines Python stdlib)
- Reference: `references/schema-format.md` — schema JSON spec, types, fields
- 12 common mistake detectors, 10 supported types
- Schema validation, env diff, auto-generate schema
- 3 output formats, CI-friendly exit codes
- Tested: common checks, schema gen/validation, diff, all outputs
- Packaged to `dist/env-config-validator.skill` ✅

### Decisions
- $49 pricing — entry-level, high volume potential
- Pure Python stdlib
- Secret masking in diff output (first 3 chars + ***)


path: references/schema-format.md
content: # Schema Format Reference

## Schema JSON Structure

```json
{
  "variables": {
    "VARIABLE_NAME": {
      "type": "string",
      "required": true,
      "description": "What this variable does",
      "pattern": "^regex$",
      "default": "default_value",
      "example": "example_value",
      "sensitive": false,
      "min": 0,
      "max": 65535
    }
  }
}
```

## Field Reference

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `type` | string | no | Expected type (see below) |
| `required` | boolean | no | Whether variable must exist |
| `description` | string | no | Human-readable description |
| `pattern` | string | no | Regex pattern for validation |
| `default` | string | no | Default value (informational) |
| `example` | string | no | Example value (informational) |
| `sensitive` | boolean | no | If true, mask in diff output |
| `min` | number | no | Minimum for numeric values |
| `max` | number | no | Maximum for numeric values |

## Supported Types

| Type | Validates | Examples |
|------|-----------|---------|
| `string` | Any value | `production`, `hello world` |
| `integer` | Digits only | `3000`, `10` |
| `float` | Decimal number | `0.5`, `3.14` |
| `boolean` | true/false/yes/no/1/0/on/off | `true`, `false` |
| `url` | Protocol prefix required | `https://api.example.com` |
| `email` | [REDACTED_SECRET] format | `[REDACTED_SECRET]` |
| `ip` | IPv4 dotted notation | `192.168.1.1` |
| `port` | 1-65535 | `3000`, `8080` |
| `path` | Starts with / or ~ | `/var/log/app.log` |
| `connection_string` | postgres/mysql/redis/etc:// | `postgres://user:pass@host/db` |

## Auto-Generated Schema

Use `--generate-schema .env` to create a schema from an existing file. It infers:
- Variable types from key names and value patterns
- Required flag (all set to true)
- Sensitive flag for SECRET/PASSWORD/KEY/TOKEN variables
- Example values from current values


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)