next-cache-components

Implements Next.js 16 Cache Components with use cache, cacheLife, and cacheTag directives.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Alwahdi/mikrotik-whisperer --skill next-cache-components-alwahdi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/Alwahdi/mikrotik-whisperer/tree/main/.agents/skills/next-cache-components
Command: npx skills add https://github.com/Alwahdi/mikrotik-whisperer --skill next-cache-components-alwahdi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It guides developers through Next.js 16 Cache Components, replacing legacy caching APIs like unstable_cache and experimental.ppr with the new use cache directive model for Partial Prerendering. ## Core Features & Use Cases - Partial Prerendering Setup: Enable cacheComponents in next.config.ts and mix static, cached, and dynamic content in one route. - Cache Control APIs: Apply use cache at file, component, or function level with cacheLife profiles and cacheTag invalidation via updateTag or revalidateTag. - Migration Guidance: Convert unstable_cache, force-static, and revalidate exports to the new directive-based model. - Use Case: When building a dashboard that needs an instant static shell, hourly-cached stats, and fresh per-user notifications, this Skill shows exactly how to structure the components and where runtime APIs like cookies() are allowed. ## Quick Start Ask the AI to convert a Next.js page to use Cache Components with use cache, cacheLife, and cacheTag for cached data and Suspense for dynamic content.

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 next.config.ts to enable Cache Components, which replaces the old experimental.ppr flag. Routes can then mix static, cached, and dynamic content in a single page.

How do I migrate from unstable_cache to use cache?

Replace unstable_cache wrappers with a function containing the 'use cache' directive, move options.tags into cacheTag() calls, and convert options.revalidate into cacheLife({ revalidate: N }). Manual keyParts arrays are no longer needed because cache keys derive 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 output must be request-independent. Extract the value outside and pass it as an argument, or use 'use cache: private' when compliance requires runtime access.

What is the difference between updateTag and revalidateTag in Next.js?

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 after mutations needing instant consistency.

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

No, Cache Components require the Node.js runtime and a server; Edge runtime and static export are not supported. Non-deterministic values like Math.random() inside use cache also execute only once at build time.