Skip to content
Back to skills

Env Doctor

ASecurity

Diagnose .env file issues — missing variables, format errors,

  • 21 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 7, 2026
securitybashgitapisecurity

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 7, 2026

npx -y skills add modbender/skill-library-mcp --skill env-doctor --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Env Doctor?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Env Doctor
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/modbender-env-doctor/badge)](https://www.skillsdirectory.com/skills/modbender-env-doctor)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: env-doctor
description: Diagnose .env file issues — missing variables, format errors,
  security risks, and misconfigurations.
---


# Env Doctor

Diagnose and fix .env file issues.

## Instructions

1. **Read files**: Parse `.env` (and `.env.example` if exists)
2. **Detect issues**:

   | Severity | Issue | Example |
   |----------|-------|---------|
   | 🔴 Critical | Secret committed to git | `.env` not in `.gitignore` |
   | 🔴 Critical | Missing required vars | In `.env.example` but not `.env` |
   | 🟡 Warning | Duplicate keys | `DB_HOST` defined twice |
   | 🟡 Warning | Empty values | `API_KEY=` |
   | 🟡 Warning | Spaces around `=` | `DB_HOST = localhost` (won't parse correctly) |
   | 🔵 Info | Extra keys | In `.env` but not `.env.example` |
   | 🔵 Info | Quoted booleans | `DEBUG="true"` (should be `DEBUG=true`) |

3. **Validation checks**:
   - URLs missing protocol (`example.com` → `https://example.com`)
   - Port numbers out of range (0-65535)
   - Unquoted values with spaces
   - Trailing whitespace
   - BOM characters at file start

4. **Cross-reference**: If `.env.example` exists, report missing and extra keys

5. **Git safety check**:
   ```bash
   # Is .env in .gitignore?
   grep -q "^\.env$" .gitignore 2>/dev/null && echo "✅ Protected" || echo "🔴 NOT in .gitignore!"
   # Was .env ever committed?
   git log --all --diff-filter=A -- .env 2>/dev/null
   ```

6. **Report format**:
   ```
   🩺 Env Doctor — .env

   Found 3 issues:

   🔴 CRITICAL: .env not in .gitignore
      Fix: echo ".env" >> .gitignore

   🟡 WARNING: Duplicate key DB_HOST (lines 4, 12)
      Fix: Remove duplicate on line 12

   🔵 INFO: ANALYTICS_KEY in .env but not .env.example
      Fix: Add to .env.example (with empty value)
   ```

## Security

- **Never output actual secret values** — mask as `sk-****...abc`
- Check if `.env` is tracked by git — this is the #1 security risk
- Flag production credentials that appear to be in a development `.env`

## Edge Cases

- **No .env file**: Check cwd; suggest `cp .env.example .env`
- **Multi-line values**: Handle values spanning lines (quoted with `\n`)
- **Variable interpolation**: `${VAR}` references — check if referenced var exists

## Requirements

- No dependencies — text file analysis
- No API keys needed

Files in this skill

  • README.md667 B
  • SKILL.md2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in security →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.