cache-components
БесплатноБез исполняемых скриптовНе проверенExpert guidance for Next.js Cache Components and Partial Prerendering (PPR). Use when implementing 'use cache' directive, configuring cache lifetimes with…
от laguagu★ 75 звёзд на GitHubОб этом скилле
Cache Components
Keep the project's caching mode unless migration is requested. Confirm the
installed Next.js version and cacheComponents/partialPrefetching configuration before applying
these patterns. Use Cache Components on next 16.4.5+: 16.0.0–16.4.0 allow
unauthenticated RCE through use cache functions returning typed arrays
(GHSA-673q-mjm6-r5xr; no workaround, upgrade even without such functions), and
releases through 16.4.4 can leak or poison cached output across users
(GHSA-rhh4-g77r-r9qj binary arguments, GHSA-vvgp-ww4w-46vf shared fallback
shells, GHSA-vc7v-qv4w-wrv8 and GHSA-mfr8-8qww-v76h root params).
Flag an affected install before cache work.
Read the relevant guide in node_modules/next/dist/docs/ first (bundled since
16.2; in a monorepo, use the app's own next package). Web paths map to files
with numbered folders, so find them by name: .../functions/cacheLife is
01-app/03-api-reference/04-functions/cacheLife.md. Under 01-app/, start
with 02-guides/migrating-to-cache-components.md,
01-getting-started/08-caching.md and 02-guides/instant-navigation.md.
Error pages under /docs/messages are not bundled; next dev/next build
print the fix options inline. Without local docs, use the
official caching docs.
Exact exports and signatures are also in node_modules/next/cache.d.ts.
For static-output and staged-deferral questions in 16.4+, find the installed
ensureStatic route-segment reference and navigation/prefetch function
references by name.
The goal is a useful prerendered shell with freshness and authorization rules that remain correct after mutations, deploys and client navigation.
Facts older examples get wrong
- Next.js 16 enables the mode with top-level
cacheComponents: true. It replacesexperimental.dynamicIO,experimental.useCacheandexperimental.ppr;cacheLife/cacheTagimport fromnext/cachewithoutunstable_. In 16.4, setpartialPrefetchingexplicitly: leaving it unset warns; recommendedcreate-next-appdefaults enable both flags. - With it enabled, segment exports
dynamic,revalidate,fetchCache,dynamicParamsandruntime(even'nodejs') are errors; only the default Node.js runtime is supported.revalidate = NbecomescacheLife(nearest or custom profile) insideuse cache;force-dynamicandfetchCacheare unnecessary; fetchnext: { revalidate, tags }becomescacheLife/cacheTagin ause cachefunction; request data goes under Suspense;dynamicParams = falsebecomesnotFound()for unknown params. - Existing
fetchandunstable_cachecaching still works as a separate layer, so do not mechanically rewrite every read. Its persistence across deployments and instances depends on retained/shared storage; self-hosted instances do not share it by default.use cacheis in-memory by default; even a durable handler cannot reuse entries when the build/deployment ID changes. generateStaticParamsmust return at least one param:[]fails the build, and removing the export renders the route on every request.revalidate: 0orexpireunder 5 minutes makes a request-time hole instead of prerendered output; of the presets onlysecondsdoes. 16.3 addsstalethresholds (under 30 s: not prerendered; under 5 min: not in the App Shell).- Synchronous
new Date(),Math.random()orcrypto.randomUUID()during prerender is an error: capture it inuse cache, or defer withawait io()(next/cache, 16.3+) orawait connection()(next/server) under Suspense. use cache: privatewas experimental through 16.2. It runs at request time, stays out of the static shell and accepts no custom handler.export const instant(16.3;unstable_instantin 16.2) opts a segment into instant-navigation validation. Since 16.3, every Page/Default segment is implicitly validated innext devonly (dev overlay) at the default level; build validation requiresexperimental.instantInsights.validationLevelset toexperimental-errororexperimental-manual-error(16.2unstable_instantalso validated at build). Test navigations with@next/playwrightinstant().instant = falsepermits a blocking route; it does not clear synchronous-IO errors.
For whole-app adoption of Cache Components or Partial Prefetching, use the
official workflow skills listed in the installed 01-app/02-guides/ai-agents.md
(from vercel/next.js skills/); the bundled 02-guides/migrating-to-cache-components.md
and adopting-partial-prefetching.md cover the same steps.
Shape of one route
app/posts/page.tsx, checked against next 16.3.8 with cacheComponents: true
(tsc --noEmit, next build, the action under next start). @/lib/* is
project code.
import { Suspense } from 'react'
import { cookies } from 'next/headers'
import { cacheLife, cacheTag, updateTag } from 'next/cache'
import { insertPost,
Установить cache-components в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл cache-components?
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). Use when implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, instant navigation validation, 'use cache: private', pass-through/interleaving patterns, GET Route Handler caching, debugging cache issues, and reviewing Cache Component implementations.
Как установить скилл cache-components?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cache-components запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic