
Routing Middleware
Configure Vercel-compatible middleware or proxy files so your agent intercepts requests with correct rewrites, redirects, and runtime choices across Edge, Node, and Bun.
Overview
Routing Middleware is an agent skill for the Build phase that guides Vercel request interception via middleware, proxy, and vercel.json with runtime-aware rewrites and redirects.
Install
npx skills add https://github.com/vercel-labs/vercel-plugin --skill routing-middlewareWhat is this skill?
- Guidance for intercepting requests before cache: rewrites, redirects, and personalization at the platform edge
- Path patterns for middleware.ts/js, proxy.ts/js, src variants, and vercel.json across monorepos
- Supports Edge, Node.js, and Bun runtimes with framework-agnostic Vercel Routing Middleware semantics
- Built-in validate rule recommending migration from middleware.ts to proxy.ts on Next.js 16 with upgradeToSkill: nextjs
- Triggers on npx @vercel/config and documents official Next.js and Vercel middleware docs
- Validates Next.js middleware.ts → proxy.ts migration pattern
- Docs priority metadata: 6
Adoption & trust: 286 installs on skills.sh; 187 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need platform-level routing and personalization but your middleware files use deprecated Next.js patterns or the wrong runtime for Vercel’s edge and Node options.
Who is it for?
Indie developers deploying on Vercel who edit middleware or vercel.json and want agents to follow official routing semantics and validation messages.
Skip if: Static sites with no edge logic, or teams not using Vercel-compatible hosting where platform middleware docs do not apply.
When should I use this skill?
Intercepting requests at the platform level with Vercel Routing Middleware (any framework).
What do I get? / Deliverables
Your agent produces valid interception handlers and config with documented path patterns and optional migration guidance toward proxy.ts on Next.js 16.
- middleware.ts, proxy.ts, or vercel.json changes aligned to Vercel routing docs
- Validation-friendly NextResponse import patterns
Recommended Skills
Journey fit
Build is where platform routing hooks are authored before deploy; this skill addresses files like middleware.ts and vercel.json during implementation. Integrations subphase matches platform-level request interception that wires auth, geo, and rewrites into the hosting layer—not pure UI work.
How it compares
Platform routing skill for vercel.json and middleware files—not a generic React component composition or client-side router tutorial.
Common Questions / FAQ
Who is routing-middleware for?
Solo builders and small teams shipping on Vercel who configure request interception and need agents to respect middleware, proxy, and vercel.json conventions.
When should I use routing-middleware?
During Build integrations work when you add or change middleware.ts, proxy.ts, or vercel.json to rewrite, redirect, or personalize traffic before it reaches your app.
Is routing-middleware safe to install?
It is configuration guidance tied to the Vercel plugin; check the Security Audits panel on this page and your org’s policies before enabling plugin validate rules in CI.
SKILL.md
READMESKILL.md - Routing Middleware
# Vercel Routing Middleware You are an expert in Vercel Routing Middleware — the platform-level request interception layer. ## What It Is Routing 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. - **File**: `middleware.ts` or `middleware.js` at the project root - **Default export required** (function name can be anything) - **Runtimes**: Edge (default), Node.js (`runtime: 'nodejs'`), Bun (Node.js + `bunVersion` in vercel.json) ## CRITICAL: Middleware Disambiguation There are THREE "middleware" concepts in the Vercel ecosystem: | Concept | File | Runtime | Scope | When to Use | |---------|------|---------|-------|-------------| | **Vercel Routing Middleware** | `middleware.ts` (root) | Edge/Node/Bun | Any framework, platform-level | Request interception before cache: rewrites, redirects, geo, A/B | | **Next.js 16 Proxy** | `proxy.ts` (root, or `src/proxy.ts` if using `--src-dir`) | Node.js only | Next.js 16+ only | Network-boundary proxy needing full Node APIs. NOT for auth. | | **Edge Functions** | Any function file | V8 isolates | General-purpose | Standalone edge compute endpoints, not an interception layer | **Why the rename in Nex