Skilllibrary vercel
Deploy and configure applications on Vercel — set up vercel.json, configure edge and serverless functions, manage environment variables, use preview deployments, wire custom domains, and optimize build settings. Use when deploying to Vercel, editing vercel.json, configuring Vercel functions, or debugging Vercel build/deploy issues. Do not use for self-hosted deployments, non-Vercel serverless platforms, or static-only hosting without Vercel features.
install
source · Clone the upstream repo
git clone https://github.com/merceralex397-collab/skilllibrary
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/14-cloud-platform-devops/vercel" ~/.claude/skills/merceralex397-collab-skilllibrary-vercel && rm -rf "$T"
manifest:
14-cloud-platform-devops/vercel/SKILL.mdsource content
Purpose
Deploy and configure web applications on Vercel — write and maintain
vercel.json, configure edge and serverless functions, manage environment variables across environments, leverage preview deployments for PR-based review, wire custom domains with DNS, and optimize build settings for fast deploys.
When to use this skill
- Creating or editing
configurationvercel.json - Deploying a Next.js, SvelteKit, Nuxt, Astro, or static site to Vercel
- Writing Vercel serverless functions (
directory) or edge functionsapi/ - Configuring environment variables for development, preview, and production
- Setting up preview deployments for pull request branches
- Wiring a custom domain and configuring DNS records for Vercel
- Debugging Vercel build failures, deploy errors, or function runtime issues
- Configuring redirects, rewrites, headers, or CORS in
vercel.json - Optimizing build output, function bundling, or cold start performance on Vercel
Do not use this skill when
- Deploying to self-hosted infrastructure — use
self-hosting-ops - The serverless platform is AWS Lambda or GCP Cloud Functions — use
serverless-patterns - The task is Cloudflare Workers at the edge — use
cloudflare-worker-patterns - The task is purely static hosting without Vercel-specific features (functions, middleware)
- The task is application business logic with no Vercel platform concern
Operating procedure
- Initialize the Vercel project. Run
to connect the local repo to a Vercel project (orvercel link
for first-time setup). Confirm the framework preset is auto-detected (Next.js, SvelteKit, etc.). If not, setvercel
inframework
.vercel.json - Configure
. Define the project configuration:vercel.json
Set{ "framework": "nextjs", "buildCommand": "npm run build", "outputDirectory": ".next", "regions": ["iad1"], "functions": { "api/**/*.ts": { "memory": 1024, "maxDuration": 10 } } }
to the closest region to your users. Configure function memory and duration limits based on workload.regions - Set up environment variables. Use the Vercel CLI or dashboard to set env vars for each environment:
— production-onlyvercel env add DATABASE_URL production
— preview deploymentsvercel env add NEXT_PUBLIC_API_URL preview
— local development viavercel env add DEBUG developmentvercel dev- Never commit
to the repo. Use.env.production
for local dev.vercel env pull .env.local
- Write serverless functions. Create functions in the
directory (or framework-specific locations like Next.jsapi/
). Each file exports a default handler. For edge functions, addapp/api/
to run on Vercel's edge network with lower latency.export const config = { runtime: "edge" } - Configure redirects, rewrites, and headers. Add
,redirects
, andrewrites
arrays toheaders
. Prefer framework-native routing (Next.jsvercel.json
) overnext.config.js
when both are available.vercel.json - Test with preview deployments. Push a branch or open a PR — Vercel auto-deploys a preview at a unique URL. Share the preview URL for review. Preview deployments use the
environment variables. Verify the preview before merging to production.preview - Wire a custom domain. In the Vercel dashboard or CLI, add the domain:
. Configure DNS: add anvercel domains add example.com
record pointing toA
or a76.76.21.21
toCNAME
for subdomains. Vercel provisions TLS automatically. Verify withcname.vercel-dns.com
.vercel domains inspect example.com - Optimize build performance. Enable or configure:
- Remote caching (
:vercel.json
to leverage lockfile caching)"installCommand": "npm ci" - Incremental Static Regeneration (ISR) for Next.js pages that can be stale
- Edge middleware for auth checks, A/B tests, or geolocation routing that runs before the function
- Function bundling — keep
function dependencies minimal to reduce cold start timeapi/
- Remote caching (
- Deploy to production. Merge the PR to the main branch — Vercel auto-deploys to production. Or run
for manual production deploys. Verify the deployment at the production URL. Check the Vercel dashboard for build logs, function logs, and error rates.vercel --prod - Monitor and roll back. Use Vercel's deployment dashboard to monitor function invocation counts, error rates, and duration. If a production deploy introduces issues, use the Vercel dashboard to instantly roll back to the previous deployment (Instant Rollback feature).
Decision rules
- If the function needs < 50ms response time globally, use edge functions (
). If it needs Node.js APIs or heavy computation, use serverless functions.runtime: "edge" - If the project is a static site with no dynamic functions, consider whether Vercel adds value over a simple CDN — use Vercel when you need preview deployments, analytics, or middleware.
- If a redirect or rewrite can be handled by the framework (Next.js
inrewrites
), prefer framework-level config overnext.config.js
to keep routing logic with the app.vercel.json - If environment variables contain secrets, set them as
in the Vercel dashboard — they will be encrypted and hidden from logs.Sensitive - If function cold starts are a problem, reduce bundle size first (check with
), then consider edge functions or splitting large functions.vercel inspect - If the build takes more than 5 minutes, investigate caching (
vsnpm ci
), build output size, and whether unused dependencies can be pruned.npm install
Output requirements
— complete project configuration filevercel.json- Function code — serverless or edge function implementations
- Environment variable list — names, environments (dev/preview/prod), and which are sensitive
- Domain configuration — DNS records needed for custom domain setup
- Deployment verification — confirmation that preview and/or production deploys succeed with expected behavior
References
- Vercel documentation: https://vercel.com/docs
reference: https://vercel.com/docs/projects/project-configurationvercel.json- Vercel serverless functions: https://vercel.com/docs/functions/serverless-functions
- Vercel edge functions: https://vercel.com/docs/functions/edge-functions
- Vercel CLI reference: https://vercel.com/docs/cli
- Vercel environment variables: https://vercel.com/docs/projects/environment-variables
Related skills
— for general serverless architecture patterns applicable to Vercel functionsserverless-patterns
— for edge computing on Cloudflare (alternative to Vercel edge)cloudflare-worker-patterns
— for Firebase-backed applications that may deploy frontend to Vercelfirebase
Anti-patterns
- Committing
or.env.production
directory to the repository.vercel - Using
from local machines as the primary deploy method instead of git-based deploysvercel --prod - Setting all environment variables for all environments instead of scoping to dev/preview/production
- Writing edge functions that import Node.js-only modules (edge runtime has limited API surface)
- Ignoring preview deployments and deploying directly to production without PR review
- Configuring long
on functions "just in case" — this hides performance problems and increases costmaxDuration
Failure handling
- If the build fails, check the Vercel build logs in the dashboard. Common causes: missing env vars (add them in Vercel settings), dependency install failures (check lockfile), or framework version mismatch.
- If a function returns 500, check Vercel function logs (dashboard → Deployments → Functions tab). Look for unhandled exceptions, missing env vars, or timeout.
- If the custom domain shows a DNS error, verify the DNS records with
and confirm propagation. Vercel requires up to 48 hours for DNS propagation but usually completes in minutes.dig example.com - If preview deployments are not triggered, verify the GitHub/GitLab integration is connected and the branch is not excluded in project settings.
- If an edge function fails with "unsupported API" errors, check that all imports are edge-compatible — replace Node.js-only modules with edge-compatible alternatives (e.g., use
instead of Node.jscrypto.subtle
).crypto