next-cache-components

Implement Partial Prerendering in Next.js 16+ using Cache Components.

148|39|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/usenotra/notra --skill next-cache-components
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/usenotra/notra/tree/main/.agents/skills/next-cache-components
Command: npx skills add https://github.com/usenotra/notra --skill next-cache-components

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Next.js Cache Components enables precise partial prerendering by combining static, cached, and dynamic content in a single route, reducing server load and improving response times.

Core Features & Use Cases

  • Enable cache components globally via next.config.ts (cacheComponents: true)
  • Use 'use cache' directive at file, component, or function level with optional cacheLife, cacheTag, and updateTag for fine-grained invalidation
  • Support three content types: Static, Cached, Dynamic for varied UX scenarios (static shell, cached data, realtime updates)
  • Use cases include dashboards, e-commerce product lists, and user-specific pages needing fresh data without full re-render

Quick Start

Enable cache components in a Next.js project by setting cacheComponents: true in next.config.ts, then annotate your components or functions with 'use cache' and optionally apply cacheLife and cacheTag to control caching behavior. Build and run the app to verify partial prerendering performance.

Frequently Asked Questions about next-cache-components

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

FAQPage Schema
How do I implement Partial Prerendering in Next.js to combine static and dynamic content?

Partial Prerendering in Next.js combines static, cached, and dynamic content in a single route by enabling cacheComponents in next.config.ts and using the 'use cache' directive to reduce server load and improve response times.

What is the 'use cache' directive in Next.js and how does it work?

The 'use cache' directive in Next.js annotates file, component, or function levels for precise caching. It supports optional cacheLife and cacheTag to control caching behavior and enable fine-grained invalidation across varied content types.

Do I need Next.js 16 to use Cache Components and the 'use cache' directive?

Yes, using Cache Components and the 'use cache' directive requires a Next.js 16+ project. You must also configure next.config.ts with cacheComponents set to true to enable partial prerendering capabilities globally.

How do I invalidate cached data in Next.js Cache Components?

You invalidate cached data in Next.js Cache Components by using cacheTag to label cached entries and updateTag to trigger invalidation. This allows fine-grained control over cached content updates without needing a full re-render.

What are the best use cases for Next.js Cache Components and Partial Prerendering?

Best use cases for Next.js Cache Components include dashboards, e-commerce product lists, and user-specific pages. These scenarios benefit from combining static shells with cached data and realtime updates without full server re-renders.