next-cache-components

Enable Partial Prerendering in Next.js routes using cache components.

Updated Nov 16, 2025
One-click install
npx skills add https://github.com/daniel-dihardja/menuyukti --skill next-cache-components-daniel-dihardja
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/daniel-dihardja/menuyukti/tree/main/.agents/skills/next-cache-components
Command: npx skills add https://github.com/daniel-dihardja/menuyukti --skill next-cache-components-daniel-dihardja

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cache Components solve the challenge of balancing static, cached, and dynamic content in Next.js routes by enabling selective prerendering and on-demand updates.

Core Features & Use Cases

  • Enable partial prerendering by categorizing content as Static, Cached, or Dynamic and combining them in a single route.
  • Use the 'use cache' directive along with cacheLife, cacheTag, and updateTag to control revalidation, invalidation, and cache scopes.
  • Easily migrate from older Next.js flags and ensure safe runtime constraints while retaining data freshness.

Quick Start

Enable Cache Components in next.config.ts with cacheComponents: true and start annotating components with the 'use cache' directive to enable automatic 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 enable partial prerendering in Next.js to balance static and dynamic content?

Enable partial prerendering in Next.js by setting cacheComponents: true in next.config.ts and annotating components with the 'use cache' directive. This categorizes content as static, cached, or dynamic to balance pre-rendered shells with data-driven sections.

How do I use the 'use cache' directive with cacheLife and cacheTag in Next.js?

The 'use cache' directive controls caching in Next.js, while cacheLife manages revalidation times and cacheTag handles on-demand invalidation. Use them together with updateTag to selectively prerender routes and ensure data freshness without overloading the server.

What is the best way to migrate older Next.js caching flags to cache components?

Migrate from older Next.js flags by enabling cacheComponents: true in your next.config.ts file. This approach ensures safe runtime constraints while allowing you to apply 'use cache', cacheLife, and cacheTag for selective prerendering and on-demand updates.

Can I mix prerendered shells with data-driven sections in a single Next.js route?

Yes, you can mix prerendered shells with data-driven sections in a single Next.js route. By categorizing content as static, cached, or dynamic and applying cache components, you improve perceived performance and reduce server load automatically.

Why does my Next.js route need cache components for on-demand data updates?

Cache components are needed to solve the challenge of balancing static and dynamic content. They enable on-demand updates using updateTag and cacheTag, allowing you to control revalidation, invalidation, and cache scopes while retaining data freshness.