Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
fernandofuc avatar

Nextjs 16 Complete Guide

  • 320 installs
  • Updated January 24, 2026
  • fernandofuc/nextjs-claude-setup

nextjs-16-complete-guide is a Claude agent skill that documents Next.js 16 features, breaking changes, and v15-to-v16 migration steps for developers building or upgrading React web applications.

About

nextjs-16-complete-guide is a comprehensive reference skill for developers starting new Next.js 16 projects or migrating existing apps from Next.js 15. The skill covers Cache Components with the "use cache" directive, stable Turbopack as the default bundler, the proxy.ts architecture replacing middleware patterns, DevTools MCP integration, and React Compiler support for automatic memoization. Developers reach for nextjs-16-complete-guide when upgrading a production Next.js 15 codebase or scaffolding a greenfield App Router project and need authoritative guidance on breaking changes and performance optimizations. The skill explains Partial Pre-Rendering interactions with cache boundaries, migration pitfalls between versions, and how to leverage Turbopack for faster local development builds. It serves as an in-agent framework reference so coding agents apply Next.js 16 conventions correctly instead of generating outdated Next.js 15 patterns during feature work or upgrades.

  • nextjs-16-complete-guide
  • Development

Nextjs 16 Complete Guide by the numbers

  • 320 all-time installs (skills.sh)
  • Ranked #1,255 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Jul 24, 2026 (Skillselion catalog sync)
npx skills add https://github.com/fernandofuc/nextjs-claude-setup --skill nextjs-16-complete-guide

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs320
Last updatedJanuary 24, 2026
Repositoryfernandofuc/nextjs-claude-setup

How do you migrate from Next.js 15 to 16?

For development and infrastructure management.

Who is it for?

Frontend engineers upgrading Next.js 15 apps or starting Next.js 16 projects who need framework-specific migration and feature guidance inside their coding agent.

Skip if: Teams staying on Next.js 14 or below, or projects using non-React frameworks where Next.js 16 changes are irrelevant.

When should I use this skill?

Starting a new Next.js 16 project, migrating from Next.js 15, or debugging Cache Components, Turbopack, proxy.ts, or React Compiler configuration.

What you get

Migration plan covering Cache Components, Turbopack defaults, proxy.ts setup, React Compiler config, and updated App Router patterns.

  • Migration checklist
  • Next.js 16 configuration patterns

By the numbers

  • Covers migration from Next.js 15 to Next.js 16

Files

SKILL.mdMarkdownGitHub ↗

Next.js 16 Complete Guide

Purpose

Comprehensive reference for Next.js 16's revolutionary features: Cache Components with "use cache", stable Turbopack as default bundler, proxy.ts architecture, DevTools MCP integration, and React Compiler support.

When to Use

  • Starting new Next.js projects (use 16 from day one)
  • Migrating from Next.js 15 to 16
  • Understanding Cache Components and Partial Pre-Rendering (PPR)
  • Configuring Turbopack for optimal performance
  • Migrating middleware.ts to proxy.ts
  • Leveraging AI-assisted debugging with DevTools MCP
  • Setting up React Compiler for automatic memoization

What Changed: Next.js 15 → 16

The Big Picture

Next.js 15 was transition phase - async APIs, experimental Turbopack, changing cache defaults. Next.js 16 is the payoff - everything becomes stable, fast, and production-ready.

Key Differences

FeatureNext.js 15Next.js 16
BundlerWebpack (default), Turbopack (opt-in beta)Turbopack (default, stable)
CachingImplicit, confusing defaultsExplicit with "use cache"
Network Layermiddleware.ts (edge runtime)proxy.ts (Node.js runtime)
DevToolsBasic error messagesMCP integration for AI debugging
React CompilerExperimentalStable, production-ready
PerformanceBaseline2-5× faster builds, 10× faster Fast Refresh

---

🚀 Core Features (The 20% That Delivers 80%)

1. Cache Components + "use cache"

The Problem in Next.js 15:

  • Implicit caching was "magic" - hard to predict what cached
  • Switching between static/dynamic was unclear
  • Performance optimization felt like guesswork

The Solution in Next.js 16:

// Enable in next.config.ts
const nextConfig = {
  cacheComponents: true,
};

export default nextConfig;

Usage Pattern:

// app/dashboard/page.tsx
import { Suspense } from 'react';

// This component caches its output
async function UserMetrics() {
  'use cache'; // 🎯 Explicit caching

  const metrics = await fetchMetrics(); // Cached result

  return <MetricsCard data={metrics} />;
}

// This stays dynamic
async function LiveBalance() {
  const balance = await fetchBalance(); // Always fresh
  return <BalanceWidget balance={balance} />;
}

export default function Dashboard() {
  return (
    <div>
      <Suspense fallback={<LoadingMetrics />}>
        <UserMetrics /> {/* Cached, instant load */}
      </Suspense>

      <LiveBalance /> {/* Dynamic, real-time */}
    </div>
  );
}

Why This Matters:

  • Instant navigation - Cached parts load immediately
  • Selective freshness - Only dynamic parts fetch on demand
  • Predictable behavior - You control what caches
  • SaaS dashboards - Perfect for panels with mixed static/dynamic content

Cache Granularity:

// Cache entire page
export default async function Page() {
  'use cache';
  return <PageContent />;
}

// Cache individual component
async function ExpensiveWidget() {
  'use cache';
  return <Chart data={await getData()} />;
}

// Cache function result
async function getStats() {
  'use cache';
  return await database.query('...');
}

---

2. Turbopack: Default Bundler (Stable)

Performance Numbers (Official Vercel Benchmarks):

  • 2-5× faster production builds
  • Up to 10× faster Fast Refresh in development
  • File system caching - Even faster restarts on large projects

No Configuration Needed:

// next.config.ts
// Turbopack is now default - no config required!

Opt-out (if needed):

# Use Webpack instead
next build --webpack

File System Caching (Beta):

// next.config.ts
const nextConfig = {
  experimental: {
    turbopackFileSystemCacheForDev: true, // Faster restarts
  },
};

Why This Matters:

  • Faster feedback loop - See changes instantly (10× faster)
  • Shorter CI/CD times - 2-5× faster production builds
  • Better DX - Less waiting, more shipping
  • Large projects - Scales better than Webpack

What You Notice:

# Before (Webpack)
✓ Compiled in 4.2s

# After (Turbopack)
✓ Compiled in 0.4s  # 10× faster

---

3. proxy.ts Replaces middleware.ts

The Change:

# Old (Next.js 15)
middleware.ts  # Edge runtime, confusing

# New (Next.js 16)
proxy.ts       # Node.js runtime, explicit

Migration Example:

// OLD: middleware.ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export function middleware(request: NextRequest) {
  return NextResponse.redirect(new URL('/home', request.url));
}

export const config = {
  matcher: '/about/:path*',
};
// NEW: proxy.ts
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';

export default function proxy(request: NextRequest) {  // Changed function name
  return NextResponse.redirect(new URL('/home', request.url));
}

export const config = {
  matcher: '/about/:path*',
};

Key Changes: 1. Rename file: middleware.tsproxy.ts 2. Rename export: export function middlewareexport default function proxy 3. Runtime: Runs on Node.js (not edge)

Why This Matters:

  • Clearer boundary - "Proxy" = network entry point
  • Predictable runtime - Always Node.js, no edge ambiguity
  • Better debugging - Standard Node.js environment

---

4. DevTools MCP (AI-Assisted Debugging)

What It Does: Next.js 16 integrates Model Context Protocol (MCP) so AI agents can:

  • Read unified browser + server logs
  • Understand Next.js routing and caching
  • Access error stack traces automatically
  • Provide page-aware debugging context

Why This Matters:

  • AI copilots can debug your Next.js app natively
  • Faster debugging - AI understands framework internals
  • Better DX - Agent sees what you see (and more)

Use Case:

You: "Why is this page not caching?"
AI Agent (with MCP):
  - Reads server logs
  - Sees route configuration
  - Checks cache headers
  - Knows Next.js 16 caching rules
  → "You're missing 'use cache' directive in your component"

Integration: Works automatically with Claude Code, Cursor, and other MCP-compatible tools.

---

5. React Compiler (Stable)

What It Does: Automatically memoizes components - no more manual useMemo, useCallback, React.memo.

Setup:

npm install babel-plugin-react-compiler@latest
// next.config.ts
const nextConfig = {
  reactCompiler: true,  // Moved from experimental to stable
};

Before (Manual Optimization):

// You had to do this everywhere
const MemoizedComponent = React.memo(function Component({ data }) {
  const processed = useMemo(() => processData(data), [data]);
  const handleClick = useCallback(() => {
    console.log(processed);
  }, [processed]);

  return <div onClick={handleClick}>{processed}</div>;
});

After (React Compiler Does It):

// Just write code, compiler optimizes automatically
function Component({ data }) {
  const processed = processData(data);  // Auto-memoized
  const handleClick = () => {            // Auto-memoized
    console.log(processed);
  };

  return <div onClick={handleClick}>{processed}</div>;
}

Why This Matters:

  • Less boilerplate - Write cleaner code
  • Better performance - Compiler is smarter than manual optimization
  • No bugs - Compiler never forgets dependencies

---

🔥 Breaking Changes (15 → 16)

Required Changes

1. Node.js Version
# Minimum: Node.js 20.9+
# Next.js 15: Node.js 18 worked
# Next.js 16: Node.js 18 no longer supported
2. Async params & searchParams
// ❌ OLD (Next.js 15)
export default function Page({ params, searchParams }) {
  const id = params.id;  // Synchronous
}

// ✅ NEW (Next.js 16)
export default async function Page({ params, searchParams }) {
  const { id } = await params;  // Must await
  const { query } = await searchParams;
}
3. Async cookies(), headers(), draftMode()
// ❌ OLD
import { cookies } from 'next/headers';

export function MyComponent() {
  const token = cookies().get('token');  // Synchronous
}

// ✅ NEW
import { cookies } from 'next/headers';

export async function MyComponent() {
  const cookieStore = await cookies();  // Must await
  const token = cookieStore.get('token');
}
4. revalidateTag() Now Requires cacheLife Profile
// ❌ OLD
revalidateTag('posts');

// ✅ NEW
revalidateTag('posts', 'max');     // Options: 'max', 'hours', 'days'
5. middleware.ts → proxy.ts
# Required migration
mv middleware.ts proxy.ts

# Update function name
export default function proxy(request) { ... }

Removed Features

  • AMP support - Completely removed
  • `next lint` command - Removed
  • Node.js 18 - No longer supported
  • TypeScript <5.1 - No longer supported

---

📦 Migration Guide (Step-by-Step)

1. Pre-Migration Checklist

# Check current versions
node --version    # Should be 20.9+
npm list next     # Current Next.js version
npm list react    # React version

2. Automated Migration

# Upgrade to latest Next.js 16
npm install next@latest react@latest react-dom@latest

# Run codemod (handles most changes automatically)
npx @next/codemod@canary upgrade latest

3. Manual Changes

Update next.config:

// next.config.ts
import type { NextConfig } from 'next';

const nextConfig: NextConfig = {
  // Enable Cache Components
  cacheComponents: true,

  // Enable React Compiler
  reactCompiler: true,

  // Optional: File system caching
  experimental: {
    turbopackFileSystemCacheForDev: true,
  },
};

export default nextConfig;

Rename middleware:

# If you have middleware.ts
git mv middleware.ts proxy.ts

# Update function name in proxy.ts
export default function proxy(request: NextRequest) {
  // Your logic
}

Update async APIs:

// Search codebase for:
// - params.
// - searchParams.
// - cookies()
// - headers()
// - draftMode()

// Add await before each

4. Test Everything

# Development
npm run dev  # Should use Turbopack automatically

# Production build
npm run build  # Should be 2-5× faster

# Run tests
npm test

5. Deploy

# Verify Node.js version in production
# Deploy to Vercel/platform
# Monitor for errors in first 24h

---

🎯 Best Practices

1. Start New Projects with Next.js 16

npx create-next-app@latest my-app
# Automatically uses Next.js 16, Turbopack, TypeScript, Tailwind

2. Use "use cache" Strategically

// ✅ Good: Cache expensive, infrequent-changing data
async function MonthlyReport() {
  'use cache';
  return await generateReport();
}

// ❌ Bad: Don't cache user-specific real-time data
async function CurrentBalance() {
  'use cache';  // Wrong! This should be fresh
  return await getUserBalance();
}

3. Monitor Build Performance

# Next.js 16 shows detailed timing
npm run build

# Example output:
Route (app)                              Size     First Load JS
┌ ○ /                                   142 B          87.2 kB
├ ○ /_not-found                         142 B          87.2 kB
└ ○ /dashboard                          1.23 kB        88.4 kB

Build time: 14.2s  # Was 57s in Next.js 15 with Webpack

4. Leverage DevTools MCP

  • Use Claude Code / Cursor with MCP support
  • Let AI agent read Next.js internals
  • Ask: "Why is my page slow?" - Agent sees server logs

5. Enable React Compiler for Large Apps

// Only if you have performance issues
reactCompiler: true

---

📊 When to Upgrade (Decision Matrix)

✅ Upgrade Now If:

  • Starting new project (use 16 from day one)
  • Small/medium codebase (<50 routes)
  • Using Vercel (tested platform)
  • Want 2-5× faster builds
  • Need instant navigation (Cache Components)

⏳ Wait 1-2 Weeks If:

  • Large production app (>100 routes)
  • Heavy middleware.ts usage (needs proxy.ts migration)
  • Custom Webpack config
  • Third-party libs not yet compatible
  • Risk-averse deployment policy

🚫 Don't Upgrade Yet If:

  • Using AMP pages (removed in 16)
  • Stuck on Node.js 18 (can't upgrade)
  • Custom build pipelines (need adapter testing)
  • Experimental features in production

---

🔗 Resources

---

💡 Quick Reference

Installation

npm install next@latest react@latest react-dom@latest

Enable Features

// next.config.ts
const nextConfig = {
  cacheComponents: true,           // Cache Components
  reactCompiler: true,             // React Compiler
  experimental: {
    turbopackFileSystemCacheForDev: true,  // Faster dev restarts
  },
};

Migration Checklist

  • [ ] Node.js 20.9+ installed
  • [ ] npm install next@latest
  • [ ] Run npx @next/codemod@canary upgrade latest
  • [ ] Rename middleware.tsproxy.ts
  • [ ] Add await to params/searchParams/cookies/headers
  • [ ] Update revalidateTag() calls with cacheLife
  • [ ] Test build: npm run build
  • [ ] Test dev: npm run dev
  • [ ] Deploy to staging first

---

Summary: Next.js 16 delivers on the promises of 15 - everything is faster, more explicit, and production-ready. Turbopack is default, caching is predictable, and AI tooling is native. This is the version to build modern SaaS applications on in 2025.

Related skills

How it compares

Pick nextjs-16-complete-guide over generic React skills when the task specifically involves Next.js 16 caching, Turbopack, or v15 migration rather than general component patterns.

FAQ

What Next.js 16 features does the guide cover?

nextjs-16-complete-guide covers Cache Components with "use cache", stable Turbopack as default bundler, proxy.ts architecture, DevTools MCP integration, React Compiler support, and Partial Pre-Rendering patterns.

When should I use nextjs-16-complete-guide?

Use nextjs-16-complete-guide when starting a new Next.js 16 project or migrating from Next.js 15 and you need breaking-change guidance on caching, bundling, and App Router conventions.

Does nextjs-16-complete-guide help with upgrades?

nextjs-16-complete-guide maps migration steps from Next.js 15 to 16, including Turbopack defaults, Cache Components adoption, and proxy.ts replacements for older middleware patterns.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.