/sanity:sanity-best-practicesfrom sanity
Provides 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.
Ships in sanity. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
Reference these guidelines when:
_id values for ordinary documents. Do not create deterministic UUIDs, slug-derived IDs, or legacy-system IDs when creating documents.reference fields, then resolve related documents with GROQ lookups, source-key fields, or returned _id values from created documents.homePage-en.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.defineVideoField() from sanity/media-library and play them with @mux/mux-player-react using the asset's playback ID.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.file field are acceptable, but any user-facing video at scale must go through Media Library or a streaming service.{studioUrl}/intent/edit/id={id};type={type};path={path}: it opens the document wherever it sits in the Structure tree, and path focuses one field.path value with encodeURIComponent. Studio splits each parameter on =, so an unencoded body[_key=="abc"] is cut short at body[_key and the link focuses the wrong field._key, not by index, in links that are stored or sent. Path syntax: https://www.sanity.io/docs/studio/how-form-paths-work.mdresolveEditUrl from @sanity/client/csm instead of building the URL by hand.@sanity/cli 8.19.0+; docs: https://www.sanity.io/docs/cli-reference/tokens.md) so you can pipe stdout JSON straight into the target secret store (such as gh secret set) without exposing the secret in agent output, logs, or committed files:
npx sanity@latest tokens create "<label>" --project <projectId> --role=<role> --yes --json (e.g. viewer, editor, deploy-studio; never administrator).npx sanity@latest tokens create "<label>" --organization <orgId> --grant <permission> --yes --json (e.g. --grant sdk-apps, --grant blueprints, --grant project:<projectId>=editor).tokens is unavailable (for example, through Sanity MCP run_sanity_cli), use sanity api (docs: https://www.sanity.io/docs/cli-reference/cli-api.md; -f flags select POST automatically): sanity api projects/<projectId>/tokens -f label="<label>" -f roleName=<role> (returns key), or sanity api v2025-07-11/access/<resourceType>/<resourceId>/robots with bracket -f flags for nested memberships when --input is unavailable (returns token; docs: https://www.sanity.io/docs/http-reference/access-api.md).run_sanity_cli cannot pipe to a shell and returns the raw secret into agent tool output, prefer the local CLI when available and confirm with the user before minting via MCP if keeping secrets out of model context matters. Always grant the narrowest role required and never echo or commit the token.get-started - Interactive onboarding for new Sanity projectsnextjs - Next.js App Router, Live Content API, standalone Studionuxt - Nuxt integration with @nuxtjs/sanityangular - Angular integration with @sanity/client, signals, resource API, Visual Editingastro - Astro integration with @sanity/astroremix - React Router / Remix integrationsvelte - SvelteKit integration with @sanity/svelte-loaderhydrogen - Shopify Hydrogen with Sanityproject-structure - Standalone Studio and monorepo patternsapp-sdk - Custom applications with Sanity App SDKdashboard - Studios and apps in the Sanity Dashboard: defineApplication, local dev, deploys, classic Studio registration, Dashboard hooksblueprints - Infrastructure as Code: blueprint files, stacks, plan/deploy workflow, error recovery, CI deploysfunctions - Automating content workflows with Sanity Functions and webhooksgroq - GROQ query patterns, type safety, performance optimizationschema - Schema design, field definitions, validation, deprecation patternsvisual-editing - Presentation Tool, Stega, overlays, live previewpage-builder - Page Builder arrays, block components, live editingportable-text - Rich text rendering and custom componentsimage - Image schema, URL builder, hotspots, LQIP, Next.js Imagestudio-structure - Desk structure, singletons, navigationtypegen - TypeGen configuration, workflow, type utilitiesseo - Metadata, sitemaps, Open Graph, JSON-LDlocalization - i18n patterns, document vs field-level, locale managementmigration - Content import overview (see also migration-html-import)migration-html-import - HTML to Portable Text with @portabletext/block-toolsStart 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:
references/angular.md (opens in a new tab)references/app-sdk.md (opens in a new tab)references/astro.md (opens in a new tab)references/blueprints.md (opens in a new tab)references/dashboard.md (opens in a new tab)references/functions.md (opens in a new tab)references/get-started.md (opens in a new tab)references/groq.md (opens in a new tab)references/hydrogen.md (opens in a new tab)references/image.md (opens in a new tab)references/localization.md (opens in a new tab)references/migration-html-import.md (opens in a new tab)references/migration.md (opens in a new tab)references/nextjs.md (opens in a new tab)references/nuxt.md (opens in a new tab)references/page-builder.md (opens in a new tab)references/portable-text.md (opens in a new tab)references/project-structure.md (opens in a new tab)references/remix.md (opens in a new tab)references/schema.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/content-experimentation-best-practicesContent experimentation and A/B testing guidance covering experiment design, hypotheses, metrics, sample size, statistical foundations, CMS-managed variants, and common analysis pitfalls. Use this skill when planning experiments, setting up variants, choosing success metrics, interpreting statistical results, or building experimentation workflows in a CMS or frontend stack./content-modeling-best-practicesStructured content modeling guidance for schema design, content architecture, content reuse, references versus embedded objects, separation of concerns, and taxonomies across Sanity and other headless CMSes. Use this skill when designing or refactoring content types, deciding field shapes, debating reusable versus nested content, planning omnichannel content models, or reviewing whether a schema is too page-shaped or presentation-driven./portable-text-conversionConvert HTML and Markdown content into Portable Text blocks for Sanity. Use when migrating content from legacy CMSs, importing HTML or Markdown into Sanity, building content pipelines that ingest external content, converting rich text between formats, or programmatically creating Portable Text documents. Covers @portabletext/markdown (markdownToPortableText), @portabletext/block-tools (htmlToBlocks), custom deserializers, and the Portable Text specification for manual block construction.npx claudepluginhub sanity-io/agent-toolkit --plugin sanityOther plugins' skills for the same job