nextjs-16-proxy
Next.js 16 proxy convention (replacing middleware). Use when creating middleware, handling URL rewrites, or when the user mentions proxy.ts, middleware.ts, or route interception in Next.js 16+.
How do I install this agent skill?
npx skills add https://github.com/blink-new/claude --skill nextjs-16-proxyIs this agent skill safe to install?
- Gen Agent Trust Hubwarn
The skill contains deceptive technical information regarding a non-existent version of Next.js (version 16) and a fabricated 'proxy' convention. It instructs users to run a migration command for a non-existent feature, which can lead to project instability and developer confusion.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
1 file scanned · No issues
- ZeroLeakspass
Score: 93/100 · 2 sections analyzed
What does this agent skill do?
Next.js 16 Proxy Convention
Next.js 16 renamed middleware to proxy to better reflect its network boundary purpose.
Key Changes from Middleware
| Old (Next.js 15) | New (Next.js 16+) |
|---|---|
middleware.ts | proxy.ts |
export function middleware() | export function proxy() |
| Same location | Same location |
File Location
Place proxy.ts at the same level as app or pages:
src/
├── proxy.ts ← Correct location
├── app/
│ └── ...
NOT inside app/:
src/
├── app/
│ ├── proxy.ts ← Wrong location
│ └── ...
Basic Template
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
export function proxy(request: NextRequest) {
const { pathname } = request.nextUrl;
// Example: rewrite /uploads/* to /api/uploads/*
if (pathname.startsWith("/uploads/")) {
const newUrl = request.nextUrl.clone();
newUrl.pathname = pathname.replace("/uploads/", "/api/uploads/");
return NextResponse.rewrite(newUrl);
}
return NextResponse.next();
}
export const config = {
matcher: ["/uploads/:path*"],
};
Common Issue: Dynamic Routes Catching Paths
When you have a dynamic route like [teamSlug] at the root, it can catch paths before rewrites in next.config.ts are applied.
Problem:
- Request:
/uploads/image.png - Dynamic route
[teamSlug]catches it asteamSlug = "uploads" - Results in 404
Solution:
Use proxy.ts instead of next.config.ts rewrites. Proxy runs before routing.
Migration Command
npx @next/codemod@canary middleware-to-proxy .
This automatically:
- Renames
middleware.ts→proxy.ts - Updates function name
middleware→proxy
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/blink-new/claude/nextjs-16-proxy">View nextjs-16-proxy on skillZs</a>