cache-components

Implement and optimize Next.js Cache Components with Partial Prerendering and streaming content.

Updated Jan 16, 2026
One-click install
npx skills add https://github.com/GofiveCorp/pegasussio --skill cache-components-gofivecorp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cache-components
Source: https://github.com/GofiveCorp/pegasussio/tree/main/.agent/skills/cache-components
Command: npx skills add https://github.com/GofiveCorp/pegasussio --skill cache-components-gofivecorp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides developers to implement and optimize Next.js Cache Components with Partial Prerendering, enabling static shells with streaming content for faster pages.

Core Features & Use Cases

  • Proactive activation when cacheComponents is true in next.config.ts/next.config.js.
  • Guidance on writing data-fetching components with 'use cache', configuring cacheLife, cacheTag, and invalidation with updateTag and revalidateTag.
  • Best practices for Suspense boundaries, generateStaticParams subshells, and debugging common pitfalls.

Quick Start

  1. Enable cacheComponents: true in next.config.ts or next.config.js.
  2. Identify components that can be cached, wrap them with 'use cache' and Suspense boundaries.
  3. Use cacheLife to set durations, cacheTag to label caches, and updateTag/revalidateTag after mutations.

Frequently Asked Questions about cache-components

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

FAQPage Schema
How do I enable Next.js Cache Components for Partial Prerendering?

To enable Next.js Cache Components, set cacheComponents: true in your next.config.ts or next.config.js file. This activates Partial Prerendering, allowing you to build static page shells with streaming content for faster page loads.

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

The 'use cache' directive in Next.js marks specific components as cacheable. When combined with cacheComponents: true, it allows you to define data-fetching components that generate static shells and stream dynamic content.

How do I invalidate cached Next.js components after a data mutation?

To invalidate cached Next.js components after a data mutation, use updateTag or revalidateTag. You must first label your caches with cacheTag when defining the component, then trigger the invalidation strategy.

How does Suspense work with Next.js Cache Components?

Suspense boundaries wrap cacheable components in Next.js to separate static shells from streaming content. This pattern enables Partial Prerendering, ensuring users see the static page immediately while dynamic data loads asynchronously.

Can I set custom cache durations for Next.js Cache Components?

Yes, you can set custom cache durations for Next.js Cache Components using the cacheLife directive. This allows precise control over how long specific components or data-fetching patterns remain cached before requiring revalidation.

Why are my Next.js Cache Components not prerendering correctly?

Next.js Cache Components may fail to prerender if Suspense boundaries or generateStaticParams subshells are misconfigured. Use runtime diagnostics to identify common pitfalls and verify your cacheLife and cacheTag directives are applied correctly.