vercel-cli
npx skills add https://github.com/skillrecordings/support --skill vercel-cli
Agent 安装分布
Skill 文档
Vercel CLI Skill
Deploy and manage Vercel projects via CLI. Org: skillrecordings.
â ï¸ CRITICAL: Environment Variable Newlines
NEVER use heredocs (<<<) or plain echo to pipe values to vercel env add.
These add trailing newlines that WILL break secrets silently:
# â BAD - adds newline
echo "secret" | vercel env add MY_VAR production
vercel env add MY_VAR production <<< "secret"
# â
GOOD - no newline
echo -n 'secret' | vercel env add MY_VAR production
Always use echo -n (no newline flag) when piping values.
Prerequisites
bun add -g vercel
vercel login
Project Setup (Monorepo)
This is a Turborepo. Each app deploys as a separate Vercel project.
Link all projects at once (preferred)
vercel link --repo
This links all apps to their Vercel projects using Git integration.
Link individual app
cd apps/web
vercel link --project support-web
First-time project creation
cd apps/web
vercel --yes
# Creates project, prompts for settings
Deployments
Preview deployment (PR/branch)
vercel
# or from root:
vercel --cwd apps/web
Production deployment
vercel --prod
# or from root:
vercel --cwd apps/web --prod
Deploy without waiting
vercel --no-wait
Force rebuild (skip cache)
vercel --force
Deploy with build logs
vercel --logs
Environment Variables
List env vars
vercel env ls
vercel env ls production
vercel env ls preview feature-branch
Add env var
# Interactive (prompts for value)
vercel env add MY_VAR
# With value piped (MUST use echo -n to avoid newline!)
echo -n 'secret-value' | vercel env add MY_VAR production
# Sensitive (hidden in dashboard)
vercel env add API_KEY --sensitive
Push from local .env to Vercel
To push all vars from a local .env file:
# Parse .env and push each var (excludes comments and empty lines)
while IFS='=' read -r key value; do
[[ -z "$key" || "$key" =~ ^# ]] && continue
echo -n "$value" | vercel env add "$key" production
done < .env.local
Or push specific vars:
# Read from .env.local and push to production
source .env.local
echo -n "$FRONT_API_TOKEN" | vercel env add FRONT_API_TOKEN production
echo -n "$INNGEST_SIGNING_KEY" | vercel env add INNGEST_SIGNING_KEY production
Pull env vars to local file
vercel env pull .env.local
vercel env pull --environment=preview .env.preview
Run command with env vars (no file)
vercel env run -- bun run dev
vercel env run -e production -- bun run build
Remove env var
vercel env rm MY_VAR production
Update existing env var
# Remove then add (no update command exists)
vercel env rm MY_VAR production -y
echo -n 'new-value' | vercel env add MY_VAR production
Project Management
List projects
vercel project ls
vercel project ls --json
Inspect project
vercel project inspect
vercel project inspect support-web
Remove project
vercel project rm support-web
Domains
List domains
vercel domains ls
Webhook URLs (no wildcards)
Use the exact Vercel app domain for webhooks. Wildcards are not supported by most providers.
# Find the exact production domain for the current project
vercel project inspect | rg -n "Domains|domain"
# Or list deployments and pick the latest
vercel ls
Add domain
vercel domains add example.com
Alias deployment to domain
vercel alias <deployment-url> my-custom-domain.com
Logs
View deployment logs
vercel logs <deployment-url>
vercel logs <deployment-url> --follow
CI/CD Usage
Use VERCEL_TOKEN env var or --token flag:
vercel --token $VERCEL_TOKEN --prod
Monorepo vercel.json
Each app should have its own vercel.json:
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"framework": "nextjs"
}
Root vercel.json for shared settings (optional):
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"ignoreCommand": "npx turbo-ignore"
}
Common Patterns
Deploy only if app changed (turbo-ignore)
bun add -D turbo-ignore
In app’s vercel.json:
{
"ignoreCommand": "npx turbo-ignore"
}
Capture deployment URL in CI
DEPLOY_URL=$(vercel --prod 2>&1)
echo "Deployed to: $DEPLOY_URL"
Promote preview to production
vercel promote <deployment-url>
Scope
Always deploy to skillrecordings org:
vercel --scope skillrecordings
Or set globally:
vercel switch skillrecordings
Troubleshooting
Clear local Vercel cache
rm -rf .vercel
vercel link
Check current link status
cat .vercel/project.json
Redeploy with fresh build
vercel --force --logs