Skip to content
Development
Skill

/nextjs

Next.js 16 with App Router, Server Components, Server Actions, Cache Components. Use for React 19.2 apps, SSR, or encountering async params, proxy.ts migration, use cache errors.

From plugin
claude-skills
241183 skills42 agents62 commands2 MCP

Claude Code

$ npx -y skills add secondsky/claude-skills --skill nextjs --agent claude-code

SKILL.md

nextjs.SKILL.md
name: nextjs
description: "Next.js 16 with App Router, Server Components, Server Actions, Cache Components. Use for React 19.2 apps, SSR, or encountering async params, proxy.ts migration, use cache errors."
license: MIT
metadata:
  version: 1.0.0
  last_verified: 2025-11-21
  nextjs_version: 16.2.0
  react_version: 19.2.0
  node_version: 20.9+
  author: Claude Skills Maintainers
  repository: https://github.com/secondsky/claude-skills
  production_tested: true
  token_savings: 65-70%
  errors_prevented: 18+
  keywords:
    - Next.js 16
    - Next.js App Router
    - Next.js Pages Router
    - Server Components
    - React Server Components
    - Server Actions
    - Cache Components
    - use cache
    - Next.js 16 breaking changes
    - async params nextjs
    - proxy.ts migration
    - React 19.2
    - Next.js metadata
    - Next.js SEO
    - generateMetadata
    - static generation
    - dynamic rendering
    - streaming SSR
    - Suspense
    - parallel routes
    - intercepting routes
    - route groups
    - Next.js middleware
    - Next.js API routes
    - Route Handlers
    - revalidatePath
    - revalidateTag
    - next/navigation
    - useSearchParams
    - turbopack
    - next.config
allowed-tools: ["Read", "Write", "Edit", "Bash", "Glob", "Grep"]

Next.js App Router - Production Patterns

**Version**: Next.js 16.2.0 **React Version**: 19.2.0 **Node.js**: 20.9+ **Last Verified**: 2025-11-21

Table of Contents

1. [When to Use This Skill](#when-to-use-this-skill) 2. [When NOT to Use This Skill](#when-not-to-use-this-skill) 3. [Next.js 16 Breaking Changes](#nextjs-16-breaking-changes) 4. [Cache Components & Caching APIs](#cache-components--caching-apis) 5. [Server Components](#server-components) 6. [Server Actions](#server-actions) 7. [Route Handlers](#route-handlers) 8. [React 19.2 Features](#react-192-features) 9. [Metadata API](#metadata-api) 10. [Image & Font Optimization](#image--font-optimization) 11. [Top 5 Critical Errors](#top-5-critical-errors) 12. [Performance Patterns](#performance-patterns) 13. [TypeScript Configuration](#typescript-configuration)

---

When to Use This Skill

Use this skill when you need:

  • **Next.js 16 App Router patterns** (layouts, loading, error boundaries, routing)
  • **Server Components** best practices (data fetching, composition, streaming)
  • **Server Actions** patterns (forms, mutations, revalidation, error handling)
  • **Cache Components** with `"use cache"` directive (NEW in Next.js 16)
  • **New caching APIs**: `revalidateTag()`, `updateTag()`, `refresh()` (Updated in Next.js 16)
  • **Migration from Next.js 15 to 16** (async params, proxy.ts, parallel routes)
  • **Route Handlers** (API endpoints, webhooks, streaming responses)
  • **Proxy patterns** (`proxy.ts` replaces `middleware.ts` in Next.js 16)
  • **Async route params** (`params`, `searchParams`, `cookies()`, `headers()` now async)
  • **Parallel routes with default.js** (breaking change in Next.js 16)
  • **React 19.2 features** (View Transitions, `useEffectEvent()`, React Compiler)
  • **Metadata API** (SEO, Open Graph, Twitter Cards, sitemaps)
  • **Image optimization** (`next/image` with updated defaults in Next.js 16)
  • **Performance optimization** (lazy loading, code splitting, PPR, ISR)

When NOT to Use This Skill

Do NOT use this skill for:

  • **Cloudflare Workers deployment** → Use the **`cloudflare-nextjs`** skill (OpenNext adapter: `@opennextjs/cloudflare`, `getCloudflareContext`, caching tiers, Workers-specific errors). Note: `cloudflare-nextjs` covers the `proxy.ts` exception for Cloudflare (keep `middleware.ts` there).
  • **Pages Router patterns** → This skill covers App Router ONLY (Pages Router is legacy)
  • **Authentication libraries** → Use `clerk-auth`, `auth-js`, or other auth-specific skills
  • **Database integration** → Use `cloudflare-d1`, `drizzle-orm-d1`, or database-specific skills
  • **UI component libraries** → Use `tailwind-v4-shadcn` skill for Tailwind + shadcn/ui
  • **State management** → Use `zustand-state-management`, `tanstack-query` skills
  • **Form libraries** → Use `react-hook-form-zod` skill

---

Next.js 16 Breaking Changes

**CRITICAL**: Next.js 16 has multiple breaking changes. For detailed migration steps, see `references/next-16-migration-guide.md`.

| Breaking Change | Before | After | |-----------------|--------|-------| | **Async params** | `params.slug` | `const { slug } = await params` | | **Async headers** | `cookies()` sync | `await cookies()` | | **Middleware** | `middleware.ts` | `proxy.ts` (renamed) | | **Parallel routes** | `default.js` optional | `default.js` **required** | | **Caching** | Auto-cached fetch | Opt-in with `"use cache"` | | **revalidateTag()** | 1 argument | 2 arguments (tag + cacheLife) | | **Node.js** | 18.x+ | **20.9+** required | | **React** | 18.x | **19.2+** required |

**Quick Fix for Async Params**:

// ✅ Next.js 16 pattern
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
  const { id } = await params
  return <div>{id}</div>
}

**Codemod**: `bunx @next/codemod@canary upgrade latest`

**See**: `references/next-16-migration-guide.md` for complete migration guide with examples.

---

Cache Components & Caching APIs

"use cache" Directive (NEW in Next.js 16)

'use cache'

export async function BlogPosts() {
  const posts = await db.posts.findMany()
  return posts.map(post => <article key={post.id}>{post.title}</article>)
}

Caching APIs Summary

| API | Purpose | Example | |-----|---------|---------| | `"use cache"` | Opt-in component/function caching | `'use cache'` at top | | `revalidateTag()` | Invalidate by tag | `revalidateTag('posts', 'max')` | | `updateTag()` | Update cache without revalidation | `updateTag('posts', newData)` | | `refresh()` | Refresh current page | `refresh()` | | `revalidatePath()` | Invalidate by path | `revalidatePath('/posts')` |

PPR (Partial Prerendering)

// next.config.ts
const
Read more
@secondsky
Ships withclaude-skills

145 production-ready skills for Claude Code CLI 🔌 Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).

241183 skills42 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
241
Star history of secondsky/claude-skills on GitHub, a chart by star-history.com

Other skills on claude-skills.

aceternity-ui

aceternity-ui

100+ animated React components (Aceternity UI) for Next.js with Tailwind. Use for hero sections, parallax, 3D effects, or…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about nextjs.

Which coding agents can use nextjs?
nextjs installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.