Claude-skill-registry Next.js Caching Architecture
The 4 layers of caching (Memoization, Data Cache, Full Route, Router Cache).
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/caching-hoangnguyen0403-agent-skills-standar" ~/.claude/skills/majiayu000-claude-skill-registry-next-js-caching-architecture && rm -rf "$T"
manifest:
skills/data/caching-hoangnguyen0403-agent-skills-standar/SKILL.mdsource content
Caching Architecture
Priority: P1 (HIGH)
Next.js has 4 distinct caching layers. Understanding them prevents stale data bugs.
Modern Standard: Cache Components (Next.js 16+)
[!IMPORTANT] Next.js 16 favors the
directive over'use cache'. Wrap dynamic runtime data inunstable_cache.<Suspense>
Core Protocol
- Dynamic Shell: Keep layouts static or cached; use
for user-specific data.<Suspense> - Deterministic Cache: Add
and'use cache'
to server functions.cacheLife() - Invalidation:
: Immediate sync reflect.updateTag()
: Background refresh (SWR).revalidateTag()
The 4 Caching Layers
| Layer | Where | Control |
|---|---|---|
| Request Memoization | Server | React |
| Data Cache | Server | , |
| Full Route Cache | Server | Static Prerendering |
| Router Cache | Client | |
Implementation Details
See Cache Components & PPR for detailed key generation, closure constraints, and invalidation strategies.