Skip to main content
skill CX Codex

vercel-deployment · curiositech — Claude Code skill for deploying Next.js to Vercel

vercel-deployment — a skill that handles Vercel deploys for Next.js and React apps: env vars, edge functions, build fixes, preview deployments. Not for AWS, GCP or Azure.

MIT 187 installs ★ 274 updated 2026-10-30

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add curiositech/some_claude_skills --skill vercel-deployment -a claude-code
Open on GitHub

What vercel-deployment does

The skill walks through a pre-deploy checklist: env vars in the Vercel dashboard, build command, output directory, Node.js version. It covers vercel.json with headers, redirects and rewrites, plus the TypeScript config via defineConfig from @vercel/config.

Edge functions get clear boundaries: auth, A/B tests and geo content work well; database connections and long-running jobs do not. There is a middleware example in src/middleware.ts and an API route with runtime = 'edge'.

For databases the skill points to Turso, Vercel Postgres, PlanetScale and Neon. SQLite runs only in /tmp on Vercel, so data does not survive between invocations. Preview deployments can have separate env vars, and PRs get a comment with the preview URL and build status.

What it helps with

  • set env vars for production and preview deployments
  • build vercel.json with headers and redirects
  • decide what belongs in edge functions
  • fix a failing Vercel build
  • connect a database to serverless functions

Example prompts for the agent

  • Set up environment variables for this project on Vercel
  • Create vercel.json with security headers for the API routes
  • Run npm run build locally and find out why the deploy fails

How to install vercel-deployment

1Skills CLI (Vercel)

npx skills add curiositech/some_claude_skills --skill vercel-deployment -a claude-code

2Manually: put the files in place

~/.claude/skills/vercel-deployment/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/vercel-deployment/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about vercel-deployment

How do I install vercel-deployment in Claude Code?

Run npx skills add curiositech/some_claude_skills --skill vercel-deployment -a claude-code. The skill lands in ~/.claude/skills/vercel-deployment/SKILL.md.

What does vercel-deployment do?

It helps deploy Next.js and React apps to Vercel: env vars, edge functions, vercel.json config, build troubleshooting, preview deployments and monorepos.

Can I use this skill for AWS or Cloudflare Pages?

No. The skill is built only for Vercel and does not cover AWS, GCP, Azure or Cloudflare Pages.

Source text

SKILL.md · MIT
---
name: vercel-deployment
description: Deploy Next.js and React applications to Vercel — project setup, environment variables, edge functions, build troubleshooting, preview deployments, monorepo configuration. NOT for AWS/GCP/Azure
  deployment, self-hosted solutions, or Cloudflare Pages.
allowed-tools: Read,Write,Edit,Bash(npm:*,npx:*,vercel:*)
metadata:
  category: DevOps & Site Reliability
  tags:
  - devops
  - automation
  - web
  - react
  pairs-with:
  - skill: nextjs-app-router-expert
    reason: Vercel is optimized for Next.js deployment with native App Router feature support
  - skill: devops-automator
    reason: Vercel deployment automation integrates with broader CI/CD pipeline workflows
  - skill: github-actions-pipeline-builder
    reason: Vercel preview deployments trigger from GitHub Actions PR workflows
---

# Vercel Deployment

This skill helps you deploy and configure Next.js applications on Vercel following best practices.

## Quick Deploy Checklist

- [ ] Environment variables set in Vercel dashboard
- [ ] Build command configured (default: `next build`)
- [ ] Output directory correct (default: `.next`)
- [ ] Node.js version specified (20.x recommended)
- [ ] Database accessible from Vercel's network
- [ ] Secrets not committed to git

## Environment Variables

### Setting Variables

**Vercel Dashboard** (Recommended for secrets):
1. Project Settings → Environment Variables
2. Add variable with appropriate scope:
   - **Production**: Only production deployments
   - **Preview**: PR and branch previews
   - **Development**: Local `vercel dev`

**Via CLI**:
```bash
vercel env add VARIABLE_NAME production
vercel env pull .env.local  # Pull to local
```

### Variable Naming

```bash
# Server-only (never exposed to browser)
DATABASE_URL=
SESSION_SECRET=
ANTHROPIC_API_KEY=

# Client-exposed (prefixed with NEXT_PUBLIC_)
NEXT_PUBLIC_APP_URL=
NEXT_PUBLIC_ANALYTICS_ID=
```

### Size Limits

| Context | Limit |
|---------|-------|
| Total per deployment | 64 KB |
| Edge Functions | 5 KB per variable |
| Single variable | 64 KB max |

### Required Variables for This Project

```bash
# Authentication (required)
SESSION_SECRET=your-32-char-minimum-secret-here

# AI Integration (required for chat)
ANTHROPIC_API_KEY=sk-ant-api...

# Database (if using external)
DATABASE_URL=file:./data/app.db

# Push Notifications (optional)
VAPID_PUBLIC_KEY=
VAPID_PRIVATE_KEY=
VAPID_SUBJECT=mailto:[email protected]

# OAuth (optional)
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
APPLE_CLIENT_ID=
APPLE_CLIENT_SECRET=
```

## vercel.json Configuration

```json
{
  "buildCommand": "npm run build",
  "framework": "nextjs",
  "regions": ["iad1"],
  "headers": [
    {
      "source": "/api/(.*)",
      "headers": [
        { "key": "Cache-Control", "value": "no-store, must-revalidate" }
      ]
    },
    {
      "source": "/(.*)",
      "headers": [
        { "key": "X-Content-Type-Options", "value": "nosniff" },
        { "key": "X-Frame-Options", "value": "DENY" },
        { "key": "X-XSS-Protection", "value": "1; mode=block" }
      ]
    }
  ],
  "redirects": [
    {
      "source": "/old-path",
      "destination": "/new-path",
      "permanent": true
    }
  ],
  "rewrites": [
    {
      "source": "/api/v1/:path*",
      "destination": "/api/:path*"
    }
  ]
}
```

## TypeScript Configuration (New in 2025)

```typescript
// vercel.ts - Type-safe configuration
import { defineConfig } from '@vercel/config';

export default defineConfig({
  regions: ['iad1'],

  headers: async () => [
    {
      source: '/api/:path*',
      headers: [
        { key: 'Cache-Control', value: 'no-store' },
      ],
    },
  ],

  redirects: async () => [
    {
      source: '/old',
      destination: '/new',
      permanent: true,
    },
  ],
});
```

## Edge Functions

### When to Use Edge

Good for:
- Authentication/authorization
- A/B testing
- Geolocation-based content
- Request/response transforms
- Simple, fast operations

Not suitable for:
- Database connections (use serverless instead)
- Long-running operations
- Large dependencies

### Edge Function Example

```typescript
// src/middleware.ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export const config = {
  matcher: ['/api/:path*', '/protected/:path*'],
};

export function middleware(request: NextRequest) {
  // Check auth token
  const token = request.cookies.get('session')?.value;

  if (!token && request.nextUrl.pathname.startsWith('/protected')) {
    return NextResponse.redirect(new URL('/login', request.url));
  }

  // Add headers
  const response = NextResponse.next();
  response.headers.set('X-Request-Id', crypto.randomUUID());

  return response;
}
```

### Edge Runtime in API Routes

```typescript
// src/app/api/edge-example/route.ts
export const runtime = 'edge';

export async function GET(request: Request) {
  // Limited to edge-compatible APIs
  return Response.json({ timestamp: Date.now() });
}
```

## Build Configuration

### package.json Scripts

```json
{
  "scripts": {
    "build": "next build",
    "postbuild": "npm run db:generate"
  }
}
```

### Build Environment

```bash
# Set Node.js version
# In Vercel Dashboard → Settings → General → Node.js Version
# Or in package.json:
{
  "engines": {
    "node": "20.x"
  }
}
```

### Build Output

```bash
# Check build locally
npm run build

# Analyze bundle
ANALYZE=true npm run build
```

## Database Considerations

### SQLite on Vercel

SQLite with better-sqlite3 works in Vercel's serverless functions, but:
- Filesystem is **read-only** except `/tmp`
- Data doesn't persist between invocations
- Not suitable for production data storage

### Production Database Options

1. **Turso** (SQLite edge database)
   ```typescript
   import { createClient } from '@libsql/client';

   const db = createClient({
     url: process.env.TURSO_DATABASE_URL!,
     authToken: process.env.TURSO_AUTH_TOKEN,
   });
   ```

2. **Vercel Postgres**
   ```typescript
   import { sql } from '@vercel/postgres';

   const result = await sql`SELECT * FROM users`;
   ```

3. **PlanetScale** (MySQL)
4. **Neon** (Postgres)

## Preview Deployments

### Branch Previews

Every git push creates a preview deployment:
- `https://<project>-<branch>-<team>.vercel.app`
- Separate environment variables for preview

### Preview Environment Variables

```bash
# Different values for preview vs production
# In Vercel Dashboard, set both:

DATABASE_URL (Production): postgres://prod-db...
DATABASE_URL (Preview): postgres://staging-db...
```

### Commenting on PRs

Vercel automatically comments on PRs with:
- Preview URL
- Build status
- Performance metrics

## Troubleshooting

### Build Failures

```bash
# Check build locally first
npm run build

# Common issues:
# - Missing environment variables
# - TypeScript errors
# - ESLint errors (strict mode)
# - Missing dependencies
```

### Environment Variable Issues

```bash
# Verify variables are set
vercel env ls

# Pull to local for debugging
vercel env pull .env.local
```

### Function Timeout

```typescript
// Increase timeout (max 60s on Pro, 10s on Hobby)
// In vercel.json:
{
  "functions": {
    "api/long-running.ts": {
      "maxDuration": 60
    }
  }
}
```

### Memory Issues

```typescript
// Increase memory (affects cost)
{
  "functions": {
    "api/heavy-processing.ts": {
      "memory": 1024
    }
  }
}
```

## Monitoring

### Vercel Analytics

```typescript
// src/app/layout.tsx
import { Analytics } from '@vercel/analytics/react';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Analytics />
      </body>
    </html>
  );
}
```

### Speed Insights

```typescript
import { SpeedInsights } from '@vercel/speed-insights/next';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <SpeedInsights />
      </body>
    </html>
  );
}
```

### Function Logs

```bash
# View logs via CLI
vercel logs <deployment-url>

# Real-time logs
vercel logs <deployment-url> --follow
```

## Domains

### Custom Domain Setup

1. Vercel Dashboard → Domains
2. Add domain
3. Configure DNS:
   - A record: `76.76.21.21`
   - Or CNAME: `cname.vercel-dns.com`
4. SSL automatically provisioned

### Redirects

```json
// vercel.json
{
  "redirects": [
    {
      "source": "/:path((?!api/).*)",
      "has": [{ "type": "host", "value": "old-domain.com" }],
      "destination": "https://new-domain.com/:path",
      "permanent": true
    }
  ]
}
```

## Security

### Protected Routes

Use middleware for authentication checks (see Edge Functions above).

### Rate Limiting

Implement application-level rate limiting since Vercel doesn't provide built-in rate limiting for serverless functions.

### Secrets Management

- Never commit `.env` files
- Use Vercel's encrypted environment variables
- Rotate secrets regularly
- Different secrets for preview vs production

## References

- [Vercel Documentation](https://vercel.com/docs)
- [Environment Variables](https://vercel.com/docs/environment-variables)
- [Edge Functions](https://vercel.com/docs/functions/edge-functions)
- [Next.js on Vercel](https://vercel.com/docs/frameworks/nextjs)

© curiositech · MIT · curiositech/some_claude_skills

Similar skills

All skills for DevOps and infrastructure →

vercel-deployment by other authors comes first.

vercel-deployment sickn33 vercel-deployment — a Claude Code skill that gives the agent a procedure for deploying Next.js apps to Vercel. It kicks in when the task mentions vercel, deploy, production, or environment variables. CX Codex +1 1,800installs vercel-deployment davila7 vercel-deployment — a Claude skill that tells your agent how to deploy Next.js to Vercel: env vars per environment, edge vs serverless, build cache. CX Codex +1 124installs vercel-deployment-specialist davila7 vercel-deployment-specialist configures Vercel platform deployments, creates vercel.json setups, and implements edge logic. Helps automate releases and routing. CX Codex 1,309installs aspire-deployment Microsoft aspire-deployment is a Claude Code skill that publishes and deploys Aspire apps from an AppHost model. It activates for deployment, artifact publishing, and teardown requests. CX Codex +1 1,200installs vercel-deployments devops-skills vercel-deployments — a skill for deploying frontend and full-stack apps on Vercel: previews, edge functions, environment variables and production guardrails. CX Codex +1 351installs vercel membrane Skill for working with Vercel through Membrane: create projects, manage deployments, environment variables, and domains directly from your agent. Requires a Membrane account (free tier supported). CX Codex +1 258installs vercel-deploy-optimize davila7 The vercel-deploy-optimize command for Claude Code optimizes and deploys Next.js apps to Vercel with performance monitoring before production or preview deployment. CX Codex +1 506installs vercel-deployment-cursorrules-prompt-file PatrickJS vercel-deployment-cursorrules-prompt-file — a Cursor rule that tells the agent how to ship projects on Vercel. Covers serverless functions, Edge Runtime, middleware, caching and CI/CD. CX Codex +1 ★ 41,178repo stars

From the same set180

The whole set →
2000s-visualization-expert 2000s-visualization-expert — a skill for rebuilding 2000s music visualizers — Milkdrop, AVS, Geiss — with WebGL and Web Audio. Use it when a player needs an audio-reactive backdrop or generative art driven by music. CX Codex +1 190installs cloudflare-worker-dev The cloudflare-worker-dev skill guides Cloudflare Workers work for edge APIs, KV caching, request limits, and real-time coordination. CX Codex +1 189installs clip-aware-embeddings clip-aware-embeddings guides AI coding agents to pick CLIP or dedicated computer vision models. It stops agents from misusing CLIP for counting or spatial reasoning. CX Codex +1 188installs code-necromancer The code-necromancer skill maps an inherited or dormant codebase, helps get it running, and lays out a modernization plan. It starts by examining the system before changing it. CX Codex +1 187installs speech-pathology-ai speech-pathology-ai guides coding assistants through speech therapy tools, acoustic phoneme inspection, and AAC systems. Helps build clinical practice software. CX Codex +1 186installs code-review-checklist code-review-checklist is a Claude Code skill that builds a review checklist from a PR diff, using the project’s language and conventions. It highlights what reviewers should examine. CX Codex +1 185installs modern-drug-rehab-computer The modern-drug-rehab-computer skill outlines addiction treatment approaches and practical ways to handle cravings and distress. Use it to explore support options and prepare questions for a care team. CX Codex +1 185installs hr-network-analyst hr-network-analyst applies graph theory to map professional networks and identify influence brokers. Pinpoints Gladwellian superconnectors and structural holes across industry communities. CX Codex +1 184installs

Project sponsors

Companies that keep this analytics open