next-cache-components-adoption

Migrates Next.js App Router projects to Cache Components and resolves blocking-prerender errors.

4|Updated Jul 13, 2024
One-click install
npx skills add https://github.com/PunGrumpy/og-tester --skill next-cache-components-adoption-pungrumpy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components-adoption
Source: https://github.com/PunGrumpy/og-tester/tree/main/.agents/skills/next-cache-components-adoption
Command: npx skills add https://github.com/PunGrumpy/og-tester --skill next-cache-components-adoption-pungrumpy

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Enabling Cache Components in a Next.js app floods the build with blocking-prerender and instant-validation errors, and developers lack a structured path to fix every route without breaking runtime behavior. ## Core Features & Use Cases - Guided adoption workflow: Sequences the migration from flipping the cacheComponents flag through a per-route fix loop verified against next dev and next build. - Codemod orchestration: Runs the cache-components-instant-false codemod to opt routes out of validation, then removes opt-outs feature by feature as reviewable PRs. - Error-driven fixes: Translates dynamic, revalidate, and fetchCache exports, fixes sync-IO calls like Date.now(), and applies the official docs recipe behind each /docs/messages/ error link. - Use Case: A team upgrades to Next.js 16.3, enables Cache Components, and uses this Skill to turn 40 failing routes into a passing build with partial prerendering, shipped as small reviewable PRs. ## Quick Start Enable Cache Components in my Next.js app and walk every route to a passing build, fixing each blocking-prerender error as it surfaces.

Frequently Asked Questions about next-cache-components-adoption

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable Cache Components in a Next.js app?

Set cacheComponents: true in next.config, then fix the blocking routes the build surfaces. The cache-components-instant-false codemod can opt every page and layout out of validation first so the build passes before you adopt routes one at a time.

How do I fix blocking-prerender errors in Next.js?

Each blocking-prerender error links to a docs page at nextjs.org/docs/messages with the canonical fix recipe. Common fixes push request-time reads like cookies(), headers(), params, and searchParams into Suspense-wrapped child components.

Does Cache Components work with the Next.js Pages Router?

No, Cache Components is an App Router feature and the cacheComponents flag does nothing for pages/ routes. A hybrid app works fine since the flag only affects app/ routes, but a pages-only project needs a Pages-to-App migration first.

What Next.js version is required for Cache Components?

Next.js 16.3 or later is required, since that release adds top-level cacheComponents, export const instant, dev-overlay validation warnings, and the instant-false codemod. Older versions should upgrade via npx @next/codemod@latest upgrade latest.

Why does my build still fail after adding instant = false?

Sync-IO calls like new Date(), Date.now(), Math.random(), and crypto.randomUUID() fail the build even with the opt-out. Fix them with the await connection() plus Suspense pattern from the error's docs page, and check shared layouts that block every route.

When should I keep instant = false instead of fixing a route?

Keep it when a route is genuinely per-request with no useful static shell, such as a fully request-time dashboard, or when the refactor is too large for now. Confirm with the user and replace the TODO comment with a documented reason.