nuxt-sanity

@nuxtjs/sanity module integration best practices for Nuxt 3 apps connected to Sanity CMS. Covers useSanityQuery, useLazySanityQuery, useSanity, SanityImage, SanityContent (Portable Text), visual editing / live preview with stega, TypeScript typegen, named clients, and Nitro server routes. Also covers starter architecture with cached Nitro endpoints, preview-switch composables, Netlify CDN caching, and cache tag invalidation. Use when the user mentions @nuxtjs/sanity, nuxt-sanity, useSanityQuery, SanityImage in Nuxt, or is building a Nuxt app that fetches data from Sanity.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "nuxt-sanity" with this command: npx skills add display-design-studio/skills/display-design-studio-skills-nuxt-sanity

Nuxt + Sanity Integration Best Practices

Best-practices guide for the @nuxtjs/sanity module (Nuxt 3). Covers module setup, composables, SSR data fetching, image handling, Portable Text, visual editing, TypeScript, and Nitro server routes.

Also load the nuxt skill for Nuxt core patterns and sanity-best-practices for GROQ query optimization and schema design. This skill covers the integration layer only.

ROUTING: Which rule file to load

IF setting up the module or configuring nuxt.config.ts: → Read rules/core-module-setup.md

IF using useSanityQuery, useLazySanityQuery, or useSanity composables: → Read rules/core-composables.md

IF writing Nitro server routes that query Sanity: → Read rules/core-server-routes.md

IF working with the SanityImage component or useSanityImage(): → Read rules/features-sanity-image.md

IF rendering Portable Text with SanityContent: → Read rules/features-sanity-content.md

IF implementing visual editing, live preview, stega, or the Presentation tool: → Read rules/features-visual-editing.md

IF following the Display Starter architecture or adding a new document type: → Read rules/arch-starter-pattern.md then rules/arch-extension-pattern.md

IF configuring CDN caching, cache tags, or webhook cache invalidation: → Read rules/perf-cdn-caching.md

IF experiencing stale CDN content after a Sanity publish (not query-level cache): → Read rules/perf-cdn-caching.md

IF experiencing stale data, cache misses, or reactive query bugs: → Read rules/perf-query-keys-and-caching.md

IF debugging CORS errors, auth token issues, or hydration mismatches: → Read rules/debug-common-errors.md

IF generating a dynamic sitemap from Sanity routes (works, case studies, etc.): → Read rules/features-sitemap.md

Rule index

TopicDescriptionFile
Sections overviewCategories and reading orderrules/_sections.md
Module setupInstallation, nuxt.config.ts options, env varsrules/core-module-setup.md
ComposablesuseSanityQuery, useLazySanityQuery, useSanity usage, preview-switch patternrules/core-composables.md
Server routesNitro server routes with useSanity, validateSanityQueryrules/core-server-routes.md
Starter architectureDirectory layout, data-flow, GROQ conventions, i18nrules/arch-starter-pattern.md
Extension pattern4-step recipe: GROQ query → endpoint → composable → pagerules/arch-extension-pattern.md
CDN cachingTwo-layer caching, preview bypass, cache tagging, webhook invalidationrules/perf-cdn-caching.md
SanityImageSanityImage component, useSanityImage(), @nuxt/image integrationrules/features-sanity-image.md
SanityContentPortable Text rendering, custom componentsrules/features-sanity-content.md
Visual editingStega, live preview, Presentation tool, draft moderules/features-visual-editing.md
Caching (queries)Query key stability, reactive params, cache invalidationrules/perf-query-keys-and-caching.md
DebugCORS, auth tokens, hydration errors, common pitfallsrules/debug-common-errors.md
SitemapDynamic sitemap sources, defineSitemapEventHandler, stegaClean on slugsrules/features-sitemap.md

Rule categories by priority

PriorityCategoryImpactPrefix
1Module setup & composablesCRITICALcore-
2Server routesHIGHcore-
3Starter architecture & extensionHIGHarch-
4Visual editingHIGHfeatures-
5Image & Portable TextHIGHfeatures-
6Caching & performanceMEDIUM-HIGHperf-
7DebugMEDIUMdebug-

Coverage and maintenance

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

shopify-development

No summary provided by upstream source.

Repository SourceNeeds Review
General

tailwind

No summary provided by upstream source.

Repository SourceNeeds Review
General

content-modeling-best-practices

No summary provided by upstream source.

Repository SourceNeeds Review