env-vars
This skill guides agents through Vercel environment variable management, including .env file hierarchy, the vercel env CLI commands for…
Identity proven by GitHub's verified organisation badge (vercel, vercel-labs)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode
- License
- Apache-2.0 (permissive)
- Pin
- 2a1e58dpinned Oct 9, 2026
- Context cost
- about 2,700 tokenswhen the skill loads
- GitHub stars
- 300on vercel/vercel-plugin
- Scripts
- None found
What it does
“Vercel environment variable expert guidance. Use when working with .env files, vercel env commands, Secret or Config variable types, OIDC tokens, or managing environment-specific configuration.”
Generated summary from the skill's own text
This skill guides agents through Vercel environment variable management, including .env file hierarchy, the vercel env CLI commands for adding/pulling/removing variables, OIDC token provisioning for local development, and environment-specific configuration across production, preview, and development scopes.
When to use it
- Setting up .env files and bootstrapping fresh clones with vercel env pull
- Managing secrets and config variables via vercel env add and update commands
- Troubleshooting OIDC token expiry and authentication failures in local development
- Configuring environment-specific values across production, preview, and development
When not to
- Working with CI/CD systems outside Vercel's ecosystem
- Managing environment variables for non-Vercel hosted applications
- Handling secrets without access to Vercel Dashboard or CLI
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add vercel/vercel-plugin --skill env-varsInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install vercel/vercel-plugin env-vars@2a1e58dfb63c064c2589c0c21b3e93c53728f8d5Installs the commit we checked (2a1e58d).
Copy by hand
Download the folder at 2a1e58d and put it in .claude/skills/env-vars for Claude Code and in .agents/skills/env-vars for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install vercel@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "env-vars" by Vercel. Source, pinned to commit 2a1e58dfb63c064c2589c0c21b3e93c53728f8d5: https://github.com/vercel/vercel-plugin/tree/2a1e58dfb63c064c2589c0c21b3e93c53728f8d5/skills/env-vars 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/env-vars/ for Claude Code and .agents/skills/env-vars/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/vercel/env-vars
SKILL.md at the pin
---
name: env-vars
description: Vercel environment variable expert guidance. Use when working with .env files, vercel env commands, Secret or Config variable types, OIDC tokens, or managing environment-specific configuration.
metadata:
priority: 7
docs:
- "https://vercel.com/docs/environment-variables"
- "https://vercel.com/docs/environment-variables/sensitive-environment-variables"
sitemap: "https://vercel.com/sitemap.xml"
pathPatterns:
- '.env'
- '.env.*'
- '.env.local'
- '.env.production'
- '.env.development'
- '.env.test'
- '.env.production.local'
- '.env.development.local'
- '.env.test.local'
- '.env.example'
bashPatterns:
- '\bvercel\s+env\s+pull\b'
- '\bvercel\s+env\s+add\b'
- '\bvercel\s+env\s+rm\b'
- '\bvercel\s+env\s+ls\b'
- '\bvercel\s+env\s+update\b'
- '\bvercel\s+env\s+run\b'
chainTo:
-
pattern: '\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|GOOGLE_API_KEY)\b'
targetSkill: ai-gateway
message: 'Direct provider API key detected — loading AI Gateway guidance for OIDC auth (no manual keys needed on Vercel).'
retrieval:
aliases:
- environment variables
- env file
- secrets
- config vars
- secret env var
- sensitive env var
intents:
- set env var
- manage secrets
- pull env vars
- configure environment
entities:
- .env
- vercel env
- OIDC
- environment variable
---
# Vercel Environment Variables
You are an expert in Vercel environment variable management — `.env` file conventions, the `vercel env` CLI, OIDC token lifecycle, and environment-specific configuration.
## .env File Hierarchy
Vercel and Next.js load environment variables in a specific order. Later files override earlier ones:
| File | Purpose | Git-tracked? |
|------|---------|-------------|
| `.env` | Default values for all environments | Yes |
| `.env.local` | Local overrides and secrets | **No** (gitignored) |
| `.env.development` | Development-specific defaults | Yes |
| `.env.development.local` | Local dev overrides | **No** |
| `.env.production` | Production-specific defaults | Yes |
| `.env.production.local` | Local prod overrides | **No** |
| `.env.test` | Test-specific defaults | Yes |
| `.env.test.local` | Local test overrides | **No** |
### Load Order (Next.js)
1. `.env` (lowest priority)
2. `.env.[environment]` (development, production, or test)
3. `.env.local` (skipped in test environment)
4. `.env.[environment].local` (highest priority, skipped in test)
### Critical Rules
- **Never commit secrets** to `.env`, `.env.development`, or `.env.production` — use `.local` variants or Vercel environment variables
- `.env.local` is always gitignored by Next.js — this is where `vercel env pull` writes secrets
- Variables prefixed with `NEXT_PUBLIC_` are exposed to the browser bundle — never put secrets in `NEXT_PUBLIC_` vars
- All other variables are server-only (API routes, Server Components, middleware)
## vercel env CLI
### Pull Environment Variables
```bash
# Pull all env vars for the current environment into .env.local
vercel env pull .env.local
# Pull for a specific environment
vercel env pull .env.local --environment=production
vercel env pull .env.local --environment=preview
vercel env pull .env.local --environment=development
# Overwrite existing file without prompting
vercel env pull .env.local --yes
# Pull to a custom file
vercel env pull .env.production.local --environment=production
```
### Add Environment Variables
Every variable has a type:
| Type | After saving | Use for |
|------|--------------|---------|
| **Secret** | Hidden in the dashboard and `vercel env ls`; can be replaced, never read back. Production and Preview Secrets are not returned by `vercel env pull`. | Passwords, API keys, tokens, database URLs |
| **Config** | Readable by members with access | Non-sensitive values you need to read later |
Deployments receive both types at build time and runtime. Secret and Config replaced the Sensitive toggle; existing Sensitive variables are Secrets.
```bash
# Interactive — prompts for value, environments, and type
vercel env add MY_SECRET
# Non-interactive: read the value from a file so it never lands in shell
# history or process arguments (echo "value" | ... and --value do both)
vercel env add MY_SECRET production < ./secret.txt
# Add to production and preview in one command
vercel env add MY_SECRET production,preview < ./secret.txt
# Set the type explicitly
vercel env add MY_SECRET production --type secret < ./secret.txt
vercel env add SITE_REGION production --type config < ./region.txt
# Add development in its own command; development-only adds default to Config
vercel env add MY_SECRET development < ./dev-secret.txt
# Update an existing value
vercel env update MY_SECRET production < ./secret.txt
```
- **Defaults**: a non-interactive add to production, preview, or a custom environment is stored as Secret.
- **Public prefixes are always Config**: variables such as `NEXT_PUBLIC_*` or `VITE_*` are exposed to browsers, so the CLI refuses `--type secret` for them. Keep a private value under a name without the prefix.
- **Flags**: `--type config|secret` needs Vercel CLI 59.6 or later. Older CLIs use `--visibility`, now a deprecated alias of `--type`. `--sensitive` (Secret) and `--no-sensitive` (Config) still work in every version.
- **Team policy**: **Separate Production Secret Values** requires a Production Secret to differ from the Preview, Development, and custom environment values of the same key. Under it, create separate Production and non-Production values instead of adding one value to all targets. It replaces the deprecated **Enforce Sensitive Environment Variables** policy.
### List Environment Variables
```bash
# List all environment variables
vercel env ls
# Filter by environment
vercel env ls production
```
### Remove Environment Variables
```bash
# Remove from specific environment
vercel env rm MY_SECRET production
# Remove from all environments
vercel env rm MY_SECRET
```
## Bootstrap Flow (Fresh Clone / New Machine)
Use this sequence when setting up a project from scratch:
```bash
# 1) Link first so pulls target the correct Vercel project
vercel link --yes --project <name-or-id> --scope <team>
# 2) Pull env vars into .env.local
vercel env pull .env.local --yes
# 3) Verify required keys from .env.example exist in .env.local
while IFS='=' read -r key _; do
[[ -z "$key" || "$key" == \#* ]] && continue
grep -q "^${key}=" .env.local || echo "Missing in .env.local: $key"
done < .env.example
```
### Temporary Path: Run With Vercel Envs Without Writing a File
If you need Vercel environment variables immediately but do not want to write `.env.local` yet:
```bash
vercel env run -- npm run dev
```
This is useful for quick validation during bootstrap, but still pull `.env.local` for a normal local workflow.
### Re-pull After Secret or Provisioning Changes
After creating/updating secrets (`vercel env add`, dashboard changes) or provisioning integrations that add env vars (for example Neon/Upstash), re-run:
```bash
vercel env pull .env.local --yes
```
## OIDC Token Lifecycle
Vercel uses **OIDC (OpenID Connect)** tokens for secure, keyless authentication between your app and Vercel services (AI Gateway, storage, etc.).
### How It Works
1. **On Vercel deployments**: `VERCEL_OIDC_TOKEN` is automatically injected as a short-lived JWT and auto-refreshed — zero configuration needed
2. **Local development**: `vercel env pull .env.local` provisions a `VERCEL_OIDC_TOKEN` valid for ~12 hours
3. **Token expiry**: When the local OIDC token expires, re-run `vercel env pull .env.local --yes` to get a fresh one. Consider re-pulling at the start of each dev session to avoid mid-session auth failures
### Common OIDC Patterns
```ts
// The @vercel/oidc package reads VERCEL_OIDC_TOKEN automatically
import { getVercelOidcToken } from '@vercel/oidc'
// AI Gateway uses OIDC by default — no manual token handling needed
import { gateway } from 'ai'
const result = await generateText({
model: gateway('openai/gpt-5.2'),
prompt: 'Hello',
})
```
### Troubleshooting OIDC
| Symptom | Cause | Fix |
|---------|-------|-----|
| `VERCEL_OIDC_TOKEN` missing locally | Haven't pulled env vars | `vercel env pull .env.local` |
| Auth errors after ~12h locally | Token expired | `vercel env pull .env.local --yes` |
| Works on Vercel, fails locally | Token not in `.env.local` | `vercel env pull .env.local` |
| `AI_GATEWAY_API_KEY` vs OIDC | Both set, key takes priority | Remove `AI_GATEWAY_API_KEY` to use OIDC |
## Environment-Specific Configuration
### Vercel Dashboard vs .env Files
| Use Case | Where to Set |
|----------|-------------|
| Secrets (API keys, tokens) | Vercel Dashboard (`https://vercel.com/{team}/{project}/settings/environment-variables`) or `vercel env add`, as type Secret |
| Public config (site URL, feature flags) | `.env` or `.env.[environment]` files |
| Local-only overrides | `.env.local` |
| CI/CD secrets | Vercel Dashboard (`https://vercel.com/{team}/{project}/settings/environment-variables`) with environment scoping |
### Environment Scoping on Vercel
Variables set in the Vercel Dashboard at `https://vercel.com/{team}/{project}/settings/environment-variables` can be scoped to:
- **Production** — production domain deployments
- **Preview** — branch/PR deployments
- **Development** — `vercel dev` and `vercel env pull`
A variable can be assigned to one, two, or all three environments.
### Git Branch Overrides
Preview environment variables can be scoped to specific Git branches:
```bash
# Add a variable only for the "staging" branch
vercel env add DATABASE_URL preview --git-branch=staging < ./staging-database-url.txt
```
## Gotchas
### `vercel env pull` Overwrites Custom Variables
`vercel env pull .env.local` **replaces the entire file** — any manually added variables (custom secrets, local overrides, debug flags) are lost. Always back up or re-add custom vars after pulling:
```bash
# Save custom vars before pulling
grep -v '^#' .env.local | grep -v '^VERCEL_\|^POSTGRES_\|^NEXT_PUBLIC_' > .env.custom.bak
vercel env pull .env.local --yes
cat .env.custom.bak >> .env.local # Re-append custom vars
```
Or maintain custom vars in a separate `.env.development.local` file (loaded after `.env.local` by Next.js).
### Pulled Files Omit Production and Preview Secrets
`vercel env pull --environment=production` (or `preview`) does not write Secret values, so a pulled file cannot reproduce production credentials. Keep separate Development values for local work instead of trying to copy production Secrets onto a machine.
### Scripts Don't Auto-Load `.env.local`
Only Next.js auto-loads `.env.local`. Standalone scripts (`drizzle-kit`, `tsx`, custom Node scripts) need explicit loading:
```bash
# Use dotenv-cli
npm install -D dotenv-cli
npx dotenv -e .env.local -- npx drizzle-kit push
npx dotenv -e .env.local -- npx tsx scripts/seed.ts
# Or source manually
source <(grep -v '^#' .env.local | sed 's/^/export /') && node scripts/migrate.js
```
## Best Practices
1. **Use `vercel env pull` as part of your setup workflow** — document it in your README
2. **Never hardcode secrets** — always use environment variables
3. **Scope narrowly** — don't give preview deployments production database access
4. **Rotate OIDC tokens regularly in local dev** — re-pull when you see auth errors
5. **Use `.env.example`** — commit a template with empty values so teammates know which vars are needed
6. **Prefix client-side vars with `NEXT_PUBLIC_`** — and never put secrets in them
7. **Keep custom vars in `.env.development.local`** — protects them from `vercel env pull` overwrites
## Official Documentation
- [Environment Variables](https://vercel.com/docs/environment-variables)
- [Vercel CLI: env](https://vercel.com/docs/cli/env)
- [Secret and Config types](https://vercel.com/changelog/environment-variables-now-use-config-and-secret-types)
- [Next.js Environment Variables](https://nextjs.org/docs/app/guides/environment-variables)
From vercel/vercel-plugin at 2a1e58d, shown as plain text under its license: Apache-2.0 (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 2a1e58dFiles
- SKILL.md12 KB · 081d79b5b046
- .vercel.approvers19 B · 32c12a2a9e81
2 files, 12 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 2a1e58dMore from Vercel
next-bundle-optimizer
Audits Next.js applications to identify and reduce browser bundle size and initial-load work by analyzing routes, dependencies and client outputs.
Claude Code, Codex, Cursor +4 · about 2.3K tokens · pinned 6 days ago
next-cache-components-optimizer
Optimize Next.js routes to display meaningful UI instantly on initial load or client navigation by encoding the optimization goal as a failing…
Claude Code, Codex, Cursor +4 · about 5.6K tokens · pinned 6 days ago
next-partial-prefetching-adoption
Enables Partial Prefetching in Next.js 16.3+ apps and guides adoption through auditing Link prefetch behavior, preserving UI in tests or manually, and…
Claude Code, Codex, Cursor +4 · about 6.7K tokens · pinned 6 days ago
next-partial-prefetching-optimizer
This skill optimizes Next.js client-side navigation under Partial Prefetching by defining what UI loads before and after a click.
Claude Code, Codex, Cursor +4 · about 2.8K tokens · pinned 6 days ago
apple
This skill emulates Apple's OAuth and OIDC services for local development and testing.
Claude Code, Codex, Cursor +4 · about 1.9K tokens · pinned 6 days ago
aws
This skill emulates AWS cloud services locally, providing S3 bucket and object operations, SQS message queues, IAM user and role management, and STS assume…
Claude Code, Codex, Cursor +4 · about 2.8K tokens · pinned 6 days ago
Related in Cloud and DevOps
bootstrap
This skill orchestrates the setup process for Vercel-linked repositories by executing project linking, environment provisioning, database configuration, and…
by VercelOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.5K tokens · pinned 6 days ago
knowledge-update
Provides Vercel platform knowledge corrections for October 2026, including runtime deprecations, new products, and configuration changes.
by VercelOfficial publisher
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 6 days ago
runtime-cache
This skill provides guidance on Vercel's Runtime Cache API, an ephemeral per-region key-value store with tag-based invalidation for caching data across…
by VercelOfficial publisher
Claude Code, Codex, Cursor +3 · about 1.8K tokens · pinned 6 days ago
vercel-functions
Vercel Functions expert guidance for Node.js/Bun/Python/Rust serverless functions on Fluid Compute.
by VercelOfficial publisher
Claude Code, Codex, Cursor +3 · about 8.9K tokens · pinned 6 days ago
nextjs-on-cloudflare
This skill guides agents to build and deploy Next.js applications on Cloudflare Workers using vinext, a Vite-based reimplementation of Next.js.
by CloudflareOfficial publisher
Claude Code, Codex, Cursor +4 · about 560 tokens · pinned 6 days ago
vercel
This skill deploys and manages Vercel applications, handling deployments, aliases, logs, and monitoring.
by SentryOfficial publisher
Claude Code, Codex, Cursor +4 · about 610 tokens · pinned 6 days ago
Open roles at Vercel
5 of 11 open roles on the jobs board
- Software Engineer - Data Platform
Remote (United States) (Remote)
- Software Engineer, CDN
San Francisco, California, United States; New York City, New York, United States (Hybrid)
- Software Engineer, Trust & Safety
San Francisco, California, United States; New York City, New York, United States (Hybrid)
- Solutions Architect
San Francisco, New York City, Austin, United States (Hybrid)
- Software Engineer, Compute
London, UK (Hybrid)