sanity-best-practices

Umfassende Best Practices und Integrationsleitfäden für die Sanity CMS-Entwicklung über Frameworks und Themen hinweg. Behandelt über 10 Framework-Integrationen, darunter Next.js, Nuxt, Astro, Remix, SvelteKit und Angular mit frameworkspezifischen Mustern und Einrichtungsanleitungen. Enthält Themenleitfäden für Schema-Design, GROQ-Abfrageoptimierung, Visual Editing, Portable Text, Bilder, TypeGen, Lokalisierung und Content-Migrationen. Bietet eine Kurzreferenzstruktur zum Laden nur relevanter Leitfäden basierend auf dem Aufgabentyp,...

npx skills add https://github.com/sanity-io/agent-toolkit --skill sanity-best-practices

Sanity Best Practices

Comprehensive best practices and integration guides for Sanity development, maintained by Sanity. Use the quick reference below to load only the one or two topic files that match the task.

When to Apply

Reference these guidelines when:

  • Setting up a new Sanity project or onboarding
  • Integrating Sanity with a frontend framework (Next.js, Nuxt, Astro, Remix, SvelteKit, Hydrogen)
  • Writing GROQ queries or optimizing performance
  • Designing content schemas
  • Implementing Visual Editing and live preview
  • Working with images, Portable Text, or page builders
  • Configuring Sanity Studio structure
  • Setting up TypeGen for type safety
  • Implementing localization
  • Migrating content from other systems
  • Building custom apps with the Sanity App SDK
  • Managing infrastructure with Blueprints
  • Automating content workflows with Sanity Functions

Global Rules

  • Let Sanity generate _id values for ordinary documents. Do not create deterministic UUIDs, slug-derived IDs, or legacy-system IDs when creating documents.
  • Model relationships with reference fields, then resolve related documents with GROQ lookups, source-key fields, or returned _id values from created documents.
  • Use explicit document IDs mainly for singleton documents controlled by Studio Structure, including localized singletons such as homePage-en.

Quick Reference

Integration Guides

  • get-started - Interactive onboarding for new Sanity projects
  • nextjs - Next.js App Router, Live Content API, standalone Studio
  • nuxt - Nuxt integration with @nuxtjs/sanity
  • angular - Angular integration with @sanity/client, signals, resource API
  • astro - Astro integration with @sanity/astro
  • remix - React Router / Remix integration
  • svelte - SvelteKit integration with @sanity/svelte-loader
  • hydrogen - Shopify Hydrogen with Sanity
  • project-structure - Standalone Studio and monorepo patterns
  • app-sdk - Custom applications with Sanity App SDK
  • blueprints - Infrastructure as Code with Sanity Blueprints
  • functions - Automating content workflows with Sanity Functions

Topic Guides

  • groq - GROQ query patterns, type safety, performance optimization
  • schema - Schema design, field definitions, validation, deprecation patterns
  • visual-editing - Presentation Tool, Stega, overlays, live preview
  • page-builder - Page Builder arrays, block components, live editing
  • portable-text - Rich text rendering and custom components
  • image - Image schema, URL builder, hotspots, LQIP, Next.js Image
  • studio-structure - Desk structure, singletons, navigation
  • typegen - TypeGen configuration, workflow, type utilities
  • seo - Metadata, sitemaps, Open Graph, JSON-LD
  • localization - i18n patterns, document vs field-level, locale management
  • migration - Content import overview (see also migration-html-import)
  • migration-html-import - HTML to Portable Text with @portabletext/block-tools

How to Use

Start with the single framework or topic guide that best matches the request, then read additional references only when the task crosses concerns. Use these reference files for detailed explanations and code examples:

references/groq.md
references/schema.md
references/nextjs.md

Each reference file contains:

  • Comprehensive topic or integration coverage
  • Incorrect and correct code examples
  • Decision matrices and workflow guidance
  • Framework-specific patterns where applicable

Mehr Skills von sanity-io

sanity-migration
sanity-io
Plant, implementiert und überprüft Migrationen von anderen CMS- und Contentsystemen nach Sanity. Verwenden bei Migration oder Replatforming zu Sanity von AEM, Adobe Experience Manager, Contentful, Strapi, Webflow, WordPress, Payload, Drupal, Markdown/MDX/Frontmatter-Dateien, WXR/XML-Exporten, CMS-APIs, Datenbank-Dumps, statischem HTML oder beim Entwerfen von Extraktions-, Transformations-, Portable-Text-Konvertierungs-, Asset-Migrations-, Redirect-, Validierungs- und Cutover-Workflows.
officialdevelopmentdatabase
create-agent-with-sanity-context
sanity-io
Erstelle KI-Agenten mit strukturiertem Zugriff auf Sanity-Inhalte über den Agent Context. Verwende dies beim Einrichten eines Sanity-gestützten Chatbots oder beim Verbinden eines KI-Assistenten mit Sanity…
official
dial-your-context
sanity-io
Interaktive Sitzung zur Erstellung von Inhalten für das Instructions-Feld eines Sanity Agent Context MCP. Verwenden Sie diese Fähigkeit, wenn Benutzer die Optimierung des Agentenkontexts erwähnen, Verbesserung…
official
optimize-agent-prompt
sanity-io
Optimieren Sie Ihren Sanity Agent Context Agent durch geführte Konversation. Wandelt Erkundungsdaten in produktionsreife Anweisungen um und erstellt einen System-Prompt…
official
shape-your-agent
sanity-io
Interaktive Sitzung zur Erstellung eines System-Prompts für einen KI-Agenten, der von Sanity Agent Context MCP betrieben wird. Verwenden Sie diese Fähigkeit, wenn Benutzer die Persönlichkeit des Agenten definieren möchten,…
official
content-experimentation-best-practices
sanity-io
Strukturierte Anleitung für die Konzeption, Durchführung und Analyse von Content-Experimenten zur Verbesserung von Conversion und Engagement. Behandelt Hypothesen-Frameworks, Metrikauswahl, Stichprobengrößenberechnung und statistische Signifikanztests bei A/B- und multivariaten Experimenten. Enthält detaillierte Ressourcen zu p-Werten, Konfidenzintervallen, Power-Analyse und Bayes'schen Methoden zur Ergebnisinterpretation. Bietet CMS-Integrationsmuster für die Verwaltung von Varianten auf Feldebene und die Anbindung externer...
official
content-modeling-best-practices
sanity-io
Strukturierte Content-Modellierungsanleitung für Schema-Design, Wiederverwendbarkeit und Multi-Channel-Auslieferung. Behandelt Kernprinzipien: Behandlung von Inhalten als Daten statt als Seiten, Aufrechterhaltung einzelner Quellen der Wahrheit, Design für zukünftige Kanäle und Optimierung für Redaktionsworkflows. Enthält Entscheidungsrahmen für Referenzen versus eingebettete Objekte, Trennung von Belangen und Content-Wiederverwendungsmuster. Bietet Taxonomie- und Klassifikationsanleitung für flache, hierarchische und facettierte Ansätze. Gilt für...
official
portable-text-conversion
sanity-io
Konvertieren Sie HTML- und Markdown-Inhalte in Portable Text-Blöcke für Sanity. Verwenden Sie dies beim Migrieren von Inhalten aus Legacy-CMS, beim Importieren von HTML oder Markdown in Sanity,…
official