/vercel:envfrom vercel
Manage Vercel environment variables. Commands include list, pull, add, remove, and diff. Use to sync environment variables between Vercel and your local development environment.
Ships in vercel. Installing the plugin adds it to Claude Code.
Manage environment variables for the current Vercel project with safety rails to prevent secret leakage.
🔒 Never-Echo-Secrets Rule: Environment variable values must never appear in command output, summaries, or conversation text. Only show variable names, environments, and metadata (created date, type). This rule applies to all subcommands.
vercel is on PATH.
npm i -g vercel (or pnpm add -g vercel / bun add -g vercel)..vercel/project.json in the current directory or nearest parent.
vercel link interactively, then re-run /env..env, .env.local, .env.production.local, .env.development.local in the project root. Note which exist for the diff subcommand.Based on "$ARGUMENTS", determine the action:
| Argument | Action | Destructive? |
|---|---|---|
list / ls / (none) | List env var names per environment | No |
pull | Download env vars to local .env.local | No (merges into local file; pulled values replace matching keys) |
add <NAME> | Add a new env var | Yes (if production) |
rm <NAME> / remove <NAME> | Remove an env var | Yes |
diff | Compare local vs Vercel key names | No |
For any operation that mutates production environment variables (add or rm targeting production):
⚠️ Production environment mutation requested. This will change environment variables on your live production deployment. Ask the user for explicit confirmation before proceeding. Do not mutate production env vars without a clear "yes."
# List all environment variables
vercel env ls
# Filter by environment
vercel env ls production
Present results as a table of variable names only grouped by environment. Never print values.
| Name | Production | Preview | Development |
|---|---|---|---|
| DATABASE_URL | ✓ | ✓ | ✓ |
| API_KEY | ✓ | ✓ | — |
# 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
After pulling, remind the user:
Ensure
.env*.localis in your.gitignoreto avoid committing secrets.
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.
# 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
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.--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.The CLI will prompt for the value interactively — do not pass the value as a CLI argument or echo it.
# Remove from specific environment
vercel env rm MY_SECRET production
# Remove from all environments
vercel env rm MY_SECRET
Confirm the target environment(s) with the user before executing.
Compare local environment file key names against Vercel-configured key names. Only compare names — never read or display values.
.env.local or .env — whichever exists):grep -v '^#' .env.local | grep '=' | cut -d'=' -f1 | sort
vercel env ls
Parse the output to extract variable names for the target environment (default: development).
## Env Diff — Local vs Vercel (development)
### In local but NOT on Vercel:
- EXTRA_LOCAL_VAR
- DEBUG_MODE
### On Vercel but NOT in local:
- ANALYTICS_KEY
- SENTRY_DSN
### In both:
- DATABASE_URL
- API_KEY
- NEXT_PUBLIC_APP_URL
If all keys match, report: "Local and Vercel environment keys are in sync."
| 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 |
Variables set in the Vercel Dashboard at https://vercel.com/{team}/{project}/settings/environment-variables can be scoped to:
vercel dev and vercel env pullA variable can be assigned to one, two, or all three environments.
Preview environment variables can be scoped to specific Git branches:
# Add a variable only for the "staging" branch
vercel env add DATABASE_URL preview --git-branch=staging < ./staging-database-url.txt
vercel env pull Merges Into an Existing Filevercel 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:
# 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).
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.
.env.localOnly Next.js auto-loads .env.local. Standalone scripts (drizzle-kit, tsx, custom Node scripts) need explicit loading:
# 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
After any mutation (add or rm), verify the change took effect:
vercel env ls
Re-list environment variables and confirm:
add: the new variable name appears in the expected environment(s).rm: the variable name no longer appears in the target environment(s).If verification fails (variable still present after remove, or missing after add), report the discrepancy and suggest retrying.
Present a structured result block:
## Env Result
- **Action**: list | pull | add | remove | diff
- **Status**: success | failed
- **Variable**: <NAME> (for add/remove)
- **Environments**: production, preview, development (as applicable)
- **Details**: <key outcome>
For diff, include counts:
- **Local only**: N keys
- **Vercel only**: N keys
- **Shared**: N keys
Based on the action performed:
/env pull to sync to local, or /env diff to compare local vs Vercel."/env diff to verify sync."/deploy to make the new variable available in your next deployment. For production, the variable is available immediately on the next request."/deploy."/env add <NAME>, or pull from Vercel with /env pull to sync."What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub fornida-dev/fornida-claude-plugins --plugin vercel4 commands in this plugin
/bootstrapVercel Project BootstrapBootstrap a repository with Vercel-linked resources by running preflight checks, provisioning integrations, verifying env keys, and then executing db/dev startup commands safely./deployDeploy to VercelDeploy the current project to Vercel. Pass "prod" or "production" as argument to deploy to production. Default is preview deployment./statusVercel Project Status (Doctor)Show the status of the current Vercel project — recent deployments, linked project info, and environment overview.Other plugins' commands for the same job