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.
npx skills add https://github.com/curiositech/some_claude_skills --skill vercel-deployment
This skill helps you deploy and configure Next.js applications on Vercel following best practices.
next build).next)Vercel Dashboard (Recommended for secrets):
vercel devVia CLI:
vercel env add VARIABLE_NAME production
vercel env pull .env.local # Pull to local
# 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=
| Context | Limit |
|---------|-------|
| Total per deployment | 64 KB |
| Edge Functions | 5 KB per variable |
| Single variable | 64 KB max |
# 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=
{
"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*"
}
]
}
// 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,
},
],
});
Good for:
Not suitable for:
// 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;
}
// 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() });
}
{
"scripts": {
"build": "next build",
"postbuild": "npm run db:generate"
}
}
# Set Node.js version
# In Vercel Dashboard → Settings → General → Node.js Version
# Or in package.json:
{
"engines": {
"node": "20.x"
}
}
# Check build locally
npm run build
# Analyze bundle
ANALYZE=true npm run build
SQLite with better-sqlite3 works in Vercel's serverless functions, but:
/tmp import { createClient } from '@libsql/client';
const db = createClient({
url: process.env.TURSO_DATABASE_URL!,
authToken: process.env.TURSO_AUTH_TOKEN,
});
import { sql } from '@vercel/postgres';
const result = await sql`SELECT * FROM users`;
Every git push creates a preview deployment:
https://<project>-<branch>-<team>.vercel.app# Different values for preview vs production
# In Vercel Dashboard, set both:
DATABASE_URL (Production): postgres://prod-db...
DATABASE_URL (Preview): postgres://staging-db...
Vercel automatically comments on PRs with:
# Check build locally first
npm run build
# Common issues:
# - Missing environment variables
# - TypeScript errors
# - ESLint errors (strict mode)
# - Missing dependencies
# Verify variables are set
vercel env ls
# Pull to local for debugging
vercel env pull .env.local
// Increase timeout (max 60s on Pro, 10s on Hobby)
// In vercel.json:
{
"functions": {
"api/long-running.ts": {
"maxDuration": 60
}
}
}
// Increase memory (affects cost)
{
"functions": {
"api/heavy-processing.ts": {
"memory": 1024
}
}
}
// src/app/layout.tsx
import { Analytics } from '@vercel/analytics/react';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
);
}
import { SpeedInsights } from '@vercel/speed-insights/next';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<SpeedInsights />
</body>
</html>
);
}
# View logs via CLI
vercel logs <deployment-url>
# Real-time logs
vercel logs <deployment-url> --follow
76.76.21.21cname.vercel-dns.com// vercel.json
{
"redirects": [
{
"source": "/:path((?!api/).*)",
"has": [{ "type": "host", "value": "old-domain.com" }],
"destination": "https://new-domain.com/:path",
"permanent": true
}
]
}
Use middleware for authentication checks (see Edge Functions above).
Implement application-level rate limiting since Vercel doesn't provide built-in rate limiting for serverless functions.
.env filesAssess Kubernetes workloads and cluster configuration for AKS Automatic compatibility. Identifies incompatibilities, generates fixes, and guides migration from AKS Standard to AKS Automatic. WHEN: migrate to AKS Automatic, check AKS Automatic readiness, validate manifests for Automatic, assess cluster for Automatic compatibility, fix deployment for Automatic compatibility, identify AKS Automatic migration blockers, is my cluster ready for AKS Automatic.
Discovers available Azure OpenAI model capacity across regions and projects. Analyzes quota limits, compares availability, and recommends optimal deployment locations based on capacity requirements. USE FOR: find capacity, check quota, where can I deploy, capacity discovery, best region for capacity, multi-project capacity search, quota analysis, model availability, region comparison, check TPM availability. DO NOT USE FOR: actual deployment (hand off to preset or customize after discovery), quota increase requests (direct user to Azure Portal), listing existing deployments.
Interactive guided deployment flow for Azure OpenAI models with full customization control. Step-by-step selection of model version, SKU (GlobalStandard/Standard/ProvisionedManaged), capacity, RAI policy (content filter), and advanced options (dynamic quota, priority processing, spillover). USE FOR: custom deployment, customize model deployment, choose version, select SKU, set capacity, configure content filter, RAI policy, deployment options, detailed deployment, advanced deployment, PTU deployment, provisioned throughput. DO NOT USE FOR: quick deployment to optimal region (use preset).
Unified Azure OpenAI model deployment skill with intelligent intent-based routing. Handles quick preset deployments, fully customized deployments (version/SKU/capacity/RAI policy), and capacity discovery across regions and projects. USE FOR: deploy model, deploy gpt, create deployment, model deployment, deploy openai model, set up model, provision model, find capacity, check model availability, where can I deploy, best region for model, capacity analysis. DO NOT USE FOR: listing existing deployments (use foundry_models_deployments_list MCP tool), deleting deployments, agent creation (use agent/create), project creation (use project/create).
Intelligently deploys Azure OpenAI models to optimal regions by analyzing capacity across all available regions. Automatically checks current region first and shows alternatives if needed. USE FOR: quick deployment, optimal region, best region, automatic region selection, fast setup, multi-region capacity check, high availability deployment, deploy to best location. DO NOT USE FOR: custom SKU selection (use customize), specific version selection (use customize), custom capacity configuration (use customize), PTU deployments (use customize).
This skill should be used when working with LaminDB, an open-source data framework for biology that makes data queryable, traceable, reproducible, and FAIR. Use when managing biological datasets (scRNA-seq, spatial, flow cytometry, etc.), tracking computational workflows, curating and validating data with biological ontologies, building data lakehouses, or ensuring data lineage and reproducibility in biological research. Covers data management, annotation, ontologies (genes, cell types, diseases, tissues), schema validation, integrations with workflow managers (Nextflow, Snakemake) and MLOps platforms (W&B, MLflow), and deployment strategies.
Latch platform for bioinformatics workflows. Build pipelines with Latch SDK, @workflow/@task decorators, deploy serverless workflows, LatchFile/LatchDir, Nextflow/Snakemake integration.
Run Python code in the cloud with serverless containers, GPUs, and autoscaling. Use when deploying ML models, running batch processing jobs, scheduling compute-intensive tasks, or serving APIs that require GPU acceleration or dynamic scaling.
Take curiositech/vercel-deployment from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.