sanity-best-practices
作成者: sanity-io
Sanity CMS開発におけるフレームワーク横断的な包括的なベストプラクティスと統合ガイド。Next.js、Nuxt、Astro、Remix、SvelteKit、Angularを含む10以上のフレームワーク統合を、フレームワーク固有のパターンとセットアップガイダンスとともにカバー。スキーマ設計、GROQクエリ最適化、ビジュアル編集、Portable Text、画像、TypeGen、ローカライゼーション、コンテンツ移行に関するトピックガイドを含む。タスクタイプに基づいて関連ガイドのみを読み込むためのクイックリファレンス構造を提供。
npx skills add https://github.com/sanity-io/agent-toolkit --skill sanity-best-practicesSanity 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
- Managing infrastructure with Blueprints
- Automating content workflows with Sanity Functions
Global Rules
- Let Sanity generate
_idvalues for ordinary documents. Do not create deterministic UUIDs, slug-derived IDs, or legacy-system IDs when creating documents. - Model relationships with
referencefields, then resolve related documents with GROQ lookups, source-key fields, or returned_idvalues from created documents. - Use explicit document IDs mainly for singleton documents controlled by Studio Structure, including localized singletons such as
homePage-en.
Quick Reference
Integration Guides
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 APIastro- 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 SDKblueprints- Infrastructure as Code with Sanity Blueprintsfunctions- Automating content workflows with Sanity Functions
Topic Guides
groq- 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 alsomigration-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のその他のスキル
sanity-migration
sanity-io
他のCMSやコンテンツシステムからSanityへの移行を計画、実施、レビューします。AEM、Adobe Experience Manager、Contentful、Strapi、Webflow、WordPress、Payload、Drupal、Markdown/MDX/frontmatterファイル、WXR/XMLエクスポート、CMS API、データベースダンプ、静的HTMLからの移行やSanityへのリプラットフォーム時、または抽出、変換、Portable Text変換、アセット移行、リダイレクト、検証、カットオーバーワークフローの設計時に使用します。
officialdevelopmentdatabase
create-agent-with-sanity-context
sanity-io
Agent Contextを通じてSanityコンテンツへの構造化アクセスを持つAIエージェントを構築します。Sanityを活用したチャットボットのセットアップや、AIアシスタントをSanityに接続する際に使用します…
official
dial-your-context
sanity-io
対話形式で、Sanity Agent Context MCPのInstructionsフィールドの内容を作成するインタラクティブセッションです。エージェントコンテキストの調整や改善についてユーザーが言及した際に、このスキルを使用してください。
official
optimize-agent-prompt
sanity-io
ガイド付き会話を通じてSanity Agent Contextエージェントを調整します。探索データを本番環境対応の指示に変換し、システムプロンプトを作成します…
official
shape-your-agent
sanity-io
Sanity Agent Context MCP を搭載したAIエージェントのシステムプロンプトを作成するためのインタラクティブセッションです。ユーザーがエージェントの性格を定義したい場合にこのスキルを使用します。
official
content-experimentation-best-practices
sanity-io
コンテンツ実験の設計、実行、分析に関する構造化されたガイダンスで、コンバージョンとエンゲージメントを向上させます。仮説フレームワーク、指標の選択、サンプルサイズの計算、A/Bテストや多変量実験における統計的有意性検定を網羅。p値、信頼区間、検出力分析、結果解釈のためのベイズ手法に関する詳細なリソースを提供。フィールドレベルでバリアントを管理し、外部と接続するためのCMS統合パターンを含みます。
official
content-modeling-best-practices
sanity-io
構造化コンテンツモデリングのガイダンス:スキーマ設計、再利用性、マルチチャネル配信に対応。コンテンツをページではなくデータとして扱う、単一情報源の維持、将来のチャネルに対応した設計、編集者ワークフローの最適化といった基本原則を網羅。参照と埋め込みオブジェクトの判断基準、関心の分離、コンテンツ再利用パターンを提供。フラット、階層的、ファセット型アプローチのタクソノミーと分類ガイダンスを提示。対象範囲:...
official
portable-text-conversion
sanity-io
HTMLおよびMarkdownコンテンツをSanity用のPortable Textブロックに変換します。レガシーCMSからのコンテンツ移行時や、HTMLやMarkdownをSanityにインポートする際に使用します。
official