cache-components

cache-components is a skill for Claude Code from laguagu/claude-code-nextjs-skills. It costs 95 tokens per session (3,571 once invoked), scanned A, original, MIT.

A guide for caching parts of a Next.js application and sending only changing content dynamically; this is called Partial Prerendering.

In plain words
What is it for?
Use it with Next.js Cache Components to define cached data, set cache lifetimes, label and invalidate cached results, and separate static page parts from dynamic ones.
Why use it?
It helps pages reuse stable results while still updating dynamic data, reducing unnecessary work and improving response behavior.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the claude-code-nextjs-skills plugin — 24 skills, 2 agents, 2 MCP servers shipped together

Good fit Use it with Next.js Cache Components to define cached data, set cache…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laguagu/claude-code-nextjs-skills/cache-components
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laguagu/claude-code-nextjs-skills --skill cache-components
Clone the repo
git clone --depth 1 https://github.com/laguagu/claude-code-nextjs-skills

Made for: Claude Code.

Or install claude-code-nextjs-skills, the plugin that ships this one along with the rest of its 24 skills, 2 agents, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cache-components

README.md
[![agentmods](https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/cache-components.svg)](https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/cache-components)
Your own site
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/cache-components"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/cache-components.svg" alt="Measured on agentmods" height="20"></a>
Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,571 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00095 $0.03571
Opus 5 $0.00048 $0.01785
Sonnet 5 $0.00019 $0.00714
Haiku 4.5 $0.00010 $0.00357

Measured 3d ago against content hash 3658fc1b3e98, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

cache-components scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

return fetch(url).then((r) => r.json())
skills/cache-components/SKILL.md · 450 lines

How it starts

The opening of the file, as written. The whole thing — 450 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Next.js Cache Components

Auto-activation: Activate this skill automatically in Next.js projects that have cacheComponents: true in next.config.ts/next.config.js. When detected, apply Cache Components patterns to all Server Component authoring, data fetching, and caching decisions.

Project Detection

When starting work in a Next.js project, check if Cache Components are enabled:

# Check next.config.ts or next.config.js for cacheComponents
grep -r "cacheComponents" next.config.* 2>/dev/null

If cacheComponents: true is found, apply this skill's patterns proactively when:

  • Writing React Server Components
  • Implementing data fetching
  • Creating Server Actions with mutations
  • Optimizing page performance
  • Reviewing existing component code

Cache Components enable Partial Prerendering (PPR) - mixing static HTML shells with dynamic streaming content for optimal performance. Cache Components also enable state preservation during navigation with React's <Activity> component, which can keep cached component trees mounted but hidden.

Philosophy: Code Over Configuration

Cache Components represents a shift from segment configuration to compositional code:

Before (Deprecated) After (Cache Components)
export const revalidate = 3600 cacheLife('hours') inside 'use cache'
export const dynamic = 'force-static' Use 'use cache' and Suspense boundaries
All-or-nothing static/dynamic Granular: static shell + cached + dynamic

Key Principle: Components co-locate their caching, not just their data. Next.js provides build-time feedback to guide you toward optimal patterns.

Core Concept

┌─────────────────────────────────────────────────────┐
│                   Static Shell                       │
│  (Sent immediately to browser)                       │
│                                                      │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  │
│  │   Header    │  │  Cached     │  │  Suspense   │  │
│  │  (static)   │  │  Content    │  │  Fallback   │  │
│  └─────────────┘  └─────────────┘  └──────┬──────┘  │
│                                           │         │
│                                    ┌──────▼──────┐  │
│                                    │  Dynamic    │  │
│                                    │  (streams)  │  │
│                                    └─────────────┘  │
└─────────────────────────────────────────────────────┘

Read the full file on GitHub · 450 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago Changed · +2 lines 3658fc1b3e98
  2. 7d ago First seen · 448 lines · 95 tokens per session scan A c20fa5734883

Subscribe to this mod's changes

cache-components is a skill published in the GitHub repository laguagu/claude-code-nextjs-skills (62 stars, last pushed 4d ago), licensed MIT. It adds 95 tokens to every session and 3,571 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

migrate-radix-to-base

Migrates React projects and components from Radix UI to Base UI. Use when asked to migrate from radix, move to base-ui, convert radix primitives, or switch a shadcn project's base library. Handles single components ("migrate accordion") and whole projects.

shadcn-ui/ui · 61 tokens

a2ui-renderer

Render A2UI (Agent-to-UI declarative surfaces) in CopilotKit v2. Enable the runtime via CopilotRuntime({ a2ui: {...} }), then enable the provider via . Auto-activates via /info — do NOT manually pass renderActivityMessages. createA2UIMessageRenderer ships from @copilotkit/react-core/v2; low-level primitives…

CopilotKit/CopilotKit · 175 tokens

copilotkit-develop

Use when building AI-powered features with CopilotKit v2 -- adding chat interfaces, registering frontend tools, sharing application context with agents, handling agent interrupts, and working with the CopilotKit runtime.

CopilotKit/CopilotKit · 46 tokens

copilotkit-integrations

Use when wiring an external agent framework (LangGraph, CrewAI, PydanticAI, Mastra, ADK, LlamaIndex, Agno, Strands, Microsoft Agent Framework, or others) into a CopilotKit application via the AG-UI protocol.

CopilotKit/CopilotKit · 61 tokens

copilotkit-upgrade

Use when migrating a CopilotKit v1 application to v2 -- updating package imports, replacing deprecated hooks and components, switching from GraphQL runtime to AG-UI protocol runtime, and resolving breaking API changes.

CopilotKit/CopilotKit · 48 tokens

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens