next-cache-components

Automate partial prerendering in Next.js apps using Cache Components to mix static, cached, and dynamic content.

1|Updated Sep 8, 2010
One-click install
npx skills add https://github.com/Nivl/melvin.la --skill next-cache-components-nivl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: next-cache-components
Source: https://github.com/Nivl/melvin.la/tree/main/.agents/skills/next-cache-components
Command: npx skills add https://github.com/Nivl/melvin.la --skill next-cache-components-nivl

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

  • Enable Partial Prerendering and mix content types: Static, Cached, Dynamic.
  • Use the 'use cache' directive, cacheLife, cacheTag, and updateTag to control lifetimes and invalidation.
  • Apply to Next.js 16+ routes to optimize latency and data freshness.

Quick Start

Enable Cache Components in your Next.js 16+ project and apply the 'use cache' directive to progressively render static, cached, and dynamic sections.

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?

Partial Prerendering in Next.js mixes static, cached, and dynamic content in a single route. You apply the 'use cache' directive to wrap specific components, enabling fast initial rendering with cached data alongside dynamic sections.

What is the best way to control cache lifetime and invalidation in Next.js 16+?

Use cacheLife to control cache lifetimes and cacheTag with updateTag to manage invalidation and revalidation. These allow you to precisely control how cached sections behave when leveraging Next.js 16+ Cache Components.

How does the 'use cache' directive work for Partial Prerendering?

The 'use cache' directive marks specific components for caching during Partial Prerendering. This allows Next.js to progressively render static and cached sections instantly while deferring dynamic data fetches for later execution.

Do I need Next.js 16+ to use Cache Components and PPR?

Yes, Cache Components and Partial Prerendering apply to Next.js 16+ projects. You must enable Cache Components in your configuration before applying the 'use cache' directive to optimize latency and data freshness.

When should I use Partial Prerendering in my web application?

Use Partial Prerendering for routes requiring fast initial rendering with cached data and occasional dynamic updates. It is ideal for dashboards, feeds, and personalized sections where mixing static and dynamic content improves latency.

Why are my Next.js cached components not revalidating with updateTag?

Cache invalidation relies on properly assigning cacheTag to cached sections and triggering updates with updateTag. Ensure your Next.js 16+ project has Cache Components enabled to utilize these mechanisms for revalidation.