[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BY6GR71TTVRMM76B6VJFCF":3,"skill-same:01M7BY6GR71TTVRMM76B6VJFCF":111},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":88,"commitSha":89,"skillDirectory":90,"forksCount":91,"repositoryHtmlUrl":92,"repositoryHomepageUrl":6,"ownerHtmlUrl":93,"ownerBlogUrl":94,"ownerDescription":95,"updatedAt":96,"install":97,"resources":110},"01M7BY6GR71TTVRMM76B6VJFCF","routing-middleware",null,"Vercel Routing Middleware guidance — request interception before cache, rewrites, redirects, personalization. Works with any framework. Supports Edge, Node.js, and Bun runtimes. Use when intercepting requests at the platform level.","CognitionAI\u002Fdevin-marketplace","CognitionAI","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F163493330?v=4","01M7BVSRD98NC4FG8T3EZS6V5M","Cognition","01M7BVSRDX111C2XPWJ0E6MY26",29,"MIT","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Frouting-middleware\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: routing-middleware\ndescription: Vercel Routing Middleware guidance — request interception before cache, rewrites, redirects, personalization. Works with any framework. Supports Edge, Node.js, and Bun runtimes. Use when intercepting requests at the platform level.\nmetadata:\n  priority: 6\n  docs:\n    - \"https:\u002F\u002Fnextjs.org\u002Fdocs\u002Fapp\u002Fbuilding-your-application\u002Frouting\u002Fmiddleware\"\n    - \"https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\"\n  sitemap: \"https:\u002F\u002Fnextjs.org\u002Fsitemap.xml\"\n  pathPatterns: \n    - 'middleware.ts'\n    - 'middleware.js'\n    - 'middleware.mts'\n    - 'middleware.mjs'\n    - 'proxy.ts'\n    - 'proxy.js'\n    - 'proxy.mts'\n    - 'proxy.mjs'\n    - 'src\u002Fmiddleware.ts'\n    - 'src\u002Fmiddleware.js'\n    - 'src\u002Fmiddleware.mts'\n    - 'src\u002Fmiddleware.mjs'\n    - 'src\u002Fproxy.ts'\n    - 'src\u002Fproxy.js'\n    - 'src\u002Fproxy.mts'\n    - 'src\u002Fproxy.mjs'\n    - 'vercel.json'\n    - 'apps\u002F*\u002Fvercel.json'\n    - 'vercel.ts'\n    - 'vercel.mts'\n  bashPatterns:\n    - '\\bnpx\\s+@vercel\u002Fconfig\\b'\nvalidate:\n  -\n    pattern: 'NextResponse.*from\\s+[''\"]next\u002Fserver[''\"]|from\\s+[''\"]next\u002Fserver[''\"].*NextResponse'\n    message: 'Next.js middleware.ts is renamed to proxy.ts in Next.js 16 — rename the file and use the Node.js runtime. Run Skill(nextjs) for proxy.ts migration guidance.'\n    severity: recommended\n    upgradeToSkill: nextjs\n    upgradeWhy: 'Guides migration from middleware.ts to proxy.ts with correct file placement, Node.js runtime, and Next.js 16 patterns.'\n    skipIfFileContains: 'proxy\\.ts|runtime.*nodejs'\nretrieval:\n  aliases:\n    - request interceptor\n    - middleware\n    - rewrite rules\n    - redirect rules\n  intents:\n    - intercept requests\n    - add middleware\n    - configure rewrites\n    - set up redirects\n  entities:\n    - middleware\n    - rewrite\n    - redirect\n    - personalization\n    - Edge\nchainTo:\n  -\n    pattern: 'from\\s+[''\"\"]next-auth[''\"\"]'\n    targetSkill: auth\n    message: 'Auth logic in middleware — loading Auth guidance for Clerk\u002FAuth0 integration patterns.'\n  -\n    pattern: 'NextResponse.*from\\s+[''\"]next\u002Fserver[''\"]|from\\s+[''\"]next\u002Fserver[''\"].*NextResponse'\n    targetSkill: nextjs\n    message: 'middleware.ts with next\u002Fserver imports detected — loading Next.js guidance for proxy.ts migration (Next.js 16 renames middleware.ts to proxy.ts with Node.js runtime).'\n    skipIfFileContains: 'proxy\\.ts|runtime.*nodejs'\n  -\n    pattern: 'from\\s+[''\"\"](jsonwebtoken)[''\"\"]|jwt\\.(verify|decode)\\('\n    targetSkill: auth\n    message: 'Manual JWT verification in middleware — loading Auth guidance for managed auth middleware patterns (Clerk, Descope).'\n    skipIfFileContains: 'clerkMiddleware|@clerk\u002F|@auth0\u002F'\n\n---\n\n# Vercel Routing Middleware\n\nYou are an expert in Vercel Routing Middleware — the platform-level request interception layer.\n\n## What It Is\n\nRouting Middleware runs **before the cache** on every request matching its config. It is a **Vercel platform** feature (not framework-specific) that works with Next.js, SvelteKit, Astro, Nuxt, or any deployed framework. Built on Fluid Compute.\n\n- **File**: `middleware.ts` or `middleware.js` at the project root\n- **Default export required** (function name can be anything)\n- **Runtimes**: Edge (default), Node.js (`runtime: 'nodejs'`), Bun (Node.js + `bunVersion` in vercel.json)\n\n## CRITICAL: Middleware Disambiguation\n\nThere are THREE \"middleware\" concepts in the Vercel ecosystem:\n\n| Concept | File | Runtime | Scope | When to Use |\n|---------|------|---------|-------|-------------|\n| **Vercel Routing Middleware** | `middleware.ts` (root) | Edge\u002FNode\u002FBun | Any framework, platform-level | Request interception before cache: rewrites, redirects, geo, A\u002FB |\n| **Next.js 16 Proxy** | `proxy.ts` (root, or `src\u002Fproxy.ts` if using `--src-dir`) | Node.js only | Next.js 16+ only | Network-boundary proxy needing full Node APIs. NOT for auth. |\n| **Edge Functions** | Any function file | V8 isolates | General-purpose | Standalone edge compute endpoints, not an interception layer |\n\n**Why the rename in Next.js 16**: `middleware.ts` → `proxy.ts` clarifies it sits at the network boundary (not general-purpose middleware). Partly motivated by CVE-2025-29927 (middleware auth bypass via `x-middleware-subrequest` header). The exported function must also be renamed from `middleware` to `proxy`. Migration codemod: `npx @next\u002Fcodemod@latest middleware-to-proxy`\n\n**Deprecation**: Next.js 16 still accepts `middleware.ts` but treats it as deprecated and logs a warning. It will be removed in a future version.\n\n## Bun Runtime\n\nTo run Routing Middleware (and all Vercel Functions) on Bun, add `bunVersion` to `vercel.json`:\n\n```json\n{\n  \"bunVersion\": \"1.x\"\n}\n```\n\nSet the middleware runtime to `nodejs` — Bun replaces the Node.js runtime transparently:\n\n```ts\nexport const config = {\n  runtime: 'nodejs', \u002F\u002F Bun swaps in when bunVersion is set\n};\n```\n\nBun reduces average latency by ~28% in CPU-bound workloads. Currently in Public Beta — supports Next.js, Express, Hono, and Nitro.\n\n## Basic Example\n\n```ts\n\u002F\u002F middleware.ts (project root)\nimport { geolocation, rewrite } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request) {\n  const { country } = geolocation(request);\n  const url = new URL(request.url);\n  url.pathname = country === 'US' ? '\u002Fus' + url.pathname : '\u002Fintl' + url.pathname;\n  return rewrite(url);\n}\n\nexport const config = {\n  runtime: 'edge', \u002F\u002F 'edge' (default) | 'nodejs'\n};\n```\n\n## Helper Methods (`@vercel\u002Ffunctions`)\n\nFor non-Next.js frameworks, import from `@vercel\u002Ffunctions`:\n\n| Helper | Purpose |\n|--------|---------|\n| `next()` | Continue middleware chain (optionally modify headers) |\n| `rewrite(url)` | Transparently serve content from a different URL |\n| `geolocation(request)` | Get `city`, `country`, `latitude`, `longitude`, `region` |\n| `ipAddress(request)` | Get client IP address |\n| `waitUntil(promise)` | Keep function running after response is sent |\n\nFor Next.js, equivalent helpers are on `NextResponse` (`next()`, `rewrite()`, `redirect()`) and `NextRequest` (`request.geo`, `request.ip`).\n\n## Matcher Configuration\n\nMiddleware runs on **every route** by default. Use `config.matcher` to scope it:\n\n```ts\n\u002F\u002F Single path\nexport const config = { matcher: '\u002Fdashboard\u002F:path*' };\n\n\u002F\u002F Multiple paths\nexport const config = { matcher: ['\u002Fdashboard\u002F:path*', '\u002Fapi\u002F:path*'] };\n\n\u002F\u002F Regex: exclude static files\nexport const config = {\n  matcher: ['\u002F((?!_next\u002Fstatic|favicon.ico).*)'],\n};\n```\n\n**Tip**: Using `matcher` is preferred — unmatched paths skip middleware invocation entirely (saves compute).\n\n## Common Patterns\n\n### IP-Based Header Injection\n\n```ts\nimport { ipAddress, next } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request) {\n  return next({ headers: { 'x-real-ip': ipAddress(request) || 'unknown' } });\n}\n```\n\n### A\u002FB Testing via Global Config\n\n```ts\nimport { get } from '@vercel\u002Fglobal-config';\nimport { rewrite } from '@vercel\u002Ffunctions';\n\nexport default async function middleware(request: Request) {\n  const variant = await get('experiment-homepage'); \u002F\u002F \u003C1ms read\n  const url = new URL(request.url);\n  url.pathname = variant === 'B' ? '\u002Fhome-b' : '\u002Fhome-a';\n  return rewrite(url);\n}\n```\n\n### Background Processing\n\n```ts\nimport type { RequestContext } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request, context: RequestContext) {\n  context.waitUntil(\n    fetch('https:\u002F\u002Fanalytics.example.com\u002Flog', { method: 'POST', body: request.url })\n  );\n  return new Response('OK');\n}\n```\n\n## Request Limits\n\n| Limit | Value |\n|-------|-------|\n| Max URL length | 14 KB |\n| Max request body | 4 MB |\n| Max request headers | 64 headers \u002F 16 KB total |\n\n## Three CDN Routing Mechanisms\n\nVercel's CDN supports three routing mechanisms, evaluated in this order:\n\n| Order | Mechanism | Scope | Deploy Required | How to Configure |\n|-------|-----------|-------|-----------------|------------------|\n| 1 | **Bulk Redirects** | Up to 1M static path→path redirects | No (runtime via Dashboard\u002FAPI\u002FCLI) | Dashboard, CSV upload, REST API |\n| 2 | **Project-Level Routes** | Headers, rewrites, redirects | No (instant publish) | Dashboard, API, CLI, Vercel SDK |\n| 3 | **Deployment Config Routes** | Full routing rules | Yes (deploy) | `vercel.json`, `vercel.ts`, `next.config.ts` |\n\n**Project-level routes** (added March 2026) let you update routing rules — response headers, rewrites to external APIs — without triggering a new deployment. They run after bulk redirects and before deployment config routes. Available on all plans.\n\n### Project-Level Routes — Configuration Methods\n\nProject-level routes take effect instantly (no deploy required). Four ways to manage them:\n\n| Method | How |\n|--------|-----|\n| **Dashboard** | Project → CDN → Routing tab. Live map of global traffic, cache management, and route editor in one view. |\n| **REST API** | `GET\u002FPOST\u002FPATCH\u002FDELETE \u002Fv1\u002Fprojects\u002F{projectId}\u002Froutes` — 8 dedicated endpoints for CRUD on project routes. |\n| **Vercel CLI** | Managed via `vercel.ts` \u002F `@vercel\u002Fconfig` commands (`compile`, `validate`, `generate`). |\n| **Vercel SDK** | `@vercel\u002Fconfig` helpers: `routes.redirect()`, `routes.rewrite()`, `routes.header()`, plus `has`\u002F`missing` conditions and transforms. |\n\nUse project-level routes for operational changes (CORS headers, API proxy rewrites, A\u002FB redirects) that shouldn't require a full redeploy.\n\n## Programmatic Configuration with `vercel.ts`\n\nInstead of static `vercel.json`, you can use `vercel.ts` (or `.js`, `.mjs`, `.cjs`, `.mts`) with the `@vercel\u002Fconfig` package for type-safe, dynamic routing configuration:\n\n```ts\n\u002F\u002F vercel.ts\nimport { defineConfig } from '@vercel\u002Fconfig';\n\nexport default defineConfig({\n  rewrites: [\n    { source: '\u002Fapi\u002F:path*', destination: 'https:\u002F\u002Fbackend.example.com\u002F:path*' },\n  ],\n  headers: [\n    { source: '\u002F(.*)', headers: [{ key: 'X-Frame-Options', value: 'DENY' }] },\n  ],\n});\n```\n\nCLI commands:\n- `npx @vercel\u002Fconfig compile` — compile to JSON (stdout)\n- `npx @vercel\u002Fconfig validate` — validate and show summary\n- `npx @vercel\u002Fconfig generate` — generate `vercel.json` locally for development\n\n**Constraint**: Only one config file per project — `vercel.json` or `vercel.ts`, not both.\n\n## When to Use\n\n- Geo-personalization of static pages (runs before cache)\n- A\u002FB testing rewrites with Global Config\n- Custom redirects based on request properties\n- Header injection (CSP, CORS, custom headers)\n- Lightweight auth checks (defense-in-depth only — not sole auth layer)\n- Project-level routes for headers\u002Frewrites without redeploying\n\n## When NOT to Use\n\n- Need full Node.js APIs in Next.js → use `proxy.ts`\n- General compute at the edge → use Edge Functions\n- Heavy business logic or database queries → use server-side framework features\n- Auth as sole protection → use Layouts, Server Components, or Route Handlers\n- Thousands of static redirects → use Bulk Redirects (up to 1M per project)\n\n## References\n\n- 📖 docs: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\n- 📖 API reference: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\u002Fapi\n- 📖 getting started: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\u002Fgetting-started\n","# Vercel Routing Middleware\n\nYou are an expert in Vercel Routing Middleware — the platform-level request interception layer.\n\n## What It Is\n\nRouting Middleware runs **before the cache** on every request matching its config. It is a **Vercel platform** feature (not framework-specific) that works with Next.js, SvelteKit, Astro, Nuxt, or any deployed framework. Built on Fluid Compute.\n\n- **File**: `middleware.ts` or `middleware.js` at the project root\n- **Default export required** (function name can be anything)\n- **Runtimes**: Edge (default), Node.js (`runtime: 'nodejs'`), Bun (Node.js + `bunVersion` in vercel.json)\n\n## CRITICAL: Middleware Disambiguation\n\nThere are THREE \"middleware\" concepts in the Vercel ecosystem:\n\n| Concept | File | Runtime | Scope | When to Use |\n|---------|------|---------|-------|-------------|\n| **Vercel Routing Middleware** | `middleware.ts` (root) | Edge\u002FNode\u002FBun | Any framework, platform-level | Request interception before cache: rewrites, redirects, geo, A\u002FB |\n| **Next.js 16 Proxy** | `proxy.ts` (root, or `src\u002Fproxy.ts` if using `--src-dir`) | Node.js only | Next.js 16+ only | Network-boundary proxy needing full Node APIs. NOT for auth. |\n| **Edge Functions** | Any function file | V8 isolates | General-purpose | Standalone edge compute endpoints, not an interception layer |\n\n**Why the rename in Next.js 16**: `middleware.ts` → `proxy.ts` clarifies it sits at the network boundary (not general-purpose middleware). Partly motivated by CVE-2025-29927 (middleware auth bypass via `x-middleware-subrequest` header). The exported function must also be renamed from `middleware` to `proxy`. Migration codemod: `npx @next\u002Fcodemod@latest middleware-to-proxy`\n\n**Deprecation**: Next.js 16 still accepts `middleware.ts` but treats it as deprecated and logs a warning. It will be removed in a future version.\n\n## Bun Runtime\n\nTo run Routing Middleware (and all Vercel Functions) on Bun, add `bunVersion` to `vercel.json`:\n\n```json\n{\n  \"bunVersion\": \"1.x\"\n}\n```\n\nSet the middleware runtime to `nodejs` — Bun replaces the Node.js runtime transparently:\n\n```ts\nexport const config = {\n  runtime: 'nodejs', \u002F\u002F Bun swaps in when bunVersion is set\n};\n```\n\nBun reduces average latency by ~28% in CPU-bound workloads. Currently in Public Beta — supports Next.js, Express, Hono, and Nitro.\n\n## Basic Example\n\n```ts\n\u002F\u002F middleware.ts (project root)\nimport { geolocation, rewrite } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request) {\n  const { country } = geolocation(request);\n  const url = new URL(request.url);\n  url.pathname = country === 'US' ? '\u002Fus' + url.pathname : '\u002Fintl' + url.pathname;\n  return rewrite(url);\n}\n\nexport const config = {\n  runtime: 'edge', \u002F\u002F 'edge' (default) | 'nodejs'\n};\n```\n\n## Helper Methods (`@vercel\u002Ffunctions`)\n\nFor non-Next.js frameworks, import from `@vercel\u002Ffunctions`:\n\n| Helper | Purpose |\n|--------|---------|\n| `next()` | Continue middleware chain (optionally modify headers) |\n| `rewrite(url)` | Transparently serve content from a different URL |\n| `geolocation(request)` | Get `city`, `country`, `latitude`, `longitude`, `region` |\n| `ipAddress(request)` | Get client IP address |\n| `waitUntil(promise)` | Keep function running after response is sent |\n\nFor Next.js, equivalent helpers are on `NextResponse` (`next()`, `rewrite()`, `redirect()`) and `NextRequest` (`request.geo`, `request.ip`).\n\n## Matcher Configuration\n\nMiddleware runs on **every route** by default. Use `config.matcher` to scope it:\n\n```ts\n\u002F\u002F Single path\nexport const config = { matcher: '\u002Fdashboard\u002F:path*' };\n\n\u002F\u002F Multiple paths\nexport const config = { matcher: ['\u002Fdashboard\u002F:path*', '\u002Fapi\u002F:path*'] };\n\n\u002F\u002F Regex: exclude static files\nexport const config = {\n  matcher: ['\u002F((?!_next\u002Fstatic|favicon.ico).*)'],\n};\n```\n\n**Tip**: Using `matcher` is preferred — unmatched paths skip middleware invocation entirely (saves compute).\n\n## Common Patterns\n\n### IP-Based Header Injection\n\n```ts\nimport { ipAddress, next } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request) {\n  return next({ headers: { 'x-real-ip': ipAddress(request) || 'unknown' } });\n}\n```\n\n### A\u002FB Testing via Global Config\n\n```ts\nimport { get } from '@vercel\u002Fglobal-config';\nimport { rewrite } from '@vercel\u002Ffunctions';\n\nexport default async function middleware(request: Request) {\n  const variant = await get('experiment-homepage'); \u002F\u002F \u003C1ms read\n  const url = new URL(request.url);\n  url.pathname = variant === 'B' ? '\u002Fhome-b' : '\u002Fhome-a';\n  return rewrite(url);\n}\n```\n\n### Background Processing\n\n```ts\nimport type { RequestContext } from '@vercel\u002Ffunctions';\n\nexport default function middleware(request: Request, context: RequestContext) {\n  context.waitUntil(\n    fetch('https:\u002F\u002Fanalytics.example.com\u002Flog', { method: 'POST', body: request.url })\n  );\n  return new Response('OK');\n}\n```\n\n## Request Limits\n\n| Limit | Value |\n|-------|-------|\n| Max URL length | 14 KB |\n| Max request body | 4 MB |\n| Max request headers | 64 headers \u002F 16 KB total |\n\n## Three CDN Routing Mechanisms\n\nVercel's CDN supports three routing mechanisms, evaluated in this order:\n\n| Order | Mechanism | Scope | Deploy Required | How to Configure |\n|-------|-----------|-------|-----------------|------------------|\n| 1 | **Bulk Redirects** | Up to 1M static path→path redirects | No (runtime via Dashboard\u002FAPI\u002FCLI) | Dashboard, CSV upload, REST API |\n| 2 | **Project-Level Routes** | Headers, rewrites, redirects | No (instant publish) | Dashboard, API, CLI, Vercel SDK |\n| 3 | **Deployment Config Routes** | Full routing rules | Yes (deploy) | `vercel.json`, `vercel.ts`, `next.config.ts` |\n\n**Project-level routes** (added March 2026) let you update routing rules — response headers, rewrites to external APIs — without triggering a new deployment. They run after bulk redirects and before deployment config routes. Available on all plans.\n\n### Project-Level Routes — Configuration Methods\n\nProject-level routes take effect instantly (no deploy required). Four ways to manage them:\n\n| Method | How |\n|--------|-----|\n| **Dashboard** | Project → CDN → Routing tab. Live map of global traffic, cache management, and route editor in one view. |\n| **REST API** | `GET\u002FPOST\u002FPATCH\u002FDELETE \u002Fv1\u002Fprojects\u002F{projectId}\u002Froutes` — 8 dedicated endpoints for CRUD on project routes. |\n| **Vercel CLI** | Managed via `vercel.ts` \u002F `@vercel\u002Fconfig` commands (`compile`, `validate`, `generate`). |\n| **Vercel SDK** | `@vercel\u002Fconfig` helpers: `routes.redirect()`, `routes.rewrite()`, `routes.header()`, plus `has`\u002F`missing` conditions and transforms. |\n\nUse project-level routes for operational changes (CORS headers, API proxy rewrites, A\u002FB redirects) that shouldn't require a full redeploy.\n\n## Programmatic Configuration with `vercel.ts`\n\nInstead of static `vercel.json`, you can use `vercel.ts` (or `.js`, `.mjs`, `.cjs`, `.mts`) with the `@vercel\u002Fconfig` package for type-safe, dynamic routing configuration:\n\n```ts\n\u002F\u002F vercel.ts\nimport { defineConfig } from '@vercel\u002Fconfig';\n\nexport default defineConfig({\n  rewrites: [\n    { source: '\u002Fapi\u002F:path*', destination: 'https:\u002F\u002Fbackend.example.com\u002F:path*' },\n  ],\n  headers: [\n    { source: '\u002F(.*)', headers: [{ key: 'X-Frame-Options', value: 'DENY' }] },\n  ],\n});\n```\n\nCLI commands:\n- `npx @vercel\u002Fconfig compile` — compile to JSON (stdout)\n- `npx @vercel\u002Fconfig validate` — validate and show summary\n- `npx @vercel\u002Fconfig generate` — generate `vercel.json` locally for development\n\n**Constraint**: Only one config file per project — `vercel.json` or `vercel.ts`, not both.\n\n## When to Use\n\n- Geo-personalization of static pages (runs before cache)\n- A\u002FB testing rewrites with Global Config\n- Custom redirects based on request properties\n- Header injection (CSP, CORS, custom headers)\n- Lightweight auth checks (defense-in-depth only — not sole auth layer)\n- Project-level routes for headers\u002Frewrites without redeploying\n\n## When NOT to Use\n\n- Need full Node.js APIs in Next.js → use `proxy.ts`\n- General compute at the edge → use Edge Functions\n- Heavy business logic or database queries → use server-side framework features\n- Auth as sole protection → use Layouts, Server Components, or Route Handlers\n- Thousands of static redirects → use Bulk Redirects (up to 1M per project)\n\n## References\n\n- 📖 docs: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\n- 📖 API reference: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\u002Fapi\n- 📖 getting started: https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware\u002Fgetting-started\n",{"name":5,"chainTo":24,"metadata":38,"validate":67,"retrieval":72,"description":7},[25,29,34],{"message":26,"pattern":27,"targetSkill":28},"Auth logic in middleware — loading Auth guidance for Clerk\u002FAuth0 integration patterns.","from\\s+['\"\"]next-auth['\"\"]","auth",{"message":30,"pattern":31,"targetSkill":32,"skipIfFileContains":33},"middleware.ts with next\u002Fserver imports detected — loading Next.js guidance for proxy.ts migration (Next.js 16 renames middleware.ts to proxy.ts with Node.js runtime).","NextResponse.*from\\s+['\"]next\u002Fserver['\"]|from\\s+['\"]next\u002Fserver['\"].*NextResponse","nextjs","proxy\\.ts|runtime.*nodejs",{"message":35,"pattern":36,"targetSkill":28,"skipIfFileContains":37},"Manual JWT verification in middleware — loading Auth guidance for managed auth middleware patterns (Clerk, Descope).","from\\s+['\"\"](jsonwebtoken)['\"\"]|jwt\\.(verify|decode)\\(","clerkMiddleware|@clerk\u002F|@auth0\u002F",{"docs":39,"sitemap":42,"priority":43,"bashPatterns":44,"pathPatterns":46},[40,41],"https:\u002F\u002Fnextjs.org\u002Fdocs\u002Fapp\u002Fbuilding-your-application\u002Frouting\u002Fmiddleware","https:\u002F\u002Fvercel.com\u002Fdocs\u002Frouting-middleware","https:\u002F\u002Fnextjs.org\u002Fsitemap.xml",6,[45],"\\bnpx\\s+@vercel\u002Fconfig\\b",[47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66],"middleware.ts","middleware.js","middleware.mts","middleware.mjs","proxy.ts","proxy.js","proxy.mts","proxy.mjs","src\u002Fmiddleware.ts","src\u002Fmiddleware.js","src\u002Fmiddleware.mts","src\u002Fmiddleware.mjs","src\u002Fproxy.ts","src\u002Fproxy.js","src\u002Fproxy.mts","src\u002Fproxy.mjs","vercel.json","apps\u002F*\u002Fvercel.json","vercel.ts","vercel.mts",[68],{"message":69,"pattern":31,"severity":70,"upgradeWhy":71,"upgradeToSkill":32,"skipIfFileContains":33},"Next.js middleware.ts is renamed to proxy.ts in Next.js 16 — rename the file and use the Node.js runtime. Run Skill(nextjs) for proxy.ts migration guidance.","recommended","Guides migration from middleware.ts to proxy.ts with correct file placement, Node.js runtime, and Next.js 16 patterns.",{"aliases":73,"intents":78,"entities":83},[74,75,76,77],"request interceptor","middleware","rewrite rules","redirect rules",[79,80,81,82],"intercept requests","add middleware","configure rewrites","set up redirects",[75,84,85,86,87],"rewrite","redirect","personalization","Edge","main","9836d94e88404aabb682086405c2aa9cba7657ac","plugins\u002Fvercel\u002Fskills\u002Frouting-middleware",156,"https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace","https:\u002F\u002Fgithub.com\u002FCognitionAI","https:\u002F\u002Fcognition.ai\u002F","Makers of Devin, the AI software engineer.","2026-11-13 07:08:23",{"source":8,"skillName":5,"commands":98,"prompt":108,"zipAvailable":109},[99,102,105],{"tool":100,"command":101},"npx","npx skills add CognitionAI\u002Fdevin-marketplace --skill routing-middleware",{"tool":103,"command":104},"bunx","bunx skills add CognitionAI\u002Fdevin-marketplace --skill routing-middleware",{"tool":106,"command":107},"pnpm","pnpm dlx skills add CognitionAI\u002Fdevin-marketplace --skill routing-middleware","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Frouting-middleware\u002FSKILL.md",true,[],[112,118,125,131,138,145],{"skillNo":113,"name":114,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M7BYC4AJGM98P2G9JH7QS24Z","business-data","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fwindsor-ai\u002Fskills\u002Fbusiness-data\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":19},"01M7BYBZ0CD4CBCPZHRZ551BNK","workflow","Creates durable, resumable workflows using Vercel's Workflow SDK. Use when building workflows that need to survive restarts, pause for external events, retry on failure, or coordinate multi-step operations over time. Triggers on mentions of \"workflow\", \"durable functions\", \"resumable\", \"workflow sdk\", \"queue\", \"event\", \"push\", \"subscribe\", or step-based orchestration.","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Fworkflow\u002Fupstream\u002FSKILL.md",[],[],{"skillNo":126,"name":120,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":19},"01M7BYB1XSZHKHD8JZTQJ62JN0","Vercel Workflow SDK expert guidance. Use when building durable workflows, long-running tasks, API routes or agents that need pause\u002Fresume, retries, step-based execution, or crash-safe orchestration with Vercel Workflow.","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Fworkflow\u002FSKILL.md",[],[],{"skillNo":132,"name":133,"nameZh":6,"description":134,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":135,"categories":136,"keywords":137,"publishedAt":19},"01M7BYASGMK935J33E21N5WTW0","verification","Full-story verification — infers what the user is building, then verifies the complete flow end-to-end: browser → API → data → response. Triggers on dev server start and 'why isn't this working' signals.","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Fverification\u002FSKILL.md",[],[],{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":19},"01M7BY9WJERKSKEH9HK6E71GW2","vercel-storage","Vercel storage expert guidance — Blob, Global Config (formerly Edge Config), and Marketplace storage (Neon Postgres, Upstash Redis). Use when choosing, configuring, or using data storage with Vercel applications.","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Fvercel-storage\u002FSKILL.md",[],[],{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":19},"01M7BY9N034894YV2J9DCRZHYS","vercel-services","Configure and troubleshoot Vercel Services for multiple frontends and backends in one project. Use when composing a polyglot or multi-service application on one Vercel deployment; defining the `services` key, service-targeted rewrites, or service bindings in `vercel.json`; or running all services with `vercel dev`.","https:\u002F\u002Fgithub.com\u002FCognitionAI\u002Fdevin-marketplace\u002Fblob\u002Fmain\u002Fplugins\u002Fvercel\u002Fskills\u002Fvercel-services\u002FSKILL.md",[],[]]