BACK TO DIRECTORY
commandintermediate

/deploy

A deployment command that handles the full deployment lifecycle. Validates environment variables, runs pre-deployment checks (lint, type-check, tests), builds the application, deploys to the configured platform, runs post-deployment health checks, and provides rollback instructions if something goes wrong. Supports Vercel and Cloudflare Pages.

567 STARS
7.9k DOWNLOADS
claude-templates
deployvercelcloudflareci-cdproduction

CONFIGURATION

markdown
1# /deploy Command
2
3## Description
4Deploy the application to production with safety checks.
5
6## Steps
7
8### 1. Pre-deployment Checks
9```bash
10# Ensure working directory is clean
11git status --porcelain | grep -q . && echo "ERROR: Uncommitted changes" && exit 1
12
13# Run quality checks
14pnpm run lint
15pnpm run type-check
16pnpm run test -- --run
17
18# Verify environment variables
19test -z "$VERCEL_TOKEN" && echo "ERROR: VERCEL_TOKEN not set" && exit 1
20```
21
22### 2. Build
23```bash
24pnpm run build
25```
26
27### 3. Deploy
28```bash
29# Vercel deployment
30vercel --prod --yes
31
32# Or Cloudflare Pages
33# npx wrangler pages deploy .next --project-name=my-app
34```
35
36### 4. Post-deployment
37```bash
38# Health check
39curl -f https://my-app.vercel.app/api/health || echo "WARN: Health check failed"
40
41# Notify team
42echo "Deployed successfully at $(date)"
43```
44
45### 5. Rollback (if needed)
46```bash
47# List recent deployments
48vercel ls --limit 5
49
50# Rollback to previous
51vercel rollback
52```
53
54## Usage
55Type `/deploy` in Claude Code to trigger the full deployment pipeline.
56Pass `--preview` for a preview deployment instead of production.