Next.js Best Practices Agent Skill

Next.js App Router expert guidance. Use when building, debugging, or architecting Next.js applications — routing, Server Components…

Context cost
4.5k tokensestimated from the bundle, loaded when it triggers
Bundle
1 file · 18.0 kBtext throughout, nothing executable
Licence
Apache-2.0the author’s own terms
Last change
—no release on file
Servers it uses
Noneruns standalone

What it does

Next.js App Router expert guidance. Use when building, debugging, or architecting Next.js applications — routing, Server Components, Server Actions, Cache Components, layouts, middleware/proxy, data fetching, rendering strategies, and deployment on Vercel.

What this skill changes about the agent has not been set out here as a list. Its SKILL.md, shown below, says it in the author’s own words.

clouddebuggingnextjs
Filed under

Cloud & DevOps

The skill itself

A skill is instructions the model reads, so you can see what you are getting: below is the start of its SKILL.md. The front matter loads with every session, the body loads when the skill triggers, and the whole file comes with the install.

SKILL.md18.0 kB · preview
--- name: nextjs metadata: priority: 5 docs: - "https://nextjs.org/docs" - "https://nextjs.org/docs/app" sitemap: "https://nextjs.org/sitemap.xml" pathPatterns: - 'next.config.*' - 'next-env.d.ts' - 'app/**' - 'pages/**' - 'src/app/**' - 'src/pages/**' - 'tailwind.config.*' - 'postcss.config.*' - 'tsconfig.json' - 'tsconfig.*.json' - 'apps/*/app/**' - 'apps/*/pages/**' - 'apps/*/src/app/**' - 'apps/*/src/pages/**' - 'apps/*/next.config.*' bashPatterns: - '\bnext\s+(dev|build|start|lint)\b' - '\bnext\s+experimental-analyze\b' - '\bnpx\s+create-next-app\b' - '\bbunx\s+create-next-app\b' - '\bnpm\s+run\s+(dev|build|start)\b' - '\bpnpm\s+(dev|build)\b' - '\bbun\s+run\s+(dev|build)\b' promptSignals: phrases: - "next.js" - "nextjs" - "app router" - "server component" - "server action" allOf: - [middleware, next] - [layout, route] anyOf: - "pages router" - "getserversideprops" - "use server" noneOf: [] minScore: 6 validate: - pattern: export.*getServerSideProps message: 'getServerSideProps is removed in App Router — use server components or route handlers' severity: error upgradeToSkill: nextjs upgradeWhy: 'Guides migration from Pages Router getServerSideProps to App Router server components with async data fetching.' - pattern: getServerSideProps message: 'getServerSideProps is a Pages Router pattern — migrate to App Router server components' severity: warn - pattern: export.*getStaticProps message: 'getStaticProps is removed in App Router — use generateStaticParams + server components instead' severity: error upgradeToSkill: nextjs upgradeWhy: 'Guides migration from Pages Router getStaticProps to App Router generateStaticParams with server components.' - pattern: getStaticProps message: 'getStaticProps is a Pages Router pattern — migrate to App Router generateStaticParams + server components' severity: warn - pattern: from\s+['"]next/router['"] message: 'next/router is Pages Router only — use next/navigation for App Router' severity: error upgradeToSkill: nextjs upgradeWhy: 'Guides migration from next/router to next/navigation with useRouter, usePathname, useSearchParams hooks.' - pattern: (useState|useEffect) message: 'React hooks require "use client" directive — add it at the top of client components' severity: warn skipIfFileContains: "^['\"]use client['\"]" - pattern: from\s+['"]next/head['"] message: 'next/head is Pages Router — use export const metadata or generateMetadata() in App Router. Run Skill(nextjs) for metadata API guidance.' severity: error upgradeToSkill: nextjs upgradeWhy: 'Guides migration from next/head to the App Router metadata API (export const metadata / generateMetadata()).' skipIfFileContains: export\s+(const\s+)?metadata|generateMetadata - pattern: export\s+(default\s+)?function\s+middleware message: 'middleware() is renamed to proxy() in Next.js 16 — rename the function and the file to proxy.ts. Run Skill(routing-middleware) for proxy.ts migration guidance.' severity: recommended upgradeToSkill: routing-middleware upgradeWhy: 'Guides migration from middleware.ts to proxy.ts with correct file placement, runtime config, and request interception patterns.' - pattern: revalidateTag\(\s*['"][^'"]+['"]\s*\) message: 'Single-arg revalidateTag(tag) is deprecated in Next.js 16 — pass a cacheLife profile: revalidateTag(tag, "max")' severity: recommended upgradeToSkill: nextjs upgradeWhy: 'Guides migration from single-arg revalidateTag to the Next.js 16 two-arg API with cacheLife profiles.' - pattern: '\bcacheHandler\s*:' message: 'Singular cacheHandler is deprecated in Next.js 16 — use cacheHandlers (plural) with per-type handlers' severity: recommended upgradeToSkill: nextjs upgradeWhy: 'Guides migration from singular cacheHandler to Next.js 16 cacheHandlers (plural) with per-type handler config.' - pattern: useRef\(\s*\) message: 'useRef() requires an initial value in React 19 — use useRef(null) or useRef(0)' severity: error - pattern: next\s+export message: 'next export was removed — use output: "export" in next.config.js for static export' severity: error upgradeToSkill: nextjs upgradeWhy: 'Guides migration from next export CLI command to output: "export" in next.config for static site generation.' - pattern: (?<!await )\bcookies\(\s*\) message: 'cookies() is async in Next.js 16 — add await: const cookieStore = await cookies()' severity: error skipIfFileContains: "^['\"]use client['\"]" - pattern: (?<!await )\bheaders\(\s*\) message: 'headers() is async in Next.js 16 — add await: const headersList = await headers()' severity: error skipIfFileContains: "^['\"]use client['\"]" - pattern: =\s*(?!await\b)params\b message: 'params is async in Next.js 16 — add await: const { slug } = await params' severity: recommended skipIfFileContains: "^['\"]use client['\"]" - pattern: =\s*(?!await\b)searchParams\b message: 'searchParams is async in Next.js 16 — add await: const { query } = await searchParams' severity: recommended skipIfFileContains: "^['\"]use client['\"]" - pattern: 'from\s+[''""](next-auth|@auth/core)[''""]|NextAuth\(|getServerSession\(' message: 'Legacy auth pattern detected. Modern Vercel apps should use Clerk, Descope, or Auth0 for managed authentication.' severity: recommended upgradeToSkill: auth upgradeWhy: 'Migrate from next-auth/manual JWT to a managed auth provider (Clerk, Descope, Auth0) for better Vercel integration.' skipIfFileContains: '@clerk/|@descope/|@auth0/' - pattern: 'NextApiRequest|NextApiResponse|export\s+default\s+function\s+handler' message: 'Pages Router API handler detected. Use App Router route handlers with named HTTP exports instead.' severity: recommended upgradeToSkill: vercel-functions upgradeWhy: 'Migrate from Pages Router API routes to App Router route handlers with Web Request/Response API.' skipIfFileContains: 'export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)' - pattern: 'from\s+[''""](lru-cache|node-cache|memory-cache)[''""]|new\s+(LRUCache|NodeCache)\(' message: 'In-process cache detected. Serverless deployments lose process memory between invocations.' severity: recommended upgradeToSkill: runtime-cache upgradeWhy: 'Replace process-memory caches with Vercel Runtime Cache for shared, region-aware caching.' - pattern: 'from\s+[''""](express|fastify|koa|hapi)[''""]|require\s*\(\s*[''""](express|fastify|koa|hapi)[''""]' message: 'Express/Fastify/Koa/Hapi server framework detected in a Next.js project. Use Next.js route handlers or proxy.ts for request handling instead.' severity: recommended upgradeToSkill: routing-middleware upgradeWhy: 'Replace custom server frameworks with Next.js proxy.ts for request interception and route handlers for API endpoints.' skipIfFileContains: 'proxy\.ts|from\s+[''""](next/server)[''""]|@vercel/functions' - pattern: 'from\s+[''""](typeorm|sequelize|mikro-orm|objection|bookshelf|knex)[''""]|require\s*\(\s*[''""](typeorm|sequelize|mikro-orm|objection|bookshelf|knex)[''""]' message: 'Heavy ORM detected. Consider using lightweight serverless-native alternatives like Drizzle, Prisma, or direct Neon for better cold start performance.' severity: recommended upgradeToSkill: vercel-storage upgradeWhy: 'Migrate from heavy ORMs to serverless-native database clients (Drizzle + Neon, Prisma, or @neondatabase/serverless) for faster cold starts.' skipIfFileContains: 'from\s+[''""](drizzle-orm|@neondatabase|@prisma/client|prisma)[''""]' - pattern: 'fonts\.googleapis\.com|from\s+[''""](fontsource|@fontsource)[''""]|<link[^>]*fonts\.googleapis' message: 'External font loader detected. Use next/font for zero-CLS, self-hosted font loading with automatic optimization.' severity: recommended upgradeToSkill: nextjs upgradeWhy: 'Guides migration from external font loaders to next/font with Geist Sans/Mono for zero-CLS font optimization.' skipIfFileContains: 'next/font' chainTo: - pattern: 'export\s+(default\s+)?function\s+middleware' targetSkill: routing-middleware message: 'middleware() is renamed to proxy() in Next.js 16 — loading Routing Middleware guidance for proxy.ts migration.' - pattern: "from\\s+['\"]@vercel/(postgres|kv)['\"]" targetSkill: vercel-storage message: 'Sunset storage package detected — loading Vercel Storage guidance for Neon/Upstash migration.' - pattern: "from\\s+['\"]@ai-sdk/(anthropic|openai)['\"]" targetSkill: ai-gateway message: 'Direct AI provider SDK import — loading AI Gateway guidance for unified model routing with failover and cost tracking.' - pattern: 'from\s+[''""](next-auth|@auth/core)[''""]|NextAuth\(|getServerSession\(' targetSkill: auth message: 'Legacy auth pattern detected — loading managed authentication guidance (Clerk, Descope, Auth0).' - pattern: 'NextApiRequest|NextApiResponse|export\s+default\s+function\s+handler' targetSkill: vercel-functions message: 'Pages Router API handler detected — loading Vercel Functions guidance for App Router migration.' - pattern: 'from\s+[''""](lru-cache|node-cache|memory-cache)[''""]|new\s+(LRUCache|NodeCache)\(' targetSkill: runtime-cache message: 'In-process cache detected — loading Runtime Cache guidance for serverless-compatible caching.' - pattern: 'fetch\s*\(\s*[''""](https?://)?(api\.openai\.com|api\.anthropic\.com|api\.cohere\.ai)' targetSkill: ai-gateway message: 'Raw AI provider fetch URL detected — loading AI Gateway guidance for unified routing, failover, and OIDC auth.' skipIfFileContains: '@ai-sdk/|from\s+[''""](ai)[''""]|ai-gateway|gateway\(' - pattern: 'jwt\.(sign|verify|decode)\(|from\s+[''""](jsonwebtoken)[''""]|new\s+SignJWT\(|jwtVerify\(' targetSkill: auth message: 'Manual JWT token handling detected — loading Auth guidance for managed authentication (Clerk, Descope, Auth0).' skipIfFileContains: 'clerkMiddleware|@clerk/|@auth0/|@descope/|from\s+[''""](next-auth)[''""]' - pattern: 'from\s+[''"]@/components/ui/|from\s+[''"]@/components/ui[''""]' targetSkill: shadcn message: 'shadcn/ui component imports detected — loading shadcn guidance for component composition, theming, and registry patterns.' skipIfFileContains: 'shadcn|components\.json' - pattern: 'from\s+[''""](styled-components|@emotion/(react|styled)|@mui/material)[''""]' targetSkill: shadcn message: 'CSS-in-JS library detected — loading shadcn/ui guidance for Tailwind CSS + Radix UI component patterns (Vercel recommended).' skipIfFileContains: '@/components/ui|shadcn' - pattern: 'getInitialProps' targetSkill: nextjs message: 'getInitialProps is a legacy Pages Router pattern — loading Next.js guidance for App Router migration with server components and async data fetching.' skipIfFileContains: 'app/.*page\.|generateStaticParams|use cache' - pattern: 'export.*getServerSideProps|getServerSideProps\s*\(' targetSkill: nextjs message: 'getServerSideProps is a Pages Router pattern — loading Next.js guidance for App Router migration with server components and async data fetching.' skipIfFileContains: 'generateStaticParams|use cache|app/.*page\.' - pattern: 'export.*getStaticProps|getStaticProps\s*\(' targetSkill: nextjs message: 'getStaticProps is a Pages Router pattern — loading Next.js guidance for App Router migration with generateStaticParams and server components.' skipIfFileContains: 'generateStaticParams|use cache|app/.*page\.' - pattern: '_app\.(tsx?|jsx?)' targetSkill: nextjs message: '_app.tsx is a Pages Router pattern — loading Next.js guidance for App Router layout.tsx migration.' skipIfFileContains: 'app/layout\.|app/.*layout\.' - pattern: '_document\.(tsx?|jsx?)' targetSkill: nextjs message: '_document.tsx is a Pages Router pattern — loading Next.js guidance for App Router layout.tsx with metadata API migration.' skipIfFileContains: 'app/layout\.|app/.*layout\.' - pattern: "from\\s+['\"]next/document['\"]" targetSkill: nextjs message: 'next/document is Pages Router only — loading Next.js guidance for App Router layout.tsx with html/body structure.' skipIfFileContains: 'app/layout\.|app/.*layout\.' - pattern: 'pages/api/' targetSkill: vercel-functions message: 'Pages Router API route (pages/api/) detected — loading Vercel Functions guidance for App Router route handlers with named HTTP exports.' skipIfFileContains: 'export\s+(async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)' retrieval: aliases: - next.js - nextjs app - react framework - app router intents: - set up routing and layouts in a Next.js app - choose between server and client components for a feature - configure data fetching or caching in App Router - add middleware or proxy logic to handle requests - set up server rendering for React pages - add a new page with dynamic route segments entities: - App Router - Server Components - Server Actions - generateMetadata - layout - proxy - next.config examples: - add a new page with dynamic routing - should this be a server or client component - set up middleware for auth redirects - configure caching for this data fetch - set up server rendering for my pages ---
288# Next.js Best Practices
289
290Apply these rules when writing or reviewing Next.js code.
291
292## File Conventions
293
294See [file-conventions.md](./file-conventions.md) for:
295- Project structure and special files
296- Route segments (dynamic, catch-all, groups)
297- Parallel and intercepting routes
298- Middleware rename in v16 (middleware → proxy)
299
300## RSC Boundaries
301
302Detect invalid React Server Component patterns.
303
304See [rsc-boundaries.md](./rsc-boundaries.md) for:
305- Async client component detection (invalid)
306- Non-serializable props detection
This is a preview of SKILL.md. Download or install the skill to get the whole thing.
In the file
SKILL.md1,862 words
Files1
LicenceApache-2.0
Why you can read it

Nothing in a skill executes. The client loads the text and the model follows it, so a skill can be audited the way a runbook is — by reading it.

What it costs in context

Skills are not billed by the call. They are paid for in context: every token the instructions occupy is a token your code, your diff and your conversation cannot use. Here is what this one takes and when it takes it.

≈3,540
always loaded
The name and description, so the model knows the skill exists and when to reach for it.
960
on trigger
The instruction body, read only when the skill fires.
2.3%
of a 200k window
Ten skills this size would take about 23% of the window before you open a file.
050k100k150k200k context window

4.5k tokens, estimated from the bundle at four bytes to the token, held for the rest of the session once it triggers. Heavy. Teams tend to install this one per project rather than globally, and load it only when the job comes up.

Servers bill, skills cost

A server charges by the month. A skill charges once per session, in context, and then keeps charging it for as long as the session lives.

Before and after

The same question, put to the same model twice: once as it comes, and once with these instructions loaded.

No worked example has been published for this skill yet.

The procedure it runs

The procedure has not been set out here step by step. It is in the body of its SKILL.md: the start of it is shown above, and the whole file comes with the install.

Prose, not code

These steps are written for a model to follow, not executed by a runtime. It can still be told to skip one, and it will say so when it does.

Servers it uses

None. This skill calls no MCP servers at all.

Everything it needs is in the instructions, so it works in a project with nothing connected — the model reads the file and changes how it works with what it can already reach.

Its SKILL.md does not declare which tools it asks the agent for, so what it touches is whatever the instructions themselves ask for — read them before you install it.

What it asks for
Writes filesnot declared
Network accessnot declared

This SKILL.md carries no allowed-tools line, so neither is declared. A skill grants no permissions of its own — it can only ask for tools your client already has.

What it will not do

Every skill is narrow, and the useful ones say where they stop. These are the jobs this one is the wrong tool for.

What this skill is not for has not been published here. Nothing is implied by that: it is a section the author has not filled in.

What is in the bundle

1 file, 18.0 kB on disk. A bundle is text throughout: the instructions the model reads, plus the templates it fills in.

  • SKILL.md18.0 kB
What is not in it

No dependencies and nothing executable: a skill is text the agent reads, so the bundle is 1 file you can review in full before installing. The Apache-2.0 licence covers the templates and examples as well as the instructions.

Install

Installing copies the bundle into your project. Nothing runs at install time — the files sit on disk until the model reads them.

# Next.js Best Practices · 4.5k tokens when loaded · macOS, Linux mkdir -p .claude/skills && t=$(mktemp -d) && curl -fsSL -o "$t/bundle.tar.gz" https://mcprush.com/api/skills/gald3r-labs-next-js-best-practices/bundle.tar.gz && tar -xzf "$t/bundle.tar.gz" -C "$t" && [ -d "$t/next-js-best-practices" ] && { [ ! -e .claude/skills/next-js-best-practices ] || { mv .claude/skills/next-js-best-practices "$t/.previous" && echo "Previous copy moved to $t/.previous"; }; } && mv "$t/next-js-best-practices" .claude/skills/ && echo "Installed .claude/skills/next-js-best-practices"
On Windows, or any OS with Node 20+
npx mcprush@latest skill add gald3r-labs/next-js-best-practices

Windows PowerShell says 'running scripts is disabled on this system'? Run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once, or type npx.cmd instead of npx (codex.cmd, gemini.cmd, grok.cmd likewise). PowerShell 7 needs neither. Writes to .claude/skills/next-js-best-practices/ in the current project. For every project instead, run mkdir -p ~/.claude/skills && t=$(mktemp -d) && curl -fsSL -o "$t/bundle.tar.gz" https://mcprush.com/api/skills/gald3r-labs-next-js-best-practices/bundle.tar.gz && tar -xzf "$t/bundle.tar.gz" -C "$t" && [ -d "$t/next-js-best-practices" ] && { [ ! -e ~/.claude/skills/next-js-best-practices ] || { mv ~/.claude/skills/next-js-best-practices "$t/.previous" && echo "Previous copy moved to $t/.previous"; }; } && mv "$t/next-js-best-practices" ~/.claude/skills/ && echo "Installed ~/.claude/skills/next-js-best-practices" (macOS, Linux) — or add --global to the npx line. The curl line replaces .claude/skills/next-js-best-practices/ only after the download succeeds, so files left there by another skill of the same name, or by an older release, do not mix in. A copy already there is moved aside, not deleted, and the line prints where. It appears as nextjs in Gemini CLI, Codex, Copilot and Grok (its own name); Claude Code lists it by the folder name, next-js-best-practices.

Which clients pick it up on their own

A skill is a folder of text. Most of these read a skills folder and pick it up without being told; the rest take the same folder another way — an upload in the app, a parameter on an API call — and then choose it by its description just the same.

Claude Code.claude/skills/
Claude DesktopCustomize › Skills
ChatGPTSkills › Create › Upload
Cursor.cursor/skills/
VS Code.github/skills/
Codex CLI.agents/skills/
Gemini CLI.gemini/skills/
Grok Build.grok/skills/
Microsoft CopilotSkills › Upload a skill
PerplexityComputer › Skills › Upload a skill
DeepSeek Harness.dsh/skills/
Zed.agents/skills/
Devin Desktop.devin/skills/
Windsurf (legacy).windsurf/skills/
OpenAI Agents SDKInstructions or sandbox Skills
HTTP / APIa request parameter
This release
Versionnot versioned
Publishedno release date on file
PriceFree
Referencegald3r-labs/next-js-best-practices

Versions

Its author publishes no version number, so there is nothing here to pin to: what you install is the folder as it stands today. Instructions change more often than APIs do — a skill can be rewritten entirely without anything it depends on moving.

Pinning

Nothing to pin to: this skill carries no version number of its own. What you install is what the folder holds on the day you install it.

Reviews

—no reviews yet

Nobody has reviewed this skill yet. The rating is the mean of the reviews written here, so there is none until somebody writes the first.

Sign in to review it

A review is tied to an account so it can be answered, edited and taken down by the person who wrote it.

Sign in
Who can post

Anybody with an account, one review each. It carries the version that was current when you wrote it, and the publisher may reply once.

Who wrote it

GL
Gald3r-Labs

Publishes on mcprush.

0 servers listed1 skill listednot claimed
Profile
Publisher
Servers0
Claim this skill