| name | env |
| description | Set up, validate, and manage environment variables. |
/env
Set up, validate, and manage environment variables.
Usage
/env [action] [--check] [--generate] [--sync]
Arguments
action: check, generate, sync, add, remove (default: check)
--check: Validate all required vars are set
--generate: Create .env from .env.example
--sync: Sync .env.example with actual usage in code
Instructions
When this skill is invoked:
Agent Behavior
Autonomy:
- Complete environment setup end-to-end
- Detect missing variables before runtime failures
- Never expose secret values in output
Safety:
- Never commit
.env files
- Never log or display secret values
- Always use placeholder values in
.env.example
Actions
Check (/env check)
Validate environment is properly configured:
- Read
.env.example to get required variables
- Check
.env exists — if not, offer to generate
- Verify each variable is set:
diff <(grep -oP '^[A-Z_]+' .env.example | sort) <(grep -oP '^[A-Z_]+' .env | sort)
- Validate formats where possible:
- URLs: valid format, reachable
- Ports: numeric, valid range
- API keys: correct prefix/length patterns
- Report results
Generate (/env generate)
Create .env from template:
- Copy
.env.example to .env:
cp .env.example .env
- Prompt for values that need customization
- Verify
.env is in .gitignore:
grep -q "^\.env$" .gitignore || echo ".env" >> .gitignore
Sync (/env sync)
Ensure .env.example matches actual usage:
- Scan codebase for environment variable references:
grep -rn "process\.env\.\|os\.environ\|os\.getenv\|env\(" src/ --include="*.{ts,tsx,py,go}"
- Compare against
.env.example
- Report discrepancies:
- Variables used in code but missing from
.env.example
- Variables in
.env.example but unused in code
- Update
.env.example with missing entries (placeholder values only)
Add (/env add <VAR_NAME>)
Add a new environment variable:
- Add to
.env.example with placeholder and comment
- Add to
.env (prompt for actual value)
- Add validation in config module if one exists
- Update
prd/00_technology.md environment variables table
Remove (/env remove <VAR_NAME>)
Remove an environment variable:
- Check for usage in codebase
- Warn if still referenced
- Remove from
.env.example
- Remove from config validation if applicable
Environment Report Format
## Environment Check Report
**Status:** PASS / FAIL
**File:** .env (exists / missing)
**Gitignored:** Yes / No
### Variables
| Variable | Status | Format |
|----------|--------|--------|
| DATABASE_URL | Set | Valid URL |
| API_KEY | Set | Valid prefix |
| LOG_LEVEL | Missing | — |
| PORT | Set | Valid (3000) |
### Issues
- LOG_LEVEL: Not set (default: INFO)
- SECRET_KEY: In .env.example but not used in code
### Recommendations
1. Set LOG_LEVEL in .env
2. Remove unused SECRET_KEY from .env.example
Example Output
$ /env check
Checking environment configuration...
.env file: Found
.gitignore: .env is excluded
Variable Check:
DATABASE_URL ......... Set (valid PostgreSQL URL)
LOG_LEVEL ............ Set (INFO)
ENVIRONMENT .......... Set (development)
API_KEY .............. MISSING
JWT_SECRET ........... Set (32 chars)
Issues Found:
API_KEY is required but not set in .env
Copy from your provider dashboard and add to .env
Status: 1 issue found — fix before running the app.