# audit-env-variables

audit-env-variables scans environment variables in a JS/TS codebase, flags unused ones, guesses the service behind each variable name, and maps where it's referenced in code.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 1357 repo stars
- Author: qdhenry
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/skills/audit-env-variables/SKILL.md
- Updated: 2026-03-01
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/audit-env-variables

## What it does

The skill reads `.env*` files in the project root and matches declared variables against their usage in code, covering `process.env.`, `import.meta.env.` and destructuring. It sorts results into variables that are used, unused, or referenced in code but missing from any `.env` file.

Based on naming patterns it identifies the likely service behind a variable, such as Stripe, AWS or Supabase, and assigns a rough access level, from low-risk public keys up to critical credentials with full account control. For every variable still in use, it lists the exact files and lines where it appears.

Run with `--cleanup`, the skill also checks for dynamic lookups like `process.env[variableName]`, `Object.keys(process.env)` or a spread over `process.env` before treating anything as dead code. It backs up the `.env` files, asks for confirmation through `AskUserQuestion`, then runs the build or tests and rolls back if something breaks. Variables defined in `.env.example` are left untouched, since that file doubles as documentation.

## Requirements
- Works with: Supabase, AWS, Stripe

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add qdhenry/Claude-Command-Suite --skill audit-env-variables -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/audit-env-variables/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/audit-env-variables/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add qdhenry/Claude-Command-Suite --skill audit-env-variables -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/audit-env-variables/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add qdhenry/Claude-Command-Suite --skill audit-env-variables -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/audit-env-variables/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install qdhenry/Claude-Command-Suite .claude/skills/audit-env-variables
```

2. **Manually: put the files in place**
- File: `.github/skills/audit-env-variables/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add qdhenry/Claude-Command-Suite --skill audit-env-variables -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/qdhenry/Claude-Command-Suite --path .claude/skills/audit-env-variables
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/audit-env-variables/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/skills/audit-env-variables/SKILL.md

## When to use it
- spot environment variables that are declared but never used
- identify which service a variable belongs to and how sensitive it is
- check whether every `.env` variable is documented in `.env.example`
- remove dead environment variables with a backup and automatic rollback
- map out where each environment variable is read in the codebase

## Example prompts
- Audit the environment variables in this project and write the report to ENV_AUDIT.md
- Run audit-env-variables with --cleanup and remove the unused variables
- Check which variables in .env are unused in the code and show the access level for each

## Similar
- [env-manager](https://affpapa.org/en/nevibecode/skills/env-manager.md) — skill · 358 installs
- [05-env-and-auth](https://affpapa.org/en/nevibecode/prompts/05-env-and-auth.md) — prompt · ★ 3444 repo stars
- [js-security-audit](https://affpapa.org/en/nevibecode/skills/js-security-audit.md) — skill · ★ 111 repo stars
- [env-setup-wizard](https://affpapa.org/en/nevibecode/skills/env-setup-wizard.md) — skill · 308 installs
- [supabase-audit-auth-config](https://affpapa.org/en/nevibecode/skills/supabase-audit-auth-config.md) — skill · 599 installs
- [supabase-audit-rpc](https://affpapa.org/en/nevibecode/skills/supabase-audit-rpc.md) — skill · 576 installs

From the same set: [qdhenry/claude-command-suite](https://affpapa.org/en/nevibecode/by/qdhenry/claude-command-suite.md) — 112 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
