| name | vercel-deployment |
| description | Deep knowledge about deploying applications to Vercel (Next.js, static sites, edge functions). |
| type | transform |
| tier | library |
| domain | deploy |
| trigger | when deploying to Vercel |
Context
Deploying {{project_name}} ({{project_type}}) to Vercel.
You will follow a strict 6-phase Deployment Lifecycle Contract.
Instructions
Execute the following phases in order:
Phase 1: Authentication
- Ensure the
VERCEL_TOKEN environment variable is set.
- If running locally, you may authenticate interactively with
npx vercel login. However, for automated agents, ensure the token is provided.
- Validate by running
npx vercel whoami.
Phase 2: Build
- Prepare the artifacts for deployment.
- Typically, Vercel handles the build process on their servers based on
vercel.json or framework detection (like Next.js).
- If running a local preview or needing specific pre-build steps, execute your framework's build command (e.g.,
npm run build). Otherwise, this phase is implicitly handled by Vercel.
Phase 3: Install / Provisioning
- Ensure the target Vercel project exists.
- If
vercel.json is missing, you may need to configure project settings via the CLI (e.g., npx vercel link to link the directory to a Vercel project).
- Set any necessary environment variables (
npx vercel env add <NAME> <ENVIRONMENT>).
Phase 4: Deploy
- Ship the artifact to Vercel.
- For a preview deployment, run
npx vercel --token $VERCEL_TOKEN.
- For a production deployment, run
npx vercel --prod --token $VERCEL_TOKEN.
Phase 5: Checking
- Verify the deployment was successful.
- Vercel outputs the deployment URL upon success.
- Use
curl -sSf <URL> to ensure the application returns a 200 OK status code.
- Check Vercel logs (
npx vercel logs <URL>) if the deployment fails or the health check returns an error.
Phase 6: Update / Rollback
- If Phase 5 fails, immediately initiate a rollback.
- Use
npx vercel rollback <DEPLOYMENT_ID> or revert the git commit and trigger a new Vercel deployment.
- Note the failure in the progress log.
Validation