Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
[{"pattern":"export\\s+default\\s+function","message":"Use named exports (GET, POST, PUT, DELETE) instead of default export for route handlers","severity":"error","skipIfFileContains":"(?:^|\\n)\\s*['\"]use\\s+client['\"]|export\\s+const\\s+(?:metadata|dynamic|revalidate|fetchCache|runtime)\\b|export\\s+default\\s+(?:async\\s+)?function\\s+\\w*(?:Page|Layout|Loading|Error|NotFound|Sitemap|Template|Default|sitemap|robots|opengraph|manifest)\\b|<[A-Z][A-Za-z0-9]*|\\{\\s*children\\s*[,}:]|MetadataRoute\\.|from\\s+['\"]next/(?:font|image|link|navigation|headers|cookies)['\"]"},{"pattern":"NextApiRequest|NextApiResponse","message":"NextApiRequest/NextApiResponse are Pages Router types — use Web API Request/Response","severity":"error"},{"pattern":"from\\s+['\"](openai|@anthropic-ai/sdk|anthropic)['\"]|new\\s+(OpenAI|Anthropic)\\(","message":"Direct AI provider SDK detected in route handler. Use the Vercel AI SDK for streaming, tools, and provider abstraction.","severity":"recommended","upgradeToSkill":"ai-sdk","upgradeWhy":"Replace vendor-locked provider SDKs with @ai-sdk/openai or @ai-sdk/anthropic for unified streaming and tool support.","skipIfFileContains":"@ai-sdk/|from\\s+['\"](ai)['\"]|import.*from\\s+['\"](ai)['\"]|streamText|generateText"},{"pattern":"setTimeout\\s*\\(|setInterval\\s*\\(|await\\s+new\\s+Promise\\s*\\([^)]*setTimeout","message":"Long-running or polling logic detected in a serverless handler. Functions have execution time limits.","severity":"recommended","upgradeToSkill":"workflow","upgradeWhy":"Move delayed/polling logic to Vercel Workflow for durable execution with pause, resume, retries, and crash safety.","skipIfFileContains":"use workflow|use step|@vercel/workflow"},{"pattern":"writeFile(Sync)?\\(|createWriteStream\\(|from\\s+['\"](multer|formidable)['\"]|fs\\.writeFile","message":"Local filesystem write detected. Serverless functions have ephemeral, read-only filesystems.","severity":"error","upgradeToSkill":"vercel-storage","upgradeWhy":"Replace local filesystem writes with Vercel Blob, Neon, or Upstash for persistent, platform-native storage.","skipIfFileContains":"@vercel/blob|@upstash/|@neondatabase/"},{"pattern":"export\\s+(async\\s+)?function\\s+(GET|POST|PUT|PATCH|DELETE)\\b","message":"Route handler has no observability instrumentation. Add logging and error tracking for production debugging.","severity":"warn","skipIfFileContains":"console\\.error|logger\\.|captureException|Sentry|@vercel/otel|withTracing"},{"pattern":"from\\s+['\"\"](lru-cache|node-cache|memory-cache)['\"\"]|new\\s+(LRUCache|NodeCache|Map)\\(\\s*\\).*cache","message":"In-process memory cache detected in serverless function. Process memory is not shared across invocations.","severity":"recommended","upgradeToSkill":"runtime-cache","upgradeWhy":"Replace in-process caches with Vercel Runtime Cache (getCache from @vercel/functions) for region-aware caching that persists across invocations.","skipIfFileContains":"getCache|from\\s+['\"\"]\\@vercel/functions['\"\"]"},{"pattern":"maxRetries\\s*[=:]|retryCount\\s*[=:]|retry\\s*\\(\\s*|for\\s*\\([^)]*retry|while\\s*\\([^)]*retry","message":"Manual retry logic detected. Use Vercel Workflow SDK for automatic retries with durable execution.","severity":"recommended","upgradeToSkill":"workflow","upgradeWhy":"Replace manual retry loops with Workflow SDK steps that provide automatic retries, crash safety, and observability.","skipIfFileContains":"use workflow|use step|@vercel/workflow|from\\s+['\"\"](workflow)['\"\"]"},{"pattern":"from\\s+['\"](express)['\"\"]|require\\s*\\(\\s*['\"](express)['\"\"\\)]","message":"Express.js detected in a Vercel project. Vercel Functions use the Web Request/Response API — Express middleware, req/res, and app.listen() do not work in serverless.","severity":"recommended","upgradeToSkill":"vercel-functions","upgradeWhy":"Replace Express with Next.js route handlers (export async function GET/POST) or Vercel Functions using the Web Request/Response API.","skipIfFileContains":"export\\s+(async\\s+)?function\\s+(GET|POST|PUT|PATCH|DELETE)|from\\s+['\"\"](next/server|@vercel/functions)['\"\"]"}]
retrieval
{"aliases":["serverless functions","api routes","edge functions","lambda","websockets","socket.io"],"intents":["create serverless function","configure function runtime","optimize cold starts","add api route","serve a websocket connection"],"entities":["Serverless Functions","Edge Functions","Fluid Compute","streaming","WebSockets","Cron Jobs"]}
chainTo
[{"pattern":"from\\s+['\\\"](openai|@anthropic-ai/sdk|anthropic)['\"]|new\\s+(OpenAI|Anthropic)\\(","targetSkill":"ai-sdk","message":"Direct AI provider SDK in route handler — loading AI SDK guidance for unified streaming and tool support."},{"pattern":"setTimeout\\s*\\(|setInterval\\s*\\(|await\\s+new\\s+Promise\\s*\\([^)]*setTimeout","targetSkill":"workflow","message":"Long-running or polling logic in serverless handler — loading Workflow SDK for durable execution."},{"pattern":"writeFile(Sync)?\\(|createWriteStream\\(|from\\s+['\\\"](multer|formidable)['\"]|fs\\.writeFile","targetSkill":"vercel-storage","message":"Local filesystem write in serverless function — loading Vercel Storage guidance for platform-native persistence."},{"pattern":"from\\s+['\"\"]@vercel/(postgres|kv)['\"\"]","targetSkill":"vercel-storage","message":"@vercel/postgres and @vercel/kv are sunset — loading Vercel Storage guidance for Neon and Upstash migration."},{"pattern":"generateObject\\s*\\(|streamObject\\s*\\(|toDataStreamResponse|maxSteps\\b|CoreMessage\\b","targetSkill":"ai-sdk","message":"Deprecated AI SDK v5 API detected — loading AI SDK v6 guidance for migration."},{"pattern":"while\\s*\\(\\s*true\\s*\\)\\s*\\{|for\\s*\\(\\s*;\\s*;\\s*\\)\\s*\\{|setInterval\\s*\\(\\s*async","targetSkill":"workflow","message":"Polling loop in serverless function detected — loading Workflow SDK for durable, crash-safe execution with pause/resume.","skipIfFileContains":"use workflow|use step|from\\s+['\"]workflow['\"]"},{"pattern":"from\\s+['\"]express['\"]|require\\s*\\(\\s*['\"]express['\"]","targetSkill":"vercel-functions","message":"Express.js detected — loading Vercel Functions guidance for Web Request/Response API route handlers that replace Express middleware and routing.","skipIfFileContains":"export\\s+(async\\s+)?function\\s+(GET|POST|PUT|PATCH|DELETE)"},{"pattern":"from\\s+['\"\"](lru-cache|node-cache|memory-cache)['\"\"]|new\\s+(LRUCache|NodeCache|Map)\\(\\s*\\).*cache","targetSkill":"runtime-cache","message":"In-process memory cache in serverless function — loading Runtime Cache guidance for region-aware caching that persists across invocations.","skipIfFileContains":"getCache|from\\s+['\"\"]\\@vercel/functions['\"\"]"},{"pattern":"maxRetries\\s*[=:]|retryCount\\s*[=:]|retry\\s*\\(\\s*|for\\s*\\([^)]*retry|while\\s*\\([^)]*retry","targetSkill":"workflow","message":"Manual retry logic in serverless handler — loading Workflow SDK guidance for automatic retries with durable execution.","skipIfFileContains":"use workflow|use step|@vercel/workflow|from\\s+['\"\"](workflow)['\"\"]"}]
Vercel Functions
You are an expert in Vercel Functions — the compute layer of the Vercel platform.
Function Types
Serverless Functions (Node.js)
Full Node.js runtime, all npm packages available
Default for Next.js API routes, Server Actions, Server Components
// app/api/hello/route.tsexportasyncfunctionGET() {
returnResponse.json({ message: 'Hello from Node.js' })
}
Edge Functions (V8 Isolates)
Lightweight V8 runtime, Web Standard APIs only
Ultra-low cold starts (<1ms globally)
Limited API surface (no full Node.js)
Best for: auth checks, redirects, A/B testing, simple transformations
// app/api/hello/route.tsexportconst runtime = 'edge'exportasyncfunctionGET() {
returnnewResponse('Hello from the Edge')
}
Bun Runtime (Public Beta)
Add "bunVersion": "1.x" to vercel.json to run Node.js functions on Bun instead. ~28% lower latency for CPU-bound workloads. Supports Next.js, Express, Hono, Nitro.
Rust Runtime (Public Beta)
Rust functions run on Fluid Compute with HTTP streaming and Active CPU pricing. Built on the community Rust runtime. Supports environment variables up to 64 KB.
Node.js 24 LTS
Node.js 24 LTS is now GA on Vercel for both builds and functions. Features V8 13.6, global URLPattern, Undici v7 for faster fetch(), and npm v11.
Choosing Runtime
Need
Runtime
Why
Full Node.js APIs, npm packages
nodejs
Full compatibility
Lower latency, CPU-bound work
nodejs + Bun
~28% latency reduction
Ultra-low latency, simple logic
edge
<1ms cold start, global
Database connections, heavy deps
nodejs
Edge lacks full Node.js
Auth/redirect at the edge
edge
Fastest response
AI streaming
Either
Both support streaming
Systems-level performance
rust (beta)
Native speed, Fluid Compute
Fluid Compute
Fluid Compute is the unified execution model for all Vercel Functions (both Node.js and Edge).
Key benefits:
Optimized concurrency: Multiple invocations on a single instance — up to 85% cost reduction for high-concurrency workloads
Extended durations: Default 300s for all plans; up to 800s on Pro/Enterprise
Active CPU pricing: Charges only while CPU is actively working, not during idle/await time. Enabled by default for all plans. Memory-only periods billed at a significantly lower rate.
Background processing: waitUntil / after for post-response tasks
Dynamic scaling: Automatic during traffic spikes
Bytecode caching: Reduces cold starts via Rust-based runtime with pre-compiled function code
Multi-region failover: Default for Enterprise when Fluid is activated
Instance Sizes
Size
CPU
Memory
Standard (default)
1 vCPU
2 GB
Performance
2 vCPU
4 GB
Hobby projects use Standard CPU. The Basic CPU instance has been removed.
Zero-config streaming on both runtimes, including Server-Sent Events (SSE). Essential for AI applications.
You do NOT need runtime = 'edge' for streaming or SSE. Streaming responses (ReadableStream, text/event-stream) work on the default Node.js runtime — this is a common misconception. Stay on Node.js (Fluid Compute) so you keep full Node.js APIs, npm packages, and longer durations; Edge offers no streaming advantage here.
For AI streaming, use the AI SDK's toUIMessageStreamResponse() (for chat UIs with useChat) which handles SSE formatting automatically.
WebSockets
Vercel Functions can hold open bidirectional WebSocket connections — use them for realtime features like interactive AI streaming, chat, and collaborative apps. There is no separate WebSocket-server product and no third-party service (Pusher, Ably, etc.) required — it runs on Vercel Functions directly. Requires Fluid Compute, which is the default for new projects.
How it works: a WebSocket starts as an HTTP GET with an Upgrade header, so it passes through the same Routing Middleware, rewrites, Firewall rules, and rate limits as any other request. After the upgrade, the connection is pinned to a single function instance for its lifetime; Fluid Compute lets one instance serve many concurrent connections. Active CPU pricing means you're billed while processing messages, not for idle open connections — the same limits and pricing as other Function invocations apply.
ws (no extra config)
WebSockets work like any distributed WebSocket server — export an http.Server and use a library such as ws:
// api/ws.tsimport http from'http'import { WebSocketServer } from'ws'const server = http.createServer()
const wss = newWebSocketServer({ server })
wss.on('connection', (ws) => {
ws.on('message', (data) => ws.send(data)) // echo
})
exportdefault server
Socket.IO
Higher-level realtime libraries like Socket.IO work too. Configure the client to use the WebSocket transport directly — Socket.IO defaults to HTTP long-polling, which won't work:
// api/socket-io.tsimport http from'http'import { Server } from'socket.io'const server = http.createServer()
const io = newServer(server)
io.on('connection', (socket) => {
socket.on('message', (data) => socket.send(data))
})
exportdefault server
// client.tsimport { io } from'socket.io-client'const socket = io('https://your-domain.com', {
// Socket.IO appends /socket.io, so the full path becomes /api/socket-io/socket.iopath: '/api/socket-io/socket.io',
transports: ['websocket'], // required — Socket.IO defaults to HTTP long-polling
})
Express, Hono, and Nitro (including Nuxt, via native WebSocket support) serve WebSockets the same way — export the HTTP server. Python frameworks work too: FastAPI handles the upgrade natively, and python-socketio is protocol-compatible with the JS Socket.IO client.
Next.js
Next.js doesn't expose an API for handling WebSocket upgrades. Use experimental_upgradeWebSocket() from @vercel/functions inside a route handler:
Connections close when the function reaches its max duration. Clients must reconnect with backoff, then resubscribe to channels and reload any state they need.
No instance affinity across connections. A reconnect — or a new deployment — may land on a different instance, so never keep durable state, presence, rooms, or pub/sub coordination in memory. Use an external store such as Redis from the Marketplace.
Deprecation notice: Support for the legacy now.json config file will be removed on March 31, 2026. Rename now.json to vercel.json (no content changes required).
All plans now default to 300s execution time with Fluid Compute.
Plan
Default
Max
Hobby
300s
300s
Pro
300s
800s
Enterprise
300s
800s
Common Pitfalls
Cold starts with DB connections: Use connection pooling (e.g., Neon's @neondatabase/serverless)
Edge limitations: No fs, no native modules, limited crypto — use Node.js runtime if needed
Timeout exceeded: Use Fluid Compute for long-running tasks, or Workflow SDK for very long processes
Bundle size: Functions support up to 5 GB package size on Fluid Compute (up from 250 MB); request bodies up to 100 MB (up from 4.5 MB)
Environment variables: Available in all functions automatically; use vercel env pull for local dev
Function Runtime Diagnostics
Timeout Diagnostics
504 Gateway Timeout?
├─ All plans default to 300s with Fluid Compute
├─ Pro/Enterprise: configurable up to 800s
├─ Long-running task?
│ ├─ Under 5 min → Use Fluid Compute with streaming
│ ├─ Up to 15 min → Use Vercel Functions with `maxDuration` in vercel.json
│ └─ Hours/days → Use Workflow SDK (DurableAgent or workflow steps)
└─ DB query slow? → Add connection pooling, check cold start, use Global Config
500 Error Diagnostics
500 Internal Server Error?
├─ Check Vercel Runtime Logs (Dashboard → Deployments → Functions tab)
├─ Missing env vars? → Compare `.env.local` against Vercel dashboard settings
├─ Import error? → Verify package is in `dependencies`, not `devDependencies`
└─ Uncaught exception? → Wrap handler in try/catch, use `after()` for error reporting
Invocation Failure Diagnostics
"FUNCTION_INVOCATION_FAILED"?
├─ Memory exceeded? → Increase `memory` in vercel.json (up to 3008 MB on Pro)
├─ Crashed during init? → Check top-level await or heavy imports at module scope
└─ Edge Function crash? → Check for Node.js APIs not available in Edge runtime
Cold Start Diagnostics
Cold start latency > 1s?
├─ Using Node.js runtime? → Consider Edge Functions for latency-sensitive routes
├─ Large function bundle? → Audit imports, use dynamic imports, tree-shake
├─ DB connection in cold start? → Use connection pooling (Neon serverless driver)
└─ Enable Fluid Compute to reuse warm instances across requests
Edge Function Timeout Diagnostics
"EDGE_FUNCTION_INVOCATION_TIMEOUT"?
├─ Edge Functions have 25s hard limit (not configurable)
├─ Move heavy computation to Node.js Serverless Functions
└─ Use streaming to start response early, process in background with `waitUntil`