Official agent skill

Sanity Best Practices

by sanity-io in sanity-io/agent-toolkit

Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, webhooks, Blueprints…

OfficialMITAuto-check passedBackend & APIs

Install Sanity Best Practices

skills CLI
$ npx skills add sanity-io/agent-toolkit --skill sanity-best-practices -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install sanity-io/agent-toolkit sanity-best-practices --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/sanity-io/agent-toolkit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/sanity-best-practices .claude/skills/sanity-best-practices && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sanity-best-practices
GitHub stars
188
Token cost
~1.4k tokens
SKILL.md length
586 words
Files
26 (incl. references)
Skills in repo
8
Repo updated
First seen
Licence
MIT

At a glance

Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, webhooks, Blueprints…

  • Working with Sanity schemas
  • SKILL.md covers When to Apply, Global Rules, Video and Quick Reference, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Content modeling

What it does

Sanity Best Practices is an agent skill from sanity-io/agent-toolkit, published by the product's own GitHub organization. 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…

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 26 other files, including reference files (for example `references/angular.md`, `references/app-sdk.md` and `references/astro.md`).

It sits in Backend & APIs, covering Event-driven systems, Static sites and blogs and Internationalization. It works with Astro, Next.js, Nuxt and SvelteKit. The repository describes itself as: Collection of resources to help AI agents build better with Sanity. The licence is MIT.

When your agent uses it

  • Working with Sanity schemas
  • Content modeling
  • Sanity-powered frontend integrations
  • Event-driven content automation

Example prompts

  • “/sanity-best-practices”

What it can do on your machine

Read from SKILL.md and the folder at commit 3fe6c8a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sanity Best Practices loads about 1.4k tokens when it runs, and up to ~66k if it reads all its reference files. Until then it costs about 211 tokens; SKILL.md has 586 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~211
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~66k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from sanity-io/agent-toolkit at commit 3fe6c8a, republished under its MIT licence (© sanity-io). 586 words, ~1,384 tokens.

Download SKILL.mdSave it as .claude/skills/sanity-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 25 other files; get the full folder from GitHub.
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.

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

Show full SKILL.md (247 more words)Show less
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

© sanity-io, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 25 other files (references) in skills/sanity-best-practices of sanity-io/agent-toolkit.

  • SKILL.md
  • references/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
  • … and 6 more

Open the folder on GitHubat commit 3fe6c8a

Compare with similar skills

Sanity Best Practices next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sanity Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sanity Best Practices this skillsanity-io/agent-toolkit188—~1.4kAutomated safety check: PassMIT
Sanity Best Practicesrobotostudio/turbo-start-sanity183—~940Automated safety check: PassMIT
Framework Adaptershashgraph-online/awesome-codex-plugins1.3k—~2.9kAutomated safety check: NotesApache-2.0
Clerkgeekskai/blog1033 repos~1.5kAutomated safety check: PassMIT
Cloudflare Workers Frameworkssecondsky/claude-skills227—~1.4kAutomated safety check: PassMIT
Edgeone Makers FrameworksTencentEdgeOne/edgeone-makers-tools1.9k—~2.5kAutomated safety check: PassMIT

Similar skills

  • Sanity Best Practices

    robotostudio/turbo-start-sanity

    Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, Blueprints, and…

    183 GitHub stars~940 tokensUpdated 5 days ago
    Frontend & DesignAuto-check passed
  • Framework Adapters

    hashgraph-online/awesome-codex-plugins

    Official @dodopayments/ framework adapters that mount Checkout, CustomerPortal, and Webhooks route handlers.

    1.3k GitHub stars~2.9k tokensUpdated yesterday
    Backend & APIsAuto-check: notes
  • Clerk

    geekskai/blog

    Clerk authentication router. An agent skill from geekskai/blog.

    103 GitHub starsUsed in 3 repos~1.5k tokens
    Backend & APIsAuto-check passed
  • Cloudflare Workers Frameworks

    secondsky/claude-skills

    Framework integration for Cloudflare Workers. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.4k tokensUpdated 13 days ago
    Frontend & DesignAuto-check passed
  • Edgeone Makers Frameworks

    TencentEdgeOne/edgeone-makers-tools

    Web framework support matrix for EdgeOne Makers — which platform adapter each full-stack framework needs, where it plugs in, the build output directory, the preview asset-prefix option, the 404…

    1.9k GitHub stars~2.5k tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • App Builder

    Undertone0809/rudder

    Create and iteratively improve local web products from natural-language requests, then prepare them to run as Rudder Apps.

    292 GitHub stars~2k tokensUpdated yesterday
    Frontend & DesignAuto-check passed

More from sanity-io/agent-toolkit

All 8 skills in this repo
  • Portable Text Conversion

    sanity-io/agent-toolkit

    Official

    Convert HTML and Markdown content into Portable Text blocks for Sanity.

    188 GitHub starsUsed in 1 repo~664 tokens
    Auto-check passed
  • Sanity Migration

    sanity-io/agent-toolkit

    Official

    Plans, implements, and reviews migrations from other CMSes and content systems into Sanity.

    188 GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • Portable Text Serialization

    sanity-io/agent-toolkit

    Official

    Render and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text.

    188 GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • SEO Aeo Best Practices

    sanity-io/agent-toolkit

    Official

    SEO and AEO best practices for metadata, Open Graph, sitemaps, robots.txt, hreflang, JSON-LD structured data, EEAT, and content optimized for search engines and AI answer surfaces.

    188 GitHub starsUsed in 2 repos~467 tokens
    Auto-check passed
  • Sanity Studio Upgrade

    sanity-io/agent-toolkit

    Official

    Produces a tailored Sanity Studio upgrade plan by inspecting the repository's installed versions, config, and source, then reporting only the breaking changes that actually apply.

    188 GitHub stars~4.8k tokensUpdated yesterday
    Auto-check passed
  • Official

    Content experimentation and A/B testing guidance covering experiment design, hypotheses, metrics, sample size, statistical foundations, CMS-managed variants, and common analysis pitfalls.

    188 GitHub starsUsed in 1 repo~469 tokens
    Auto-check passed

Questions about Sanity Best Practices

What does Sanity Best Practices do?

Sanity development best practices for schema design, GROQ queries, TypeGen, Visual Editing, images, Portable Text, Studio structure, localization, migrations, Sanity Functions, webhooks, Blueprints…. Sanity Best Practices is an agent skill from sanity-io/agent-toolkit, published by the product's own GitHub organization.js, Nuxt, Astro, Remix, SvelteKit, Angular, Hydrogen, the App SDK, and Studios or apps running in the Sanity Dashboard (defineApplication).

When should I use Sanity Best Practices?

Sanity Best Practices fits situations like: working with Sanity schemas; content modeling; sanity-powered frontend integrations; event-driven content automation.

How do I install Sanity Best Practices in Claude Code?

Run `npx skills add sanity-io/agent-toolkit --skill sanity-best-practices -a claude-code`. Or copy the skill folder (skills/sanity-best-practices in sanity-io/agent-toolkit) into .claude/skills/sanity-best-practices in your project. Claude Code loads it when a task matches its description.

How do I install Sanity Best Practices in Codex?

Run `npx skills add sanity-io/agent-toolkit --skill sanity-best-practices -a codex`. Or copy the skill folder (skills/sanity-best-practices in sanity-io/agent-toolkit) into .agents/skills/sanity-best-practices in your project. Codex loads it when a task matches its description.

Can I use Sanity Best Practices in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sanity-io/agent-toolkit --skill sanity-best-practices -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sanity-best-practices, .gemini/skills/sanity-best-practices, .github/skills/sanity-best-practices and .opencode/skills/sanity-best-practices in your project.

What does Sanity Best Practices need to run?

SKILL.md names no scripts, command-line tools or credentials: Sanity Best Practices is instructions for the agent only.

Does Sanity Best Practices access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Sanity Best Practices safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sanity Best Practices use?

Sanity Best Practices is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sanity Best Practices use?

About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 64k tokens, read only when the agent opens those files.

What are the alternatives to Sanity Best Practices?

Skills that share tags, products or a category with Sanity Best Practices: Sanity Best Practices (robotostudio/turbo-start-sanity, 183 stars), Framework Adapters (hashgraph-online/awesome-codex-plugins, 1.3k stars), Clerk (geekskai/blog, 103 stars) and Cloudflare Workers Frameworks (secondsky/claude-skills, 227 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sanity Best Practices?

sanity-io (a GitHub organization, an official publisher) maintains it in sanity-io/agent-toolkit, which has 188 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 9, 2026.

Source: sanity-io/agent-toolkit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.