env-validator

An environment-configuration checker for `.env` files, which store settings such as API keys, URLs, and database details outside the main code.

In plain words
What is it for?
Use it to compare `.env.example` with `.env`, check URLs, ports, booleans, security-related names, secrets in code, production debug settings, and SSL/TLS configuration.
Why use it?
It finds missing, undocumented, empty, badly formatted, or exposed settings and flags differences between development and production configurations.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/undeadlist/claude-code-agents/env-validator
Clone the repo
git clone --depth 1 https://github.com/undeadlist/claude-code-agents
Per session 20 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,219 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00020 $0.01219
Opus 5 $0.00010 $0.00609
Sonnet 5 $0.00004 $0.00244
Haiku 4.5 $0.00002 $0.00122

Measured 2d ago against content hash 75ebcea92aa4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

env-validator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/env-validator.md · 169 lines

How it starts

The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Environment Validator

Validate environment configuration for completeness and security. Output to .claude/audits/ENV_REPORT.md.

Check

Completeness

  • All vars in .env.example exist in .env
  • No undocumented vars in .env
  • Required vars have values (not empty)
  • URL vars are valid format

Security

  • No secrets in version control
  • No secrets in client-side code
  • API keys not exposed in logs
  • Sensitive vars properly named (contain SECRET, KEY, PASSWORD)

Environment Consistency

  • Dev vs prod config differences documented
  • No localhost URLs in production config
  • No debug flags in production
  • Proper SSL/TLS settings per environment

Format & Values

  • Boolean vars are true/false (not 1/0 or yes/no)
  • URL vars include protocol
  • Port vars are valid numbers
  • No trailing whitespace

Commands

# Compare .env.example vs .env
comm -23 <(grep -oE "^[A-Z_]+=" .env.example | sort) <(grep -oE "^[A-Z_]+=" .env | sort) 2>/dev/null

# Find undocumented vars
comm -13 <(grep -oE "^[A-Z_]+=" .env.example | sort) <(grep -oE "^[A-Z_]+=" .env | sort) 2>/dev/null

# Check for secrets in code
grep -rn "API_KEY\|SECRET\|PASSWORD\|TOKEN" src --include="*.ts" --include="*.tsx" | grep -v "process.env"

# Find empty vars
grep -E "^[A-Z_]+=\s*$" .env 2>/dev/null

# Check for localhost in supposedly prod vars
grep -i "localhost\|127.0.0.1" .env 2>/dev/null

# Find hardcoded secrets
grep -rn "sk_live\|pk_live\|ghp_\|gho_\|Bearer " src --include="*.ts"

Output

# Environment Report

## Status: [VALID / INVALID]

| Check | Status | Details |
|-------|--------|---------|
| Completeness | PASS/FAIL | X missing vars |
| Security | PASS/FAIL | X exposed secrets |
| Format | PASS/WARN | X format issues |

## Missing Variables

Variables in `.env.example` but not in `.env`:

| Variable | Required | Description |
|----------|----------|-------------|
| `DATABASE_URL` | Yes | PostgreSQL connection string |
| `STRIPE_SECRET_KEY` | Yes | Stripe API key |
| `SENDGRID_API_KEY` | No | Email service (optional) |

**Action:** Add these to your `.env` file

## Security Issues

### ENV-001: Secret Exposed in Code
**Severity:** Critical
**File:** `src/lib/stripe.ts:5`
**Issue:** Hardcoded API key
```typescript
const stripe = new Stripe('sk_live_xxx...'); // EXPOSED

Fix: Use process.env.STRIPE_SECRET_KEY

ENV-002: Secret in Client Bundle

Severity: Critical File: src/app/page.tsx:12 Issue: Server secret accessible to client

const apiKey = process.env.API_SECRET; // Not NEXT_PUBLIC_ but still exposed

Fix: Only access secrets in server components/API routes

ENV-003: .env Committed to Git

Severity: High File: .env Issue: Found .env in git history Fix:

  1. Add .env to .gitignore
  2. Rotate all exposed secrets
  3. Use git filter-branch to remove from history

Format Issues

ENV-004: Empty Required Variable

Variable: SMTP_PASSWORD= Issue: Variable defined but empty Fix: Set a value or remove if optional

ENV-005: Invalid URL Format

Variable: API_URL=api.example.com Issue: Missing protocol Fix: API_URL=https://api.example.com

ENV-006: Development Value in Production

Variable: DEBUG=true Issue: Debug mode should be off in production Fix: Set DEBUG=false for production

Undocumented Variables

Variables in .env but not in .env.example:

Variable Value (redacted) Action
LEGACY_API_KEY xxx... Add to .env.example or remove
TEST_MODE true Document purpose

Environment Template

Required .env.example format:

Read the full file on GitHub · 169 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 169 lines · 20 tokens per session scan A 75ebcea92aa4

Subscribe to this mod's changes

env-validator is an agent published in the GitHub repository undeadlist/claude-code-agents (147 stars, last pushed 2mo ago), licensed MIT. It adds 20 tokens to every session and 1,219 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens