sanity-best-practices
Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations…
Skill by sanity-ioOfficial
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sanity-io-sanity-best-practices
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: presentations, design, frontend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/sanity-best-practices
What's inside
- Skill name
sanity-best-practices- Description
- Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, webhooks, Blueprints, and framework integrations such as Next.js, Nuxt, Astro, Remix, SvelteKit, Angular, Hydrogen, the App SDK, and Studios or apps running in the Sanity Dashboard (defineApplication). Use this skill whenever working with Sanity schemas, defineType or defineField, GROQ or defineQuery, content modeling, Presentation or preview setups, Sanity-powered frontend integrations, event-driven content automation, documentEventHandler, defineDocumentFunction, defineMediaLibraryAssetFunction, @sanity/functions, @sanity/blueprints, sanity.blueprint.ts, event-driven content automation, or when reviewing and fixing a Sanity codebase.
- License
- MIT
- Instructions
- 85 lines in SKILL.md · view on GitHub
Files (26)
- SKILL.md
- angular.md · references/
- app-sdk.md · references/
- astro.md · references/
- blueprints.md · references/
- dashboard.md · references/
- functions.md · references/
- get-started.md · references/
- groq.md · references/
- hydrogen.md · references/
- image.md · references/
- localization.md · references/
- migration-html-import.md · references/
- migration.md · references/
- nextjs.md · references/
- nuxt.md · references/
- page-builder.md · references/
- portable-text.md · references/
- project-structure.md · references/
- remix.md · references/
- schema.md · references/
- seo.md · references/
- studio-structure.md · references/
- svelte.md · references/
- typegen.md · references/
- visual-editing.md · references/
SKILL.md (first lines)
# 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 - Developing or deploying a Studio or app in the Sanity Dashboard - Managing infrastructure with Blueprints - Automating content workflows with Sanity Functions or webhooks ## 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`. ## Video - Do not store or serve video from Sanity `file` assets for production playback. File assets are delivered as raw downloads with no transcoding or adaptive streaming, and video traffic drives very high bandwidth usage and unexpectedly large bills. - On Enterprise plans with the video add-on, use Sanity Media Library for video: uploads are transcoded and streamed adaptively via Mux. Model video fields with `defineVideoField()` from `sanity/media-library` and play them with `@mux/mux-player-react` using the asset's playback ID. - On other plans, use a dedicated video service: install `sanity-plugin-mux-input` to upload and manage videos in your Mux account from the Studio, or host video on a platform such as YouTube or Vimeo and store only the embed URL in Sanity. - Small clips and short previews in a `file` field are acceptable, but any user-facing video at scale must go through Media Library or a streaming service. ## 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 - `dashboard` - Studios and apps in the Sanity Dashboard: defineApplication, local dev, deploys, Dashboard hooks - `blueprints` - Infrastructure as Code: blueprint files, stacks, plan/deploy workflow, error recovery, CI deploys - `functions` - Automating content workflows with Sanity Functions and webhooks ### 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
From sanity-io/agent-toolkit, MIT.
More from sanity-io/agent-toolkit
- 0.794score
Sanity
www.sanity.ioOfficial
Direct access to your Sanity projects (content, datasets, releases, schemas) and agent rules
ConnectorAFreshness: ARemote★ 194Claude Code +3 - 0.789score
sanity-form-component-suspense
sanity-ioOfficial
Fix a Sanity Studio custom form component (components.input, components.field, components.item, or a plugin's form.components) that suspends without its own…
SkillAFreshness: A★ 194Claude Code +9 - 0.789score
sanity-singletons
sanity-ioOfficial
Configure singleton documents in a Sanity Studio using the document.singletons registry.
SkillAFreshness: A★ 194Claude Code +9 - 0.749score
sanity-studio-upgrade
sanity-ioOfficial
Produces a tailored Sanity Studio upgrade plan by inspecting the repository's installed versions, config, and source, then reporting only the breaking changes…
SkillBFreshness: B★ 194Claude Code +9 - 0.749score
content-experimentation-best-practices
sanity-ioOfficial
Content experimentation and A/B testing guidance covering experiment design, hypotheses, metrics, sample size, statistical foundations, CMS-managed variants…
SkillBFreshness: B★ 194Claude Code +9 - 0.749score
sanity-migration
sanity-ioOfficial
Plans, implements, and reviews migrations from other CMSes and content systems into Sanity.
SkillBFreshness: B★ 194Claude Code +9 - 0.743score
portable-text-conversion
sanityOfficial
Convert HTML and Markdown content into Portable Text blocks for Sanity.
SkillBFreshness: B★ 194Claude Code +9 - 0.616score
seo-aeo-best-practices
sanity-ioOfficial
SEO and AEO best practices for metadata, Open Graph, sitemaps, robots.txt, hreflang, JSON-LD structured data, EEAT, and content optimized for search engines…
SkillDFreshness: D★ 194Claude Code +9 - 0.616score
content-modeling-best-practices
sanity-ioOfficial
Structured content modeling guidance for schema design, content architecture, content reuse, references versus embedded objects, separation of concerns, and…
SkillDFreshness: D★ 194Claude Code +9 - 0.611score
portable-text-serialization
sanityOfficial
Render and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text.
SkillDFreshness: D★ 194Claude Code +9
Signals
- Stars
- 194
- Forks
- 30
- Open issues
- 6
- Contributors
- 21
- Last commit (this folder)
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/sanity-io/agent-toolkit
- Website
- www.sanity.io
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from sanity-io
- 0.789score
sanity-form-component-suspense
sanity-ioOfficial
Fix a Sanity Studio custom form component (components.input, components.field, components.item, or a plugin's form.components) that suspends without its own…
SkillAFreshness: A★ 194Claude Code +9 - 0.789score
sanity-singletons
sanity-ioOfficial
Configure singleton documents in a Sanity Studio using the document.singletons registry.
SkillAFreshness: A★ 194Claude Code +9 - 0.749score
sanity-migration
sanity-ioOfficial
Plans, implements, and reviews migrations from other CMSes and content systems into Sanity.
SkillBFreshness: B★ 194Claude Code +9 - 0.749score
content-experimentation-best-practices
sanity-ioOfficial
Content experimentation and A/B testing guidance covering experiment design, hypotheses, metrics, sample size, statistical foundations, CMS-managed variants…
SkillBFreshness: B★ 194Claude Code +9 - 0.749score
sanity-studio-upgrade
sanity-ioOfficial
Produces a tailored Sanity Studio upgrade plan by inspecting the repository's installed versions, config, and source, then reporting only the breaking changes…
SkillBFreshness: B★ 194Claude Code +9 - 0.616score
content-modeling-best-practices
sanity-ioOfficial
Structured content modeling guidance for schema design, content architecture, content reuse, references versus embedded objects, separation of concerns, and…
SkillDFreshness: D★ 194Claude Code +9
Cite this page
sanity-best-practices skill. Agent Mart. https://agentmart.dev/skills/sanity-io-sanity-best-practices (last updated 2026-10-24)