| name | vercel-deploy |
| description | Vercel deployment management for frontend apps: CLI, env vars, config, troubleshooting, rollback. Use when this capability is needed. |
Vercel Deployment Skill
Skill Type: Deployment Management
For Agent: @deploy-owner
Platform: Vercel (Frontend Hosting)
Skill Purpose
This skill enables Vercel deployment management for React/Next.js frontends including project configuration, environment variables, domain management, and build optimization.
Core Capabilities
1. Vercel CLI Commands
Login & Project Setup:
vercel login
vercel link
vercel ls
Deployment:
vercel
vercel --prod
vercel ./frontend --prod
vercel ls
Environment Variables:
vercel env add [KEY]
vercel env ls
vercel env pull
vercel env rm [KEY]
Domain Management:
vercel domains ls
vercel domains add [domain]
vercel domains rm [domain]
Logs & Monitoring:
vercel logs [deployment-url]
vercel ls
vercel inspect [deployment-url]
2. Vercel Project Structure
Typical React Frontend:
- Framework: React + Vite (or Next.js)
- Build Command:
npm run build or yarn build
- Output Directory:
dist (Vite) or .next (Next.js)
- Install Command:
npm install or yarn install
Environment Variables to Configure:
VITE_API_URL - Backend API URL (Railway service)
VITE_ENVIRONMENT - development, staging, or production
VITE_ANTHROPIC_API_KEY - (if frontend calls Claude directly)
Vercel Environment Scopes:
Production - Main branch deployments
Preview - Feature branch deployments
Development - Local development
3. Deployment Workflow
Standard Deployment Process:
- Ensure code is pushed to git (Vercel auto-deploys from git)
- Verify environment variables are set for target environment
- Check Vercel dashboard for deployment status
- Monitor build logs for errors
- Verify deployment URL loads correctly
- Test critical frontend features
- Verify API calls to backend work (CORS check)
- Monitor for 10+ minutes post-deployment
Branch to Environment Mapping:
development branch → Preview deployment
staging branch → Staging/Preview deployment
main branch → Production deployment
Project Domain Defaults (fill in from codex/PROJECT_CONTEXT.md):
- Marketing site: {{MARKETING_URL}}
- App UI: {{APP_UI_URL}}
- Staging: {{STAGING_UI_URL}}
Domain Guardrails (project-specific):
- Document which domains map to which Vercel projects.
- Document DNS requirements (A/CNAME) and registrar details.
- Use
vercel domains inspect <domain> before changes.
Status Snapshot (optional):
- Add current assignment/alias notes here.
Known Build Pitfalls (Project-Specific)
- Add project-specific build pitfalls here.
4. Vercel Configuration Files
vercel.json (at project root):
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite",
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
],
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "X-Frame-Options",
"value": "DENY"
},
{
"key": "X-XSS-Protection",
"value": "1; mode=block"
}
]
}
]
}
vite.config.ts (for React + Vite):
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
build: {
outDir: 'dist',
sourcemap: true
},
server: {
port: 3000
}
})
5. Health Check Protocol
After Every Deployment:
vercel ls
curl https://[deployment-url]
Health Check Success Criteria:
- ✅ Deployment status shows "Ready"
- ✅ Homepage loads without errors
- ✅ No console errors in browser DevTools
- ✅ API calls to backend succeed (check Network tab)
- ✅ Assets load correctly (CSS, JS, images)
- ✅ Routing works (SPA routing via rewrites)
6. Troubleshooting Guide
Common Issues:
Issue: Build fails with "Module not found"
- Check:
package.json has all dependencies
- Check: No TypeScript errors
- Check: Import paths are correct (case-sensitive on Vercel)
- Solution: Fix imports, commit, Vercel auto-redeploys
Issue: "404 Not Found" on page refresh
- Check:
vercel.json has rewrite rules for SPA routing
- Solution: Add rewrite rule
"source": "/(.*)", "destination": "/index.html"
Issue: Environment variables not working
- Check: Variables are set in correct environment (Production/Preview)
- Check: Variable names use correct prefix (
VITE_ for Vite, NEXT_PUBLIC_ for Next.js)
- Check: Variables are exposed to browser (only
VITE_* or NEXT_PUBLIC_*)
- Solution: Update variables, trigger redeploy
Issue: CORS errors when calling backend
- Check: Backend
CORS_ORIGINS includes Vercel domain
- Check: Backend is deployed and running
- Check: API URL is correct in frontend env vars
- Solution: Update backend CORS config, redeploy backend
Issue: Build exceeds time limit
- Check: Build command is optimized
- Check: No unnecessary dependencies
- Solution: Optimize build, remove unused packages
Issue: Assets not loading (404 for CSS/JS)
- Check: Build output directory is correct (
dist vs .next)
- Check: Asset paths in HTML are relative, not absolute
- Solution: Update build config, fix asset paths
7. Rollback Procedure
If Deployment Fails:
- Check Vercel dashboard for failed deployment
- Review build logs
- If critical: Use Vercel instant rollback
- Or revert git commit and push
Vercel Instant Rollback:
vercel ls
vercel promote [previous-deployment-url] --prod
Git Rollback:
git revert [bad-commit-hash]
git push origin [branch-name]
Vercel-Specific Best Practices
- Use environment variables - Never hardcode API URLs or secrets
- Enable automatic deployments - Faster than manual CLI
- Use preview deployments - Test on every PR
- Set up custom domains - Professional URLs
- Monitor analytics - Vercel provides Core Web Vitals
- Optimize images - Use Vercel Image Optimization (if Next.js)
- Configure caching - Set appropriate cache headers
- Security headers - Add in
vercel.json
Integration with Other Tools
With Railway (Backend):
- Ensure frontend
VITE_API_URL points to Railway domain
- Backend must allow Vercel domain in CORS
- Keep frontend/backend deployments synchronized
With Git:
- Vercel watches git branches for changes
- Push to branch → Automatic deployment
- Preview deployments for every PR
With GitHub:
- Vercel GitHub integration provides:
- Deployment comments on PRs
- Preview URLs for every commit
- Build status checks
Vercel Dashboard Features
Key Sections:
- Deployments - View all deployments, logs, and status
- Environment Variables - Manage env vars per environment
- Domains - Configure custom domains and SSL
- Analytics - View Web Vitals and usage stats
- Settings - Project configuration and integrations
URLs:
- Dashboard: https://vercel.com/dashboard
- Project:
https://vercel.com/[team]/[project]
- Deployments:
https://vercel.com/[team]/[project]/deployments
Performance Optimization
Vercel Edge Network:
- Automatic global CDN
- Edge caching for static assets
- Brotli/Gzip compression
Build Optimization:
npm run build -- --analyze
Caching Strategy:
{
"headers": [
{
"source": "/assets/(.*)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
}
]
}
Success Metrics
Deployment is successful when:
- ✅ Vercel dashboard shows "Ready" status
- ✅ Deployment URL loads in browser
- ✅ No errors in browser console
- ✅ API calls to backend succeed
- ✅ Routing works correctly (SPA navigation)
- ✅ Core Web Vitals are green (LCP < 2.5s, FID < 100ms, CLS < 0.1)
- ✅ No 404 errors for assets
Quick Reference
Deploy to production:
vercel --prod
Check deployment status:
vercel ls
Update environment variable:
vercel env add VITE_API_URL
Instant rollback:
vercel ls
vercel promote [previous-url] --prod
Monitor logs:
vercel logs [deployment-url]
Environment-Specific Domains
Production:
Staging:
Preview (per-branch):
Last Updated: 2025-11-23
Maintained By: @deploy-owner
Related Skill: railway-deploy.md
Scripts
scripts/skill_info.py: Print skill name and description.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.