next-cache-components

Implements Next.js 16 Cache Components with use cache, cacheLife, and cacheTag for Partial Prerendering.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/ebecerra-developer/ebecerra-web --skill next-cache-components-ebecerra-developer
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/ebecerra-developer/ebecerra-web/tree/main/.agents/skills/next-cache-components
Command: npx skills add https://github.com/ebecerra-developer/ebecerra-web --skill next-cache-components-ebecerra-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Next.js 16 replaced the old caching model (experimental.ppr, unstable_cache, route segment config) with Cache Components, and developers need clear guidance on mixing static, cached, and dynamic content in a single route without hitting runtime API restrictions. ## Core Features & Use Cases - Partial Prerendering Setup: Enable cacheComponents in next.config and structure pages with static shells, cached components, and Suspense-wrapped dynamic content. - Cache Control APIs: Apply the use cache directive at file, component, or function level with cacheLife profiles and cacheTag-based invalidation via updateTag and revalidateTag. - Migration Guidance: Convert legacy patterns like unstable_cache, force-dynamic, and revalidate exports to the new directive-based model. - Use Case: A dashboard page renders its header and navigation statically from the CDN, serves hourly-cached stats with cacheTag('dashboard-stats'), and streams per-user notifications through a Suspense boundary. ## Quick Start Show me how to enable Cache Components in my Next.js 16 app and refactor my page to use the use cache directive with proper cacheLife and cacheTag configuration.

Frequently Asked Questions about next-cache-components

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

FAQPage Schema
How do I enable Partial Prerendering in Next.js 16?▼

Set cacheComponents: true in your next.config file, which replaces the old experimental.ppr flag. Once enabled, routes can mix static prerendered content, use cache components, and Suspense-wrapped dynamic content.

How to migrate from unstable_cache to use cache in Next.js?▼

Replace the unstable_cache wrapper with a function containing the 'use cache' directive. Move options.tags into cacheTag() calls and options.revalidate into cacheLife({ revalidate: N }); manual keyParts arrays are no longer needed since cache keys generate automatically from arguments and closures.

Why can't I use cookies() inside use cache?▼

Runtime APIs like cookies(), headers(), and searchParams are not allowed inside use cache because cached content must be request-independent. Extract the value outside the cached function and pass it as an argument, or use the 'use cache: private' profile for compliance cases.

What is the difference between updateTag and revalidateTag?▼

updateTag invalidates a cache tag immediately so the same request sees fresh data, while revalidateTag triggers background revalidation with stale-while-revalidate behavior. Use updateTag for read-your-own-writes scenarios in Server Actions.

Does Next.js Cache Components work with Edge runtime or static export?▼

No, Cache Components require the Node.js runtime and do not support Edge runtime or static export. Non-deterministic values like Math.random() inside use cache also execute once at build time, so use connection() for request-time randomness.