# Env Check

> Validate environment configuration and check required variables are set. Use when setting up projects, debugging configuration issues, or verifying deployment readiness.

- Skill: `allanninal/env-check` (Agent Skill)
- Install (CLI): `npx skillmds@latest add allanninal/env-check`
- Raw SKILL.md: https://api.skillmd.com/api/skills/allanninal/env-check/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: allanninal (https://skillmd.com/u/allanninal)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/allanninal/env-check

---


# Environment Configuration Checker

Validate environment files and ensure all required variables are properly configured.

## Arguments
- `$ARGUMENTS`: Environment name - `local`, `development`, `staging`, `production` (optional - defaults to local)

## Environment File Patterns

| Pattern | Priority | Usage |
|---------|----------|-------|
| `.env.local` | Highest | Local overrides (never committed) |
| `.env.development` | High | Development environment |
| `.env.staging` | Medium | Staging environment |
| `.env.production` | Medium | Production environment |
| `.env` | Low | Default/fallback values |
| `.env.example` | Reference | Template with all variables |

## Checks Performed

### 1. File Existence

```bash
# Check which env files exist
ls -la .env* 2>/dev/null

# Check for .env.example (required for documentation)
if [ ! -f ".env.example" ]; then
    echo "WARNING: No .env.example file found"
fi
```

### 2. Required Variables

**Common Required Variables:**

| Variable | Projects | Purpose |
|----------|----------|---------|
| `DATABASE_URL` | PostgreSQL projects | Database connection |
| `MONGODB_URI` | MongoDB projects | MongoDB connection |
| `JWT_SECRET` | All backends | Token signing |
| `AUTH0_*` | Auth0 projects | Authentication |
| `NEXT_PUBLIC_API_URL` | Next.js | API endpoint |
| `PORT` | All backends | Server port |

**Project-Specific Variables:**

| Project | Required Variables |
|---------|-------------------|
| eruditiontx-services-mvp | `MONGODB_URI`, `JWT_SECRET_KEY`, `JWT_ALGORITHM`, `JWT_ACCESS_TOKEN_EXPIRE_MINUTES` |
| mathmatterstx-services | `MONGODB_URI`, `JWT_SECRET_KEY`, `MINIO_*` (for storage) |
| notaryo.ph | `DATABASE_URL`, `NEXTAUTH_SECRET`, `NEXTAUTH_URL` |
| bocs-turbo | Per-app configuration |

### 3. Variable Format Validation

```bash
# Check for empty values
grep -E "^[A-Z_]+=\s*$" .env

# Check for placeholder values
grep -E "(your_|changeme|TODO|FIXME|xxx)" .env

# Check URL format
grep -E "^.*_URL=" .env | while read line; do
    value=$(echo $line | cut -d'=' -f2)
    if [[ ! $value =~ ^https?:// ]]; then
        echo "WARNING: Invalid URL format: $line"
    fi
done
```

### 4. Security Checks

```bash
# Check if secrets are not placeholder values
grep -E "(SECRET|KEY|PASSWORD)" .env | while read line; do
    value=$(echo $line | cut -d'=' -f2)
    if [[ ${#value} -lt 16 ]]; then
        echo "WARNING: Secret appears too short: $(echo $line | cut -d'=' -f1)"
    fi
done

# Check .gitignore includes .env files
grep -q "\.env" .gitignore || echo "WARNING: .env not in .gitignore"
```

### 5. Compare with Example

```bash
# Get variables from .env.example
example_vars=$(grep -E "^[A-Z_]+=" .env.example | cut -d'=' -f1 | sort)

# Get variables from current .env
current_vars=$(grep -E "^[A-Z_]+=" .env 2>/dev/null | cut -d'=' -f1 | sort)

# Find missing variables
comm -23 <(echo "$example_vars") <(echo "$current_vars")
```

## Output Format

```
Environment Check: [project-name]
Environment: [local/development/staging/production]

Files Found:
  .env.example     (reference)
  .env.local       (active)
  .env.development (available)

Required Variables:
  DATABASE_URL      SET
  JWT_SECRET        SET
  API_KEY           MISSING

Validation:
  Empty values:     0
  Placeholder values: 1 (API_KEY)
  Invalid URLs:     0

Security:
  Secrets length:   OK
  .gitignore:       OK

Missing from .env (found in .env.example):
  - STRIPE_SECRET_KEY
  - SENDGRID_API_KEY

Recommendations:
  1. Set API_KEY to a valid value
  2. Add STRIPE_SECRET_KEY to .env.local
```

## Auto-Setup Mode

Create .env from .env.example:

```bash
# Copy example to local
cp .env.example .env.local

# Prompt user to fill in required values
echo "Please update the following variables in .env.local:"
grep -E "^[A-Z_]+=(|your_|changeme)" .env.example | cut -d'=' -f1
```

## Environment-Specific Tips

### Local Development
- Use `.env.local` for personal settings
- Never commit `.env.local`

### CI/CD
- Set variables in GitHub Secrets or CI platform
- Use `.env.ci` or environment variables

### Production
- Never store production secrets in files
- Use secret management (AWS Secrets Manager, Vault, etc.)

