Comprehensive Sanity development best practices covering GROQ performance, schema design, Visual Editing, images, Portable Text, page builders, Studio configuration, TypeGen, localization, and migrations. Use this skill when building, reviewing, or optimizing Sanity applications.
Add this skill
npx mdskills install sanity-io/sanity-best-practicesWell-structured best practices catalog with clear prioritization and comprehensive rule coverage
1---2name: sanity-best-practices3description: Comprehensive Sanity development best practices covering GROQ performance, schema design, Visual Editing, images, Portable Text, page builders, Studio configuration, TypeGen, localization, and migrations. Use this skill when building, reviewing, or optimizing Sanity applications.4license: MIT5metadata:6 author: sanity7 version: "1.0.0"8---910# Sanity Best Practices1112Comprehensive best practices guide for Sanity development, maintained by Sanity. Contains rules across 10 categories, prioritized by impact to guide schema design, query optimization, and frontend integration.1314## When to Apply1516Reference these guidelines when:17- Writing GROQ queries or optimizing performance18- Designing content schemas19- Implementing Visual Editing and live preview20- Working with images, Portable Text, or page builders21- Configuring Sanity Studio structure22- Setting up TypeGen for type safety23- Implementing localization24- Migrating content from other systems2526## Rule Categories by Priority2728| Priority | Category | Impact | Prefix |29|----------|----------|--------|--------|30| 1 | GROQ Performance | CRITICAL | `groq-` |31| 2 | Schema Design | HIGH | `schema-` |32| 3 | Visual Editing | HIGH | `visual-` |33| 4 | Images | HIGH | `image-` |34| 5 | Portable Text | HIGH | `pte-` |35| 6 | Page Builder | MEDIUM | `pagebuilder-` |36| 7 | Studio Configuration | MEDIUM | `studio-` |37| 8 | TypeGen | MEDIUM | `typegen-` |38| 9 | Localization | MEDIUM | `i18n-` |39| 10 | Migration | LOW-MEDIUM | `migration-` |4041## How to Use4243Read individual rule files for detailed explanations and code examples:4445```46rules/groq-optimizable-filters.md47rules/schema-data-over-presentation.md48rules/_sections.md49```5051Each rule file contains:52- Brief explanation of why it matters53- Incorrect code example with explanation54- Correct code example with explanation55- Additional context and references56- Framework-specific notes (when applicable)5758## Framework Integration5960Framework-specific guidance (Next.js, Astro, Remix, etc.) is available via the Sanity MCP server using `list_sanity_rules` and `get_sanity_rules` tool calls when available. If the MCP server is not configured, run `npx sanity@latest mcp configure` to set it up.61
Full transparency — inspect the skill content before installing.