env-config-sleuthlisted
Install: claude install-skill RMAzrim/opencode-artes
# Env Config Sleuth
## 1. System Architecture & Prerequisites
Most "it works on my machine" incidents are a missing or misspelled env var.
Sleuth extracts every `process.env.X` (Node), `os.getenv("X")` /
`os.environ["X"]` (Python), and `${X:-...}` usage, then diffs that reference
set against the union of definitions found in `.env*`, docker-compose, CI
workflows, and docs. Node 18+ stdlib only.
Reference sources scanned:
- Code references (AST-free regex over `.ts/.js/.mjs/.py/.env` templates)
- Definitions: `.env`, `.env.*`, `docker-compose*.yml`, `*.yaml` in `.github/`
or `.gitlab-ci.yml`, plus docs matching `\$\{?[A-Z_]{3,}\}?` in *.md
## 2. Input/Output Data Contracts
Input: a project root directory.
Output: `env-sleuth-report.json` and a human-readable `ENV_SLEUTH.md`:
```json
{ "referenced": 42, "defined": 30, "missing": [ "DATABASE_URL" ], "orphaned": [ "OLD_API_KEY" ], "caseInstability": [ "PGHOST", "pgHost" ] }
```
Exit code: `0` = all referenced-envs defined, `1` = gaps.
## 3. Production Reference Implementation
```js
// env-config-sleuth.js
const fs = require('fs');
const path = require('path');
const ROOT = process.argv[2] || '.';
const CODE = /\b(?:process\.env waitFor\.([A-Za-z_][A-Za-z0-9_]*)|env\.([A-Za-z_][A-Za-z0-9_]*))\b|[({,]?\s*["']([A-Z][A-Z0-9_]{2,})["']\s*[):,}]?/g;
const DEF = /\{?\$?\{?\s*([A-Za-z_][A-Za-z0-9_]*)\s*\}?\}?/g;
const SKIP_DIRS = ['node_modules', '.git', 'dist', 'build', '.next', 'coverage', 'vendor'];
function walk(dir,