next-cache-components-adoption

Migrate a Next.js App Router project to Cache Components and resolve blocking routes.

Updated Sep 16, 2026
One-click install
npx skills add https://github.com/jasonviipers/vipers --skill next-cache-components-adoption-jasonviipers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components-adoption
Source: https://github.com/jasonviipers/vipers/tree/main/.agents/skills/next-cache-components-adoption
Command: npx skills add https://github.com/jasonviipers/vipers --skill next-cache-components-adoption-jasonviipers

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 errors across every route, and fixing them one by one without a plan stalls migrations. 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 rollout (codemod opts every route out with export const instant = false, then adopt feature-by-feature as separate PRs) or a direct single-branch migration. - Guided Error Resolution: Diagnose the three blocker classes — request-time reads (cookies(), headers(), await params), sync-IO at render time (Date.now(), Math.random()), and "use cache" files reading request data — using the docs page linked from each build or dev-overlay error. - Runtime Verification: Verify each fix in a real browser via the next-dev-loop skill, confirming the static shell renders first and <Suspense> fallbacks resolve to real content, with a build-only fallback for CI environments. - Use Case: You upgrade a Next.js 16.3+ dashboard app, set cacheComponents: true, and the build fails on 40 routes. The Skill runs the codemod to opt routes out, fixes a shared layout calling new Date(), then removes opt-outs feature-by-feature until next build passes cleanly. ## Quick Start Enable Cache Components in my Next.js app and migrate all routes until the build passes with no blocking-prerender errors.

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 build blockers like sync-IO calls, then remove opt-outs route by route until the build passes.

How to 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 in each error for the exact recipe.

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

No, Cache Components is an App Router feature only; the cacheComponents flag does nothing for pages/ routes. A hybrid app works fine since the flag affects only app/ routes, but a pages-only project requires 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 cache-components-instant-false codemod. Older versions should upgrade via npx @next/codemod@latest upgrade latest.

Why does my Next.js build fail with sync-IO errors after enabling cacheComponents?

Calls like new Date(), Date.now(), Math.random(), or crypto.randomUUID() at module or render time fail the build even with instant = false set. Locate them with next build --debug-prerender, then apply the fix from the linked error docs page.

When should I keep instant = false instead of removing it?

Keep instant = false 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. Replace the TODO comment with a documented reason so the opt-out is deliberate.