| name | env |
| description | Environment Management |
| lifecycle | experimental |
/env - Environment Management
Manage .env files, secrets, and environment configuration.
Usage
/env # Audit current env setup
/env --init # Create .env from .env.example
/env --check # Verify all required vars set
/env --rotate KEY # Rotate a secret
What This Skill Does
- Audit Setup - Check .env, .env.example, .gitignore
- Validate Config - Required vars present and valid
- Security Check - No secrets in code or git
- Generate Template - Create .env.example from code
- Document Vars - What each variable does
Environment File Structure
.env (local, never commit)
DATABASE_URL=postgresql://user:pass@localhost/db
API_KEY=sk-xxxxxxxxxxxx
SECRET_KEY=your-secret-key-here
DEBUG=true
LOG_LEVEL=debug
.env.example (commit this)
DATABASE_URL=postgresql://user:password@localhost/dbname
API_KEY=
SECRET_KEY=
DEBUG=false
LOG_LEVEL=info
.gitignore (required entries)
.env
.env.local
.env.*.local
*.pem
*.key
credentials.json
secrets/
Environment Audit Report
# Environment Audit: [Project]
## Files
| File | Status | Notes |
|------|--------|-------|
| .env | Exists | 12 variables |
| .env.example | Missing | Should create |
| .gitignore | OK | .env excluded |
## Variables
### Required (Missing)
| Variable | Used In | Purpose |
|----------|---------|---------|
| `API_KEY` | api.py:23 | External API auth |
### Required (Set)
| Variable | Status | Validated |
|----------|--------|-----------|
| `DATABASE_URL` | Set | Valid URL format |
| `SECRET_KEY` | Set | Sufficient length |
### Optional
| Variable | Default | Current |
|----------|---------|---------|
| `DEBUG` | false | true |
| `LOG_LEVEL` | info | debug |
## Security Issues
- [ ] `.env` in .gitignore
- [x] No secrets in source code
- [ ] No secrets in git history
## Recommendations
1. Create `.env.example` with all variables
2. Add `API_KEY` to .env
3. Run `git log -p | grep -i secret` to check history
Variable Discovery
import os
os.environ.get("VAR_NAME")
os.getenv("VAR_NAME")
std::env::var("VAR_NAME")
$VAR_NAME
${VAR_NAME}
Security Best Practices
- Never commit .env - Always in .gitignore
- Use .env.example - Document required vars without values
- Validate on startup - Fail fast if missing required vars
- Rotate secrets - Regular rotation schedule
- Use secret managers - For production (Vault, AWS Secrets, etc.)
- Audit git history - Check for accidentally committed secrets
Instructions for Claude
When /env is invoked:
- Find env files - .env, .env.example, .env.local
- Check .gitignore - Ensure .env excluded
- Discover variables - Grep for env var usage in code
- Categorize vars - Required vs optional, secrets vs config
- Validate values - Format checks (URLs, keys)
- Security scan - Check for secrets in code
- Generate .env.example - If missing
- Report findings - Audit with recommendations