next-cache-components

Enable Partial Prerendering in Next.js 16+ with Cache Components and caching APIs.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Next.js projects often struggle with performance when dynamic data and static content need to mix. Cache Components enables Partial Prerendering to blend static, cached, and dynamic content within a single route.

Core Features & Use Cases

  • Enable three content types: Static (instant), Cached (revalidated), and Dynamic (Suspense) within a single route.
  • Use the 'use cache' directive along with cacheLife, cacheTag, and updateTag to control caching behavior and invalidation.
  • Apply to Next.js 16+ projects to optimize rendering, data fetches, and user-perceived performance.

Quick Start

Enable cache components in your Next.js config and annotate functions with the use cache directive to start caching.

Frequently Asked Questions about next-cache-components

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

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

To blend static and dynamic content in a single Next.js route, enable Cache Components to use Partial Prerendering, serving static, cached, and dynamic content simultaneously. This approach optimizes web performance by mixing instantly served static shells with Suspense-wrapped dynamic data.

What is the use cache directive in Next.js 16+?

The 'use cache' directive in Next.js 16+ is an annotation that marks specific functions or components for caching. It enables Partial Prerendering by allowing developers to define cache lifetimes and invalidation strategies directly within the code block.

How do I control cache invalidation in Next.js server components?

You control cache invalidation in Next.js server components using the cacheTag and updateTag APIs. By assigning cacheTag to cached data, you can selectively invalidate and update specific cached entries without clearing the entire route cache.

Does Next.js Partial Prerendering support fine-grained cache lifetimes?

Yes, Next.js Partial Prerendering supports fine-grained cache lifetimes through the cacheLife API. This allows you to specify exact revalidation durations for cached content, ensuring dynamic data fetches balance freshness with web performance.

How do I enable Cache Components in a Next.js project?

To enable Cache Components in a Next.js project, you must enable the cacheComponents flag in your next.config.ts file. Once enabled, you can annotate functions with the 'use cache' directive to start caching data and optimizing route rendering.

When should I use Partial Prerendering instead of fully dynamic rendering?

Use Partial Prerendering instead of fully dynamic rendering when your route mixes static content with dynamic data that can be cached. It solves performance struggles by serving an instant static shell while fetching dynamic content in the background via Suspense.