sanity-live-cache-components
БесплатноБез исполняемых скриптовНе проверенIntegrates Sanity Live with Next.js Cache Components in next-sanity v13+ apps. Sets up sanityFetch, a shared cachedSanity 'use cache' boundary, <SanityLive>…
от sanity-io★ 955 звёзд на GitHubОб этом скилле
Sanity Live + Cache Components
Wires next-sanity into a Next.js 16+ app with cacheComponents: true. Data is fetched with sanityFetch through a single shared 'use cache' boundary (cachedSanity), and <SanityLive> in the root layout revalidates cached content over an EventSource connection to Sanity Content Lake. Visual Editing and Presentation Tool are fully supported when draft mode is enabled.
Read the relevant guide in node_modules/next/dist/docs/ (when available) before writing code. If a guide conflicts with this skill, follow this skill.
This skill assumes familiarity with Cache Components fundamentals — 'use cache', cacheLife, cacheTag, and the cookies/headers/params rule — covered by the Cache Components guide (bundled offline under node_modules/next/dist/docs/). The only Sanity-relevant exception: await draftMode() is allowed inside 'use cache' (Next.js bypasses caching when draft mode is enabled — see the use cache reference).
Where this skill fits
Next.js ships official skills for the framework-generic workflows (see Setting up your project for AI coding agents). This skill covers only the Sanity surface and defers everything else to them. Install them from the Next.js repository:
npx skills add vercel/next.js --skill next-dev-loop
npx skills add vercel/next.js --skill next-cache-components-adoption
npx skills add vercel/next.js --skill next-cache-components-optimizer
npx skills add vercel/next.js --skill next-partial-prefetching-adoption
When their rules apply — blocking-route triage, <Suspense> placement, loading-UI reuse, instant() regression tests, link prefetch audits — follow them; don't re-derive that guidance from here.
Recommended sequence when migrating an app:
next-cache-components-adoption— enablescacheComponents: trueand works the app to a passing build, route by route. Tell it to leave the Sanity surface to this skill:Adopt Cache Components in this project using the next-cache-components-adoption Skill. Defer draft mode handling and every
sanityFetch/<SanityLive>call site to the sanity-live-cache-components skill: leave those routes opted out (export const instant = false) rather than refactoring the Sanity data fetching.This skill — set up
defineLiveand thelive.tshelpers, refactorsanityFetchcall sites to sourceperspective/stegacorrectly, wire<SanityLive>/<VisualEditing>and draft mode, then remove the remaining opt-outs on the deferred Sanity routes. Use the adoption skill's per-route loop and success bar for that removal (dev overlay clean, browser-verified,next buildpasses) — this skill supplies the Sanity-specific fixes, the loop mechanics are the adoption skill's.Either or both, optional follow-ups:
next-cache-components-optimizer— grows a route's static shell and guards it with an@next/playwrightinstant()test. Prompt: "Make the navigation to/<route>instant using the next-cache-components-optimizer Skill."next-partial-prefetching-adoption— enablespartialPrefetchingand audits<Link prefetch={true}>usage. Prompt: "Adopt Partial Prefetching in this project using the next-partial-prefetching-adoption Skill."
Nothing in this skill blocks either one: the three-layer pattern keeps routes fully prerenderable in the published branch, which is exactly the shell those skills grow and prefetch. Sanity content cached via
cachedSanityalso satisfies the "cached URL-dependent content" requirement for runtime prefetching.
Throughout all of it, verify changes at runtime with next-dev-loop — a passing compile doesn't prove what ended up in the static shell versus streamed.
Prerequisites
- Next.js 16.3+ installed in the project (check
package.jsonor runpnpm list next/npm ls next— don't usepnpm view next version, that reports the registry's latest, not what's installed).next-sanityv13 supports Next.js 16, but the official skills this skill sequences with require 16.3+. AGENTS.mdexists. On Next.js 16.3+,next devauto-generates it (pointing agents at the bundled docs); on older versions follow the guide.- These environment variables are set:
NEXT_PUBLIC_SANITY_PROJECT_ID- `NEXT_PUBLIC_SANITY_D
Установить sanity-live-cache-components в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sanity-live-cache-components?
Integrates Sanity Live with Next.js Cache Components in next-sanity v13+ apps. Sets up sanityFetch, a shared cachedSanity 'use cache' boundary, <SanityLive>, Visual Editing, Presentation Tool, draft mode handling, and the three-layer (Page/Dynamic/Cached) component pattern with explicit perspective/stega prop-drilling. Sequences with the official Next.js skills (next-cache-components-adoption, next-cache-components-optimizer, next-partial-prefetching-adoption, next-dev-loop). Use when configuring or migrating a Next.js app to cacheComponents with Sanity, when adding sanityFetch, when wiring <SanityLive>/<VisualEditing>, or when refactoring components that hardcode perspective/stega.
Как установить скилл sanity-live-cache-components?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sanity-live-cache-components запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic