next-cache-components-adoption

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

1|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/Ech0xff/personal-site --skill next-cache-components-adoption-ech0xff
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components-adoption
Source: https://github.com/Ech0xff/personal-site/tree/main/.agents/skills/next-cache-components-adoption
Command: npx skills add https://github.com/Ech0xff/personal-site --skill next-cache-components-adoption-ech0xff

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 fixing them route by route without a plan is slow and error-prone. This Skill sequences the entire adoption: flipping the cacheComponents flag, running the cache-components-instant-false codemod, and walking the route tree until the build passes. ## Core Features & Use Cases - Strategy selection: Choose between an incremental path (codemod opts every route out first, then adopt feature-by-feature as separate PRs) or a direct path (fix whatever the build flags first). - Guided error resolution: Diagnose the three blocker classes — request-time reads (cookies(), headers(), await params), sync-IO calls (Date.now(), Math.random()), and "use cache" files reading request data — using the docs page linked from each error. - Runtime verification: Verify each fix in a real browser via the next-dev-loop skill, confirming the static shell renders and <Suspense> fallbacks resolve, not just that the build passes. - Use Case: You upgrade a Next.js 16.3+ app, set cacheComponents: true, and the build fails on dozens of routes. The Skill runs the codemod to opt routes out, fixes sync-IO blockers in shared layouts, then removes opt-outs one feature at a time until every route is a clean partial prerender. ## Quick Start Enable Cache Components in my Next.js app and work through the blocking-route errors until the build passes.

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 run npx @next/codemod@latest cache-components-instant-false ./app to opt every page and layout out of validation. Fix remaining sync-IO blockers the codemod cannot handle, then remove opt-outs route by route until the build passes.

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

Blocking-prerender errors come from request-time reads like cookies(), headers(), or awaited params outside a Suspense boundary. Push the read into a Suspense-wrapped child component, and follow the docs page linked from each error for the exact recipe.

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: the flag affects app/ routes while pages/ routes are unaffected and need no opt-outs.

Why does my Next.js build fail after enabling cacheComponents?

The build fails on routes that read request-time data outside Suspense, on sync-IO calls like Date.now() or Math.random() at render time, and on leftover dynamic, revalidate, or fetchCache exports. Translate legacy exports to their Cache Components equivalents rather than deleting them.

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 cache-components-instant-false codemod. Upgrade first with npx @next/codemod@latest upgrade latest.

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

Keep instant = false when a route is genuinely per-request with no useful static shell, or when the refactor is too large to take on now. Confirm the decision with the user and replace the TODO comment with a documented reason for the block.