vercel/vercel-plugin/env-vars
Claude Code and agent skill by vercel/vercel-plugin
- vendor
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install vercel/vercel-plugin/env-varsSKILL.md
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)
.env(lowest priority).env.[environment](development, production, or test).env.local(skipped in test environment).env.[environment].local(highest priority)
Critical Rules
- Never commit secrets to
.env,.env.development, or.env.production— use.localvariants or Vercel environment variables .env.localis always gitignored by Next.js — this is wherevercel env pullwrites secrets- Variables prefixed with
NEXT_PUBLIC_are exposed to the browser bundle — never put secrets inNEXT_PUBLIC_vars - All other variables are server-only (API routes, Server Components, middleware)
vercel env CLI
Pull Environment Variables
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.
- 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_*orVITE_*are exposed to browsers, so the CLI refuses--type secretfor them. Keep a private value under a name without the prefix. - Flags:
--type config|secretneeds 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
Remove Environment Variables
Bootstrap Flow (Fresh Clone / New Machine)
Use this sequence when setting up a project from scratch:
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:
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:
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
- On Vercel deployments:
VERCEL_OIDC_TOKENis automatically injected as a short-lived JWT and auto-refreshed — zero configuration needed - Local development:
vercel env pull .env.localprovisions aVERCEL_OIDC_TOKENvalid for ~12 hours - Token expiry: When the local OIDC token expires, re-run
vercel env pull .env.local --yesto get a fresh one. Consider re-pulling at the start of each dev session to avoid mid-session auth failures
Common OIDC Patterns
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 devandvercel 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:
Gotchas
vercel env pull Merges Into an Existing File
vercel env pull .env.local merges into an existing file. Variables defined only locally are kept (logged as Kept <KEYS>; Vercel CLI 56+). Keys that also exist on Vercel take the pulled value, so a local override of one is replaced. Current CLIs also keep a real local value for a Secret they cannot read, and always refresh VERCEL_OIDC_TOKEN. Older CLIs replace the entire file, so back up custom vars first:
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:
Best Practices
- Use `vercel env pull` as part of your setup workflow — document it in your README
- Never hardcode secrets — always use environment variables
- Scope narrowly — don't give preview deployments production database access
- Rotate OIDC tokens regularly in local dev — re-pull when you see auth errors
- Use `.env.example` — commit a template with empty values so teammates know which vars are needed
- Prefix client-side vars with `NEXT_PUBLIC_` — and never put secrets in them
- Keep custom vars in `.env.development.local` — protects them from
vercel env pulloverwrites
Official Documentation
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 17 Mar 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/env-vars/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 1
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/vercel/vercel-plugin/env-vars)