next-cache-components

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

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill next-cache-components-dsgalkar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/dsgalkar/dnyaneshwar_portfolio/tree/main/.agents/plugins/vercel/skills/next-cache-components/upstream
Command: npx skills add https://github.com/dsgalkar/dnyaneshwar_portfolio --skill next-cache-components-dsgalkar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It guides developers through Next.js 16 Cache Components so they can mix static, cached, and dynamic content in a single route using Partial Prerendering without misusing caching directives. ## Core Features & Use Cases - Partial Prerendering Setup: Enable cacheComponents in next.config.ts and structure pages into static shells, cached components, and Suspense-wrapped dynamic content. - Cache Lifetime and Tagging: Apply cacheLife profiles, cacheTag labels, and invalidate with updateTag or revalidateTag from Server Actions. - Migration Support: Convert legacy patterns like experimental.ppr, force-static, route revalidate, and unstable_cache into the use cache directive. - Use Case: When building a dashboard, keep the header static from the CDN, cache hourly stats with cacheLife('hours'), and stream fresh user notifications through Suspense. ## Quick Start Ask the assistant to refactor a Next.js page to use Cache Components with use cache, cacheLife, and Suspense boundaries.

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 and Partial Prerendering. This replaces the old experimental.ppr flag and lets routes mix static, cached, and dynamic content.

How do I use the use cache directive in Next.js?

Place 'use cache' at the top of a file, component, or async function to cache its output. Combine it with cacheLife() to control staleness and cacheTag() to label entries for later invalidation.

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. Read the value outside and pass it as an argument, or use 'use cache: private' for compliance cases.

How do I migrate unstable_cache to use cache?

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

What is the difference between updateTag and revalidateTag?

updateTag invalidates immediately so the same request sees fresh data, while revalidateTag triggers background stale-while-revalidate so the next request gets updated content. Both are called from Server Actions after a mutation.

What are the limitations of Next.js Cache Components?

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