vercel-cli-with-tokens
Deploys and manages Vercel projects via the Vercel CLI using access tokens for non-interactive authentication, enabling automated deployments and project setup without manual login.
How to Install
git clone --depth 1 https://github.com/sickn33/antigravity-awesome-skills.git && cp antigravity-awesome-skills/plugins/antigravity-awesome-skills-claude/skills/vercel-cli-with-tokens ~/.claude/skills/vercel-cli-with-tokens -rVercel CLI with Tokens
Deploy and manage projects on Vercel using the CLI with token-based authentication, without relying on vercel login.
When to Use
- Use this skill when the task matches this description: Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Step 1: Locate the Vercel Token
Before running any Vercel CLI commands, identify where the token is coming from. Work through these scenarios in order:
A) VERCEL_TOKEN is already set in the environment
[ -n "${VERCEL_TOKEN:-}" ] && printf 'VERCEL_TOKEN is set\n'
If this reports a configured token, you're ready. Skip to Step 2.
B) Token is in a .env file under VERCEL_TOKEN
grep -q '^VERCEL_TOKEN=' .env 2>/dev/null && printf 'VERCEL_TOKEN is present in .env\n'
If found, export it:
VERCEL_TOKEN="$(sed -n 's/^VERCEL_TOKEN=//p' .env | tail -n 1)"
export VERCEL_TOKEN
C) Token is in a .env file under a different name
Look for any variable that looks like a Vercel token (Vercel tokens typically start with vca_):
grep -Eio '^[A-Z0-9_]*VERCEL[A-Z0-9_]*(?==)' .env 2>/dev/null
Inspect the output to identify which variable holds the token, then export it as VERCEL_TOKEN:
vercel_var="<VARIABLE_NAME>"
VERCEL_TOKEN="$(sed -n "s/^${vercel_var}=//p" .env | tail -n 1)"
export VERCEL_TOKEN
D) No token found — ask the user
If none of the above yield a token, ask the user to provide one. They can create a Vercel access token at vercel.com/account/tokens.
Important: Once VERCEL_TOKEN is exported as an environment variable, the Vercel CLI reads it natively — do not pass it as a --token flag. Putting secrets in command-line arguments exposes them in shell history and process listings.
# Bad — token visible in shell history and process listings
vercel deploy --token "vca_abc123"
# Good — CLI reads VERCEL_TOKEN from the environment
[ -n "${VERCEL_TOKEN:-}" ] || { echo "Set VERCEL_TOKEN first" >&2; exit 1; }
vercel deploy
Step 2: Locate the Project and Team
Similarly, check for the project ID and team scope. These let the CLI target the right project without needing vercel link.
# Check environment
[ -n "${VERCEL_PROJECT_ID:-}" ] && printf 'VERCEL_PROJECT_ID is set\n'
[ -n "${VERCEL_ORG_ID:-}" ] && printf 'VERCEL_ORG_ID is set\n'
# Or check .env
grep -Eio '^[A-Z0-9_]*VERCEL[A-Z0-9_]*(?==)' .env 2>/dev/null
If you have a project URL (e.g. https://vercel.com/my-team/my-project), extract the team slug:
# e.g. "my-team" from "https://vercel.com/my-team/my-project"
echo "$PROJECT_URL" | sed 's|https://vercel.com/||' | cut -d/ -f1
If you have both VERCEL_ORG_ID and VERCEL_PROJECT_ID in your environment, export them — the CLI will use these automatically and skip any .vercel/ directory:
export VERCEL_ORG_ID="<org-id>"
export VERCEL_PROJECT_ID="<project-id>"
Note: VERCEL_ORG_ID and VERCEL_PROJECT_ID must be set together — setting only one causes an error.
CLI Setup
Ensure the Vercel CLI is installed and up to date:
npm install -g vercel
vercel --version
Deploying a Project
Always deploy as preview unless the user explicitly requests production. Choose a method based on what you have available.
Quick Deploy (have project ID — no linking needed)
When VERCEL_TOKEN and VERCEL_PROJECT_ID are set in the environment, deploy directly:
vercel deploy -y --no-wait
With a team scope (either via VERCEL_ORG_ID or --scope):
vercel deploy --scope <team-slug> -y --no-wait
Production (only when explicitly requested):
vercel deploy --prod --scope <team-slug> -y --no-wait
Check status:
vercel inspect <deployment-url>
Full Deploy Flow (no project ID — need to link)
Use this when you have a token and team but no pre-existing project ID.
Check project state first
# Does the project have a git remote?
git remote get-url origin 2>/dev/null
# Is it already linked to a Vercel project?
cat .vercel/project.json 2>/dev/null || cat .vercel/repo.json 2>/dev/null
Link the project
With git remote (preferred):
vercel link --repo --scope <team-slug> -y
Reads the git remote and connects to the matching Vercel project. Creates .vercel/repo.json. More reliable than plain vercel link, which matches by directory name.
Without git remote:
vercel link --scope <team-slug> -y
Creates .vercel/project.json.
Link to a specific project by name:
vercel link --project <project-name> --scope <team-slug> -y
If the project is already linked, check orgId in .vercel/project.json or .vercel/repo.json to verify it matches the intended team.
Deploy
Details
| Category | DevOps → cicd |
| Source | sickn33/antigravity-awesome-skills |
| SKILL.md | View on GitHub → |
| Repo Stars | ★ 41.5K |
| Est. per Skill | 47 (shared across 868 skills from this repo) |
| Difficulty | Intermediate |
| Risk Level | Safe |
Related Skills
Works Well With
Skills from the same repository — often designed to work together