Vercel CLI Skill
This skill guides the agent through interacting with Vercel CLI to deploy projects, monitor deployment status, and retrieve logs (especially when a deployment fails).
Use this skill when
- The user requests Vercel-related tasks, such as:
- Deploying the project to preview or production environments.
- Retrieving logs for a deployment (either build logs or runtime request logs).
- Checking the status or details of recent deployments.
- Pulling environment variables from Vercel to local
.envfiles. - Linking the local project to a Vercel project.
Do not use this skill when
- The task does not involve Vercel hosting, deployment, or Vercel configurations.
Instructions
1. Linking and Pulling Environment Variables
- To link the local repository to a Vercel project or pull the latest cloud settings:
- Run
vercel linkto link the directory. - Run
vercel pullto sync settings and download environment variables:
(Usevercel pull --yes--yesor--non-interactiveflags where appropriate to skip prompts in the agent environment).
- Run
2. Checking Deployments and Status
- To list recent deployments and check their status (e.g.,
Ready,Error,Building):vercel ls - To inspect a specific deployment by URL or deployment ID:
vercel inspect <deployment-url-or-id>
3. Retrieving Logs for Failed Deployments (CRITICAL)
A. Build Failures (Error during deployment/build phase)
- If a preview or production deployment fails during the build phase (status is
Errorinvercel ls), fetch the build logs:vercel inspect <deployment-url-or-id> --logs - This prints the full build compilation logs, which is essential for diagnosing Next.js build errors, TypeScript errors, or missing dependencies.
B. Runtime Failures (Error during app execution)
- If the deployment succeeded (status is
Ready) but the application returns errors at runtime (e.g., 500 Internal Server Error):- Display recent runtime request/serverless logs:
vercel logs <deployment-url-or-id> - To retrieve only error logs:
vercel logs <deployment-url-or-id> --level error - To fetch logs with full details (expanded):
vercel logs <deployment-url-or-id> --expand - To filter logs by status code (e.g., 5xx):
vercel logs <deployment-url-or-id> --status-code 500
- Display recent runtime request/serverless logs:
4. Deploying the Project
- Always verify that local builds pass or check for lint errors before triggering a deployment.
- Preview Deployment:
vercel --yes - Production Deployment:
vercel --prod --yes - Always capture the deployment URL/ID returned by Vercel from the command output.
Security & Safety Guidelines
⚠️ Environmental Hygiene
- Never commit the
.verceldirectory or.env*.localfiles generated by the CLI. Verify they are included in.gitignore. - If environment variables change, remind the user to pull the latest variables locally using
vercel pull.