CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/nextjs-api-patterns

Next.js App Router API patterns — Route Handlers, Server Actions, middleware, validation, caching, error handling

92

1.58x
Quality

90%

Does it follow best practices?

Impact

95%

1.58x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

middleware-matcher-configured.jsonverifiers/

{
  "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"
    }
  ]
}

tile.json