Next.js App Router API patterns — Route Handlers, Server Actions, middleware, validation, caching, error handling
92
90%
Does it follow best practices?
Impact
95%
1.58xAverage score across 5 eval scenarios
Passed
No known issues
{
"instruction": "Always configure middleware with a matcher to exclude static assets and Next.js internals",
"relevant_when": "Agent creates or modifies middleware.ts in a Next.js application",
"context": "Next.js middleware.ts runs before every matched request. Without an explicit config.matcher export, it runs on ALL requests including _next/static, _next/image, favicon.ico, and other static assets -- adding unnecessary latency. The middleware file must be at the project root (not inside app/). Middleware runs in the Edge Runtime and cannot use Node.js APIs (fs, path, native modules).",
"sources": [
{
"type": "file",
"filename": "skills/nextjs-api-patterns/SKILL.md",
"tile": "tessl-labs/nextjs-api-patterns@0.2.0"
}
],
"checklist": [
{
"name": "matcher-exported",
"rule": "middleware.ts exports a config object with a matcher array that excludes static files and Next.js internals (_next/static, _next/image, favicon.ico)",
"relevant_when": "Agent creates middleware.ts"
},
{
"name": "middleware-at-project-root",
"rule": "middleware.ts is placed at the project root alongside the app/ directory, not inside app/ or any subdirectory",
"relevant_when": "Agent creates middleware for a Next.js application"
},
{
"name": "edge-runtime-compatible",
"rule": "Middleware code only uses Web APIs (fetch, Request, Response, Headers, URL) -- no Node.js-only APIs (fs, path, Buffer from node:buffer, child_process)",
"relevant_when": "Agent writes middleware logic"
}
]
}