env-vars

Manages Vercel environment variables, .env files, and OIDC token lifecycle.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/ridhijain709/AIPORSCHE --skill env-vars-ridhijain709
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: env-vars
Source: https://github.com/ridhijain709/AIPORSCHE/tree/main/.agents/skills/env-vars
Command: npx skills add https://github.com/ridhijain709/AIPORSCHE --skill env-vars-ridhijain709

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing environment variables across local development, preview, and production environments is error-prone: secrets get committed to git, vercel env pull silently overwrites custom variables, and local OIDC tokens expire mid-session causing confusing auth failures. This Skill provides expert guidance on the full Vercel environment variable workflow. ## Core Features & Use Cases - .env File Hierarchy: Explains the Next.js load order across .env, .env.local, and environment-specific variants, including which files are git-tracked and which hold secrets. - vercel env CLI Operations: Covers pulling, adding, listing, and removing variables with environment scoping, sensitive flags, and git-branch overrides. - OIDC Token Lifecycle: Documents how VERCEL_OIDC_TOKEN works on Vercel versus locally, with a troubleshooting table for common auth errors. - Use Case: After cloning a project on a new machine, run vercel link followed by vercel env pull .env.local --yes, then verify all keys from .env.example exist before starting development. ## Quick Start Pull the Vercel environment variables for this project into .env.local and verify that every key listed in .env.example is present.

Frequently Asked Questions about env-vars

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I pull Vercel environment variables locally?

Run `vercel env pull .env.local` after linking your project with `vercel link`. Add `--environment=production` or `--environment=preview` to target a specific environment, and `--yes` to overwrite an existing file without prompting.

What is the .env file load order in Next.js?

Next.js loads `.env` first, then `.env.[environment]`, then `.env.local` (skipped in test), and finally `.env.[environment].local` with highest priority. Later files override earlier ones, and `.local` variants are gitignored for secrets.

Why does vercel env pull delete my custom variables?

The `vercel env pull` command replaces the entire target file, discarding any manually added variables. Back up custom vars before pulling and re-append them, or keep them in `.env.development.local` which loads after `.env.local`.

Why do I get OIDC auth errors after hours of local development?

The local `VERCEL_OIDC_TOKEN` provisioned by `vercel env pull` expires after roughly 12 hours. Re-run `vercel env pull .env.local --yes` to obtain a fresh token, ideally at the start of each dev session.

Can I use secrets in NEXT_PUBLIC_ environment variables?

No. Variables prefixed with `NEXT_PUBLIC_` are embedded in the browser bundle and publicly visible. Keep secrets in server-only variables without the prefix, or store them in the Vercel Dashboard with environment scoping.

How do I run scripts with Vercel env vars without writing .env.local?

Use `vercel env run -- npm run dev` to execute a command with Vercel environment variables injected without writing any file. For standalone scripts like drizzle-kit, load `.env.local` explicitly with dotenv-cli since only Next.js auto-loads it.