routing-middleware

routing-middleware is a skill for Claude Code from build-with-dhiraj/ai-workflow-framework-portability-kit. It costs 49 tokens per session (2,918 once invoked), scanned B, original, MIT.

A Vercel feature that intercepts web requests before they reach the cache. It can handle redirects, URL rewrites, location-based rules, and personalised responses across supported frameworks.

In plain words
What is it for?
Use it for redirects, rewrites, geographic routing, A/B tests, and other request handling at the Vercel platform level.
Why use it?
It lets you make request-level decisions in one platform layer instead of duplicating them inside each web framework. This is useful when the rule must run before cached content is served.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the vercel-plugin plugin — 47 skills, 6 commands, 3 agents, 1 MCP server shipped together

Good fit Use it for redirects, rewrites, geographic routing, A/B tests, and other request handling at the Vercel platform level.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add build-with-dhiraj/ai-workflow-framework-portability-kit --skill routing-middleware
Clone the repo
git clone --depth 1 https://github.com/build-with-dhiraj/ai-workflow-framework-portability-kit

Made for: Claude Code.

Or install vercel-plugin, the plugin that ships this one along with the rest of its 47 skills, 6 commands, 3 agents, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for routing-middleware

README.md
[![agentmods](https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware/github.svg)](https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware)
Your own site
<a href="https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware"><img src="https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for routing-middleware

Your own site · 80×15
<a href="https://agentmods.dev/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware"><img src="https://agentmods.dev/badge/skills/build-with-dhiraj/ai-workflow-framework-portability-kit/routing-middleware.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,918 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.02918
Opus 5.5 $0.00020 $0.01167
Sonnet 5.5 $0.00010 $0.00584
Haiku 4.5 $0.00005 $0.00292

Measured 1mo ago against content hash 08e88ca578fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

routing-middleware scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

fetch('https://analytics.example.com/log', { method: 'POST', body: request.url })
Plugins/vercel-marketplace-source/skills/routing-middleware/SKILL.md · 297 lines

How it starts

The opening of the file, as written. The whole thing — 297 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 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/codemod@latest middleware-to-proxy

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.

Bun Runtime

To run Routing Middleware (and all Vercel Functions) on Bun, add bunVersion to vercel.json:

{
  "bunVersion": "1.x"
}

Read the full file on GitHub · 297 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 297 lines · 49 tokens per session scan B 08e88ca578fd

Subscribe to this mod's changes

routing-middleware is a skill published in the GitHub repository build-with-dhiraj/ai-workflow-framework-portability-kit (5 stars, last pushed 20d ago), licensed MIT. It adds 49 tokens to every session and 2,918 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it B with 1 finding (sends data to an external url). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-21.

Related

Other skills, from other repositories