next-cache-components-adoption

Enables Cache Components in Next.js apps and resolves blocking-prerender routes to a passing build.

Updated Jun 27, 2026
One-click install
npx skills add https://github.com/rachmadideni/ai-staff-assistant --skill next-cache-components-adoption-rachmadideni
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: next-cache-components-adoption
Source: https://github.com/rachmadideni/ai-staff-assistant/tree/main/.agents/skills/next-cache-components-adoption
Command: npx skills add https://github.com/rachmadideni/ai-staff-assistant --skill next-cache-components-adoption-rachmadideni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Turning on the cacheComponents flag in a Next.js App Router project 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: enabling the flag, running the opt-out codemod, and walking each route to a clean dev overlay and passing build. ## Core Features & Use Cases - Strategy selection: Choose between an incremental path (codemod opts every route out with export const instant = false, ship that PR, then adopt feature by feature) or a direct path (fix whatever the build flags first). - Blocker diagnosis and fixes: Handles the three blocker classes — request-time reads (cookies(), headers(), await params/searchParams), sync-IO calls (new Date(), Math.random()), and misused "use cache" files — using the official per-error docs recipes. - Runtime verification: Verifies each fix in a real browser via the next-dev-loop skill, with build-only and manual fallbacks, and confirms the static shell versus streamed content split. - Use Case: You upgrade a Next.js 16.3 app, flip cacheComponents: true, and the build fails on 30 routes. The Skill runs the cache-components-instant-false codemod, gets the build green as its own PR, then removes opt-outs feature by feature until no TODO: Cache Components adoption comments remain. ## Quick Start Enable Cache Components in my Next.js app and work through every blocking route 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 your Next.js config on version 16.3 or later, then resolve the blocking routes the flag surfaces. The incremental approach runs the cache-components-instant-false codemod to opt every page and layout out first, then removes opt-outs feature by feature.

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

Blocking-prerender errors come from request-time reads like cookies(), headers(), await params, or await searchParams 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 the cache-components-instant-false codemod fail to run?▼

The codemod refuses to run on a dirty working tree, so commit or stash changes first or pass --force. It also requires the @canary channel of @next/codemod, since the transform is not in the stable @latest release.

Why does my Next.js build still fail with instant = false set?▼

Sync-IO calls like new Date(), Date.now(), Math.random(), and crypto.randomUUID() fail the build even with the opt-out. Cache stable values with "use cache" or wrap per-request values in await connection() plus a Suspense boundary.

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, or when the refactor is too large for now. Confirm with the user and replace the TODO comment with a documented reason, since undocumented leftover opt-outs are not acceptable.