[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E242NACHHGFC5D588A2AVQ":3,"skill-same:01M6E242NACHHGFC5D588A2AVQ":134},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":111,"commitSha":112,"skillDirectory":113,"forksCount":114,"repositoryHtmlUrl":115,"repositoryHomepageUrl":116,"ownerHtmlUrl":117,"ownerBlogUrl":118,"ownerDescription":6,"updatedAt":119,"install":120,"resources":133},"01M6E242NACHHGFC5D588A2AVQ","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.","ByeongminLee\u002Fnextjs-claude-code","ByeongminLee","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F71276006?v=4","01M6E1S467E7GC0NE144SWHC0V","Byeongmin Lee","01M6E1S4AV3W0B08Z2YBK26VG9",3,"MIT","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Frouting-middleware\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"routing","routing middleware","configure","guides","apps","app","get","next","clerk","up","node","src","storage","SET","nextjs","server","verification","run","config","auth","2026-11-10 10:12:30",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+[''\"\"](cookie|cookies-next)[''\"\"]|req\\.cookies\\.get\\s*\\(|NextResponse\\.next\\(\\s*\\{.*headers'\n    targetSkill: vercel-flags\n    message: 'Cookie-based routing in middleware — loading Vercel Flags guidance for managed feature flags with Edge Config storage.'\n    skipIfFileContains: '@vercel\u002Fflags|@vercel\u002Fedge-config'\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 Edge Config\n\n```ts\nimport { get } from '@vercel\u002Fedge-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 Edge 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 Edge Config\n\n```ts\nimport { get } from '@vercel\u002Fedge-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 Edge 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":44,"metadata":61,"validate":90,"retrieval":95,"description":7},[45,48,52,57],{"message":46,"pattern":47,"targetSkill":38},"Auth logic in middleware — loading Auth guidance for Clerk\u002FAuth0 integration patterns.","from\\s+['\"\"]next-auth['\"\"]",{"message":49,"pattern":50,"targetSkill":33,"skipIfFileContains":51},"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","proxy\\.ts|runtime.*nodejs",{"message":53,"pattern":54,"targetSkill":55,"skipIfFileContains":56},"Cookie-based routing in middleware — loading Vercel Flags guidance for managed feature flags with Edge Config storage.","from\\s+['\"\"](cookie|cookies-next)['\"\"]|req\\.cookies\\.get\\s*\\(|NextResponse\\.next\\(\\s*\\{.*headers","vercel-flags","@vercel\u002Fflags|@vercel\u002Fedge-config",{"message":58,"pattern":59,"targetSkill":38,"skipIfFileContains":60},"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":62,"sitemap":65,"priority":66,"bashPatterns":67,"pathPatterns":69},[63,64],"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,[68],"\\bnpx\\s+@vercel\u002Fconfig\\b",[70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89],"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",[91],{"message":92,"pattern":50,"severity":93,"upgradeWhy":94,"upgradeToSkill":33,"skipIfFileContains":51},"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":96,"intents":101,"entities":106},[97,98,99,100],"request interceptor","middleware","rewrite rules","redirect rules",[102,103,104,105],"intercept requests","add middleware","configure rewrites","set up redirects",[98,107,108,109,110],"rewrite","redirect","personalization","Edge","main","330a71e3d12264515ce3477e446d29fd34a88a9d","template\u002Fskills-archive\u002Frouting-middleware",1,"https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code","https:\u002F\u002Fbyeongminlee.github.io\u002Fnextjs-claude-code\u002F","https:\u002F\u002Fgithub.com\u002FByeongminLee","byeongmin.dev","2026-03-27 12:45:44",{"source":8,"skillName":5,"commands":121,"prompt":131,"zipAvailable":132},[122,125,128],{"tool":123,"command":124},"npx","npx skills add ByeongminLee\u002Fnextjs-claude-code --skill routing-middleware",{"tool":126,"command":127},"bunx","bunx skills add ByeongminLee\u002Fnextjs-claude-code --skill routing-middleware",{"tool":129,"command":130},"pnpm","pnpm dlx skills add ByeongminLee\u002Fnextjs-claude-code --skill routing-middleware","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Frouting-middleware\u002FSKILL.md",true,[],[135,153,161,186,213,252],{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":39},"01M6E263DRDCZ5AX01N6MDYC6Z","zustand","Zustand state management guide. Use when working with store code (src\u002Fstore\u002F**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fzustand\u002FSKILL.md",[],[137,142,143,144,145,146,147,148,30,149,150,151,152],"triggers","state management","zustand state","implementation","use","guide","management","actions","state","code","development",{"skillNo":154,"name":155,"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":156,"categories":157,"keywords":158,"publishedAt":39},"01M6E260QFP3ZMXY2Y6KTGZYXS","web-vitals","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fweb-vitals\u002FSKILL.md",[],[159,160],"web vitals","web",{"skillNo":162,"name":163,"nameZh":6,"description":164,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":165,"categories":166,"keywords":172,"publishedAt":39},"01M6E25QEKXHH092S5RB0GKM0K","vercel-storage","Vercel storage expert guidance — Blob, Edge Config, and Marketplace storage (Neon Postgres, Upstash Redis). Use when choosing, configuring, or using data storage with Vercel applications.","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fvercel-storage\u002FSKILL.md",[167],{"categoryNo":168,"categoryName":169,"taxonomyType":170,"taxonomyTypeDesc":171},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[173,174,31,175,176,177,32,33,178,38,179,180,24,181,182,183,184,28,185,21],"vercel","vercel storage","supabase","api","mongodb","database","migrate","click","neon","prisma","postgres","expert","auto",{"skillNo":187,"name":188,"nameZh":6,"description":189,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":190,"categories":191,"keywords":198,"publishedAt":39},"01M6E25EC9YM4QM0KBQ2W5R1SC","vercel-functions","Vercel Functions expert guidance — Serverless Functions, Edge Functions, Fluid Compute, streaming, Cron Jobs, and runtime configuration. Use when configuring, debugging, or optimizing server-side code running on Vercel.","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fvercel-functions\u002FSKILL.md",[192,193],{"categoryNo":168,"categoryName":169,"taxonomyType":170,"taxonomyTypeDesc":171},{"categoryNo":194,"categoryName":195,"taxonomyType":196,"taxonomyTypeDesc":197},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[199,173,200,201,202,203,204,23,24,181,205,206,207,208,34,209,210,211,212,184],"functions","vercel functions","local","shared","project","time","express","vercel ai sdk","router","loop","logs","streaming","delete","create",{"skillNo":214,"name":215,"nameZh":6,"description":216,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":217,"categories":218,"keywords":234,"publishedAt":39},"01M6E25873YRYP96MSQK7E2D9X","ui-ux-pro-max","UI\u002FUX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn\u002Fui, and HTML\u002FCSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI\u002FUX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn\u002Fui MCP for component search and examples.","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fui-ux-pro-max\u002FSKILL.md",[219,222,225,228,231],{"categoryNo":220,"categoryName":221,"taxonomyType":170,"taxonomyTypeDesc":171},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":223,"categoryName":224,"taxonomyType":170,"taxonomyTypeDesc":171},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":226,"categoryName":227,"taxonomyType":170,"taxonomyTypeDesc":171},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":229,"categoryName":230,"taxonomyType":196,"taxonomyTypeDesc":197},"01JBSEEDCAT000000000000032","设计师",{"categoryNo":232,"categoryName":233,"taxonomyType":196,"taxonomyTypeDesc":197},"01JBSEEDCAT000000000000033","数据分析师",[235,236,237,238,239,240,241,242,24,243,244,245,246,247,248,249,250,149,251,212],"ui ux pro max","ui","ux","max","css","MCP","design","react","card","chart","fix","projects","plan","improve","Tailwind","Animation","search",{"skillNo":253,"name":254,"nameZh":6,"description":255,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":256,"categories":257,"keywords":258,"publishedAt":39},"01M6E251G3FJSRB9019V20QK9X","turborepo","Turborepo monorepo build system guidance. Triggers on: turbo.json, task pipelines,\ndependsOn, caching, remote cache, the \"turbo\" CLI, --filter, --affected, CI optimization, environment\nvariables, internal packages, monorepo structure\u002Fbest practices, and boundaries.\n\nUse when user: configures tasks\u002Fworkflows\u002Fpipelines, creates packages, sets up\nmonorepo, shares code between apps, runs changed\u002Faffected packages, debugs cache,\nor has apps\u002Fpackages directories.","https:\u002F\u002Fgithub.com\u002FByeongminLee\u002Fnextjs-claude-code\u002Fblob\u002Fmain\u002Ftemplate\u002Fskills-archive\u002Fturborepo\u002FSKILL.md",[],[254,259,146,260,261,23,142,262,263,28,264,265,266,267,268,269,151,270,271,272],"cli","filter","environment variables","caching","structure","environment","monorepo","system","canary","Optimization","ci","packages","tasks","workflows"]