Install
openclaw skills install vercel-config-analyzerAnalyze Vercel project configurations — audit vercel.json, framework detection, build settings, edge functions, headers, redirects, rewrites, environment variables, and deployment performance. Use when asked to review, debug, or optimize a Vercel deployment.
openclaw skills install vercel-config-analyzerAnalyze Vercel project configurations for correctness, performance, and security. Examines vercel.json, framework settings, build configuration, edge functions, middleware, headers, redirects, environment variables, and deployment patterns. Finds misconfigurations before they cause production incidents.
Use when: "review our Vercel config", "why is our Vercel deployment slow", "check vercel.json", "optimize our edge functions", "fix Vercel build errors", "audit our headers and redirects", or when deploying a new project to Vercel.
Locate and read all Vercel-relevant files:
vercel.json — primary configurationnext.config.js, nuxt.config.ts, svelte.config.js, astro.config.mjs, etc.package.json — build commands and framework detection.env* files — check existence, not contentmiddleware.ts / middleware.js — edge middlewareapi/ / pages/api/ / app/api/ — serverless and edge functions (search for export const runtime)Check each section of vercel.json for correctness:
Build Configuration:
{
"buildCommand": "npm run build",
"outputDirectory": "dist",
"installCommand": "npm ci",
"framework": "nextjs"
}
Common issues:
buildCommand not matching package.json scriptsoutputDirectory wrong for the framework (Next.js: .next, Vite: dist, CRA: build)framework field causing incorrect auto-detectionnpm install instead of npm ci (non-deterministic builds)Framework detection matrix:
| Framework | Expected Output Dir | Auto-Detected | Build Command |
|---|---|---|---|
| Next.js | .next | Yes | next build |
| Vite | dist | Yes | vite build |
| Create React App | build | Yes | react-scripts build |
| Nuxt | .output | Yes | nuxt build |
| SvelteKit | .svelte-kit | Yes | vite build |
| Astro | dist | Yes | astro build |
| Remix | build | Yes | remix build |
| Plain HTML | public or . | No | None |
{
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "X-Content-Type-Options", "value": "nosniff" },
{ "key": "X-Frame-Options", "value": "DENY" },
{ "key": "X-XSS-Protection", "value": "1; mode=block" },
{ "key": "Referrer-Policy", "value": "strict-origin-when-cross-origin" },
{ "key": "Permissions-Policy", "value": "camera=(), microphone=(), geolocation=()" }
]
}
]
}
Security headers checklist:
| Header | Required | Purpose | Recommended Value |
|---|---|---|---|
Strict-Transport-Security | Critical | Force HTTPS | max-age=63072000; includeSubDomains; preload |
X-Content-Type-Options | Critical | Prevent MIME sniffing | nosniff |
X-Frame-Options | High | Prevent clickjacking | DENY or SAMEORIGIN |
Content-Security-Policy | High | Prevent XSS/injection | Application-specific |
Referrer-Policy | Medium | Control referrer info | strict-origin-when-cross-origin |
Permissions-Policy | Medium | Restrict browser features | Deny unused features |
X-XSS-Protection | Low | Legacy XSS filter | 0 (or omit; CSP replaces this) |
Cache strategy recommendations:
| Resource Type | Cache-Control | Why |
|---|---|---|
| Hashed assets (JS/CSS) | public, max-age=31536000, immutable | Content-addressed, never changes |
| Images/fonts | public, max-age=86400, stale-while-revalidate=604800 | Changes rarely |
| HTML pages | public, max-age=0, must-revalidate | Should always check for updates |
| API responses | no-store or private, max-age=60 | Depends on data freshness needs |
| User-specific data | private, no-store | Must never be cached in shared caches |
Redirect issues to check:
permanent: true (301) for temporary moves — browsers cache 301s aggressively, very hard to undo/about vs /about/)Rewrite issues to check:
has conditions — creates an open proxy/:path* -> /index.html) not placed LAST — overrides API routesFunctions can be configured in vercel.json (per-file memory, maxDuration, runtime) or inline with export const runtime = 'edge' and export const maxDuration = 30.
Function optimization checklist:
maxDuration for long operations (default: 10s Hobby / 60s Pro)Edge vs Serverless decision matrix:
| Use Case | Recommended Runtime | Why |
|---|---|---|
| Authentication/authorization | Edge | Low latency, runs before page loads |
| Geolocation-based routing | Edge | Access to request.geo |
| A/B testing | Edge | Modify response before it reaches client |
| Feature flags | Edge | Fast, runs at the edge |
| Database queries | Serverless (Node.js) | Most DB drivers need Node.js APIs |
| File processing | Serverless (Node.js) | Needs Node.js fs/stream APIs |
| Heavy computation | Serverless (Node.js) | Edge has CPU time limits |
| External API proxy | Either | Edge if latency-sensitive |
Search code for process.env.* and client-exposed prefixes. Key audit checks:
VERCEL_URL usage — use for dynamic base URL on preview deploymentsFramework-specific variable exposure:
| Framework | Client-Exposed Prefix | Server-Only |
|---|---|---|
| Next.js | NEXT_PUBLIC_* | Everything else |
| Vite | VITE_* | Everything else |
| Create React App | REACT_APP_* | Everything else |
| Nuxt | NUXT_PUBLIC_* | NUXT_* (server) |
| SvelteKit | PUBLIC_* | Everything else |
| Astro | PUBLIC_* | Everything else |
Common build time culprits and fixes:
| Culprit | Time Cost | Fix |
|---|---|---|
npm install | 30-120s | Use npm ci, enable Vercel dependency cache |
| TypeScript compilation | 15-60s | Use SWC (Next.js default), check tsconfig strictness |
| Static page generation | Varies | Reduce build-time pages, use ISR for long-tail |
| Image optimization | 10-60s | Use external image CDN |
| Linting/testing in build | 30-120s | Move to CI (GitHub Actions), don't block deploy |
Check build output size with du -sh .next/ dist/ build/ and analyze build-manifest.json for oversized pages.
Middleware audit checklist:
_next/static, _next/image, and favicon.icoSameSite, Secure, and HttpOnly flagscname.vercel-dns.com)# Vercel Configuration Analysis
## Project Overview
- **Framework:** {detected framework}
- **Runtime:** {Edge / Serverless / Static}
- **Build Command:** {command}
- **Output Directory:** {path}
## Findings
### Critical
- {Security or correctness issue that will cause production problems}
### Warnings
- {Performance or best-practice issue}
### Recommendations
- {Optimization opportunities}
## Security Headers
- {Present: list}
- {Missing: list with recommended values}
## Environment Variables
- {Count of server-only vars}
- {Count of client-exposed vars}
- {Any sensitive vars exposed to client}
## Performance
- {Build time analysis}
- {Bundle size concerns}
- {Caching recommendations}
## Suggested vercel.json
{Optimized configuration}
vercel.json settings conflict with framework config (e.g., next.config.js headers override vercel.json headers in Next.js)preview environment — verify env vars are set for preview, not just productionvercel env pull locally to sync environment variables for local developmentRoot Directory in project settings and use ignoreCommand to skip unchanged projectsrevalidate — the stale page is served while regenerating (stale-while-revalidate pattern)vercel build locally to test the exact build process Vercel will runvercel logs) for runtime errors that don't appear in build outputX-Robots-Tag: noindex header on non-production deployments