next-cache-components-adoption

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

Updated Aug 26, 2026
One-click install
npx skills add https://github.com/MohamadJoumaa/Direct --skill next-cache-components-adoption-mohamadjoumaa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: next-cache-components-adoption
Source: https://github.com/MohamadJoumaa/Direct/tree/main/.cursor/skills/next-cache-components-adoption
Command: npx skills add https://github.com/MohamadJoumaa/Direct --skill next-cache-components-adoption-mohamadjoumaa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Enabling Cache Components in a Next.js app surfaces a flood of blocking-prerender and instant-validation build errors, and fixing them route by route without a plan stalls the migration. 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 with export const instant = false, ship as one PR, then adopt feature by feature) or a direct path (fix blocking routes as the build reports them). - Guided error resolution: Classifies blockers into request-time reads (cookies(), headers(), await params), sync-IO calls (new Date(), Math.random()), and "use cache" conflicts, then applies the recipe from each error's linked docs page. - Runtime verification: Verifies each fix in a live 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, fixes sync-IO calls in shared layouts, then removes opt-outs one feature at a time until every route prerenders cleanly. ## Quick Start Enable Cache Components in my Next.js app and work through the blocking-prerender 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, confirm the build passes, then remove opt-outs feature by feature.

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

Blocking-prerender errors come from request-time reads like cookies(), headers(), or awaited params at the top of a page. Push the read into a Suspense-wrapped child component, forwarding param promises instead of awaiting them at the page top. Each error links a docs page with 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 since the flag only affects app/ routes, but a pages-only project needs a Pages-to-App migration first.

Why does the 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 instant = false because the opt-out does not suppress them. Unblock them with await connection() plus a Suspense boundary, which defers the value to request time.

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. Older versions should upgrade via npx @next/codemod@latest upgrade latest first.

When should a route keep instant = false permanently?▼

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, since undocumented leftover opt-outs are not acceptable.