next-cache-components

Enable selective caching with Cache Components in Next.js apps.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/kyamsSRL/TinyCopro --skill next-cache-components-kyamssrl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/kyamsSRL/TinyCopro/tree/main/.claude/skills/next-cache-components
Command: npx skills add https://github.com/kyamsSRL/TinyCopro --skill next-cache-components-kyamssrl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache Components enable Partial Prerendering (PPR) - mix static, cached, and dynamic content in a single route.

Core Features & Use Cases

Three content types: Static content prerenders at build time; Cached blocks use the 'use cache' directive and cacheLife; Dynamic sections use React Suspense for streaming fresh data.

Quick Start

Enable cache components in next.config.ts and annotate data-fetching with 'use cache'.

Frequently Asked Questions about next-cache-components

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

FAQPage Schema
How do I mix static and dynamic content in a single Next.js route?

Cache Components enable Partial Prerendering in Next.js to mix static and dynamic content in a single route. Static content prerenders at build time, while dynamic sections stream via React Suspense.

What is the 'use cache' directive in Next.js used for?

The 'use cache' directive in Next.js is used to create cached blocks for data fetching. It works with cacheLife to apply selective caching and predictable revalidation for pages mixing static and dynamic data.

How do I configure cache components in next.config.ts?

Configuring cache components in next.config.ts involves enabling the cacheComponents setting. You then annotate data-fetching functions with the 'use cache' directive to activate selective caching.

Can I use cacheLife and cacheTag inside server actions and API routes?

Yes, cacheLife and cacheTag can be used inside server actions, API routes, and components. This enables selective caching and predictable revalidation while respecting runtime data constraints.

When should I avoid using Cache Components for data fetching?

Avoid using Cache Components for data fetching when your application cannot respect runtime data constraints. They are designed for pages needing predictable revalidation rather than purely dynamic real-time data.

Does Next.js Partial Prerendering work with React Suspense for fresh data?

Yes, Next.js Partial Prerendering works with React Suspense to stream fresh data. It separates static content from dynamic sections, ensuring cached blocks use 'use cache' while dynamic areas fetch fresh data.