Skill

sanity-best-practices

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.

From sanity
Install
1
Run in your terminal
$
npx claudepluginhub jadecli/jadecli-claude-plugins --plugin sanity
Tool Access

This skill uses the workspace's default tool permissions.

Supporting Assets
View in Repository
rules/_sections.md
rules/groq-avoid-joins-in-filters.md
rules/groq-cursor-pagination.md
rules/groq-define-query.md
rules/groq-merge-references.md
rules/groq-optimizable-filters.md
rules/groq-order-before-slice.md
rules/groq-project-fields.md
rules/i18n-document-vs-field.md
rules/image-hotspot.md
rules/image-query-lqip.md
rules/migration-html-import.md
rules/pagebuilder-block-previews.md
rules/pagebuilder-objects-vs-refs.md
rules/pte-custom-components.md
rules/schema-array-keys.md
rules/schema-data-over-presentation.md
rules/schema-define-helpers.md
rules/schema-deprecation-pattern.md
rules/schema-reference-vs-object.md
Skill Content

Sanity Best Practices

Comprehensive 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.

When to Apply

Reference these guidelines when:

  • 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

Rule Categories by Priority

PriorityCategoryImpactPrefix
1GROQ PerformanceCRITICALgroq-
2Schema DesignHIGHschema-
3Visual EditingHIGHvisual-
4ImagesHIGHimage-
5Portable TextHIGHpte-
6Page BuilderMEDIUMpagebuilder-
7Studio ConfigurationMEDIUMstudio-
8TypeGenMEDIUMtypegen-
9LocalizationMEDIUMi18n-
10MigrationLOW-MEDIUMmigration-

How to Use

Read individual rule files for detailed explanations and code examples:

rules/groq-optimizable-filters.md
rules/schema-data-over-presentation.md
rules/_sections.md

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references
  • Framework-specific notes (when applicable)

Framework Integration

Framework-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.

Similar Skills
cache-components

Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.

138.5k
Stats
Parent Repo Stars0
Parent Repo Forks0
Last CommitFeb 9, 2026