environment-variables

Manage and validate environment variables using t3-env with Zod. Consult this skill whenever adding, modifying, or referencing environment variables, working with .env or .env.local files, configuring t3-env schemas, dealing with VITE_ prefixed variables, or separating client vs. server variables.

16 stars

Best use case

environment-variables is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Manage and validate environment variables using t3-env with Zod. Consult this skill whenever adding, modifying, or referencing environment variables, working with .env or .env.local files, configuring t3-env schemas, dealing with VITE_ prefixed variables, or separating client vs. server variables.

Teams using environment-variables should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/environment-variables/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/tools/environment-variables/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/environment-variables/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How environment-variables Compares

Feature / Agentenvironment-variablesStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Manage and validate environment variables using t3-env with Zod. Consult this skill whenever adding, modifying, or referencing environment variables, working with .env or .env.local files, configuring t3-env schemas, dealing with VITE_ prefixed variables, or separating client vs. server variables.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Environment Variables

Patterns for managing and validating environment variables using t3-env with Zod.

Configuration file: `src/lib/env.ts`

## Variable Types

### Client Variables (`VITE_` prefix)

Variables the browser can read. Must have `VITE_` prefix to be exposed to client code.

- Public API endpoints
- Public keys (Stripe publishable key, analytics ID)
- Feature flags for UI

### Server Variables (no prefix)

Variables only available on the server. Never exposed to the browser.

- API secrets and private keys
- Database connection strings
- Internal service URLs

### Shared Variables

Values derived from the build environment, available in both contexts.

- `DEV` - Whether running in development mode
- `NODE_ENV` - Current environment

## Vite Exposure Rules

Vite only exposes variables prefixed with `VITE_` to client code via `import.meta.env`. Variables without this prefix are only available server-side.

| Prefix | Client | Server | Example |
|--------|--------|--------|---------|
| `VITE_*` | Yes | Yes | `VITE_API_URL` |
| No prefix | No | Yes | `DATABASE_URL` |

## Usage

```ts
import { env } from "@/lib/env";

console.log("Is dev?", env.DEV);
```

## Environment Files

The project uses two environment files with different purposes:

| File | Purpose | Git |
|------|---------|-----|
| `.env` | Development defaults (local URLs, non-sensitive config) | Committed |
| `.env.local` | Secrets, API keys, overrides | Ignored |

**Load order (highest priority first):**
1. `.env.local` - Overrides, secrets (never committed)
2. `.env` - Development defaults (committed)

This pattern allows:
- Easy onboarding - clone and run with sensible defaults
- Secrets stay out of git
- Production values set in deployment environment

## Adding New Variables

1. Add to `src/lib/env.ts` with Zod validation in appropriate section (`client`, `server`, or `shared`)
2. If it's a sensible development default (local URL, etc.): add to `.env`
3. If it's a secret or API key: add to `.env.local`
4. Configure in deployment environment
5. Add a test in the co-located test file (`src/lib/env.test.ts`) verifying the validation accepts correct values and rejects invalid ones.

## Quick Reference

| Task | Action |
|------|--------|
| Access env var | `import { env } from "@/lib/env"` |
| Client variable | Add to `client` with `VITE_` prefix |
| Server variable | Add to `server` (no prefix, never exposed to browser) |
| Shared variable | Add to `shared` (build-time values) |
| Validation | Use Zod schemas (`z.string()`, `z.boolean()`, etc.) |

Related Skills

environment-setup-guide

16
from diegosouzapw/awesome-omni-skill

Guide developers through setting up development environments with proper tools, dependencies, and configurations

alfworld-environment-scanner

16
from diegosouzapw/awesome-omni-skill

Performs an initial scan of the Alfworld environment to identify all visible objects and receptacles. Processes raw observation text into a structured list of entities to build a mental map for planning.

prd-v06-environment-setup

16
from diegosouzapw/awesome-omni-skill

Document development environment requirements for team consistency and AI agent understanding during PRD v0.6 Architecture. Triggers on requests to define environment setup, document tooling, create dev setup guide, or when user asks "what tools do I need?", "environment setup", "dev environment", "CLI requirements", "project setup", "onboarding setup". Consumes TECH- (stack selections), ARC- (architecture decisions). Outputs ENV- entries for development, CI/CD, and infrastructure environments. Feeds v0.7 Build Execution.

docker-test-environments

16
from diegosouzapw/awesome-omni-skill

Docker-based test environment management for isolated, reproducible test execution. Create Docker Compose environments, manage test containers, configure service dependencies, and integrate with CI/CD pipelines.

security-environment-standards

16
from diegosouzapw/awesome-omni-skill

Security and environment configuration standards for web applications, including environment variable management, secure coding practices, and production deployment security. Use when setting up environments, configuring security, or deploying applications.

python-setup-dev-environment

16
from diegosouzapw/awesome-omni-skill

Set up and run a reproducible Python dev environment with uv, ruff, mypy, and VSCode.

Advanced Effect Di Environment

16
from diegosouzapw/awesome-omni-skill

Model dependencies using Effect-style Context, Layer, and Service patterns with compile-time safety. Use when designing DI systems, modeling environments, or building Effect-TS applications.

virtual-environment-usage

16
from diegosouzapw/awesome-omni-skill

Mandates the use of virtual environments for isolating project dependencies and ensuring reproducibility.

bgo

16
from diegosouzapw/awesome-omni-skill

Automated Blender build-go workflow. Automatically builds, removes old version, installs, enables, and launches Blender with your extension/add-on. Use when you want to quickly test changes, execute complete build-to-launch cycle, or run custom packaging scripts with automatic Blender launch.

Coding & Development

github-search

16
from diegosouzapw/awesome-omni-skill

Search GitHub for repos, code, and usage examples using gh CLI. Capabilities: repo discovery, code search, finding library usage patterns, issue/PR search. Actions: search, find, discover repos/code/examples. Keywords: gh, github, search repos, search code, find examples, how to use library, stars, language filter. Use when: finding repositories, searching code patterns, discovering how libraries are used, exploring open source.

github-repo-skill

16
from diegosouzapw/awesome-omni-skill

Guide for creating new GitHub repos and best practice for existing GitHub repos, applicable to both code and non-code projects

github-repo-analysis

16
from diegosouzapw/awesome-omni-skill

Analyze GitHub repositories to extract insights about commit frequency, outstanding contributors, release timeline, and project health metrics. Use when users request repository analysis, commit history investigation, contributor identification, release tracking, or development activity assessment for any GitHub project.