Content Modeling Best Practices
SanityOfficialPublished by Sanity
- Skill
- Guidelines
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a framework for designing structured content models that prioritize data integrity and reusability over presentation-driven layouts. It offers guidance on core architectural decisions, such as when to use references versus embedded objects, how to implement shared components, and strategies for managing taxonomies. While applicable to any headless CMS, it includes specific implementation patterns for Sanity, helping developers build systems that are future-proof and optimized for content editors.
What it does
- Defines principles for separating content from presentation layers.
- Provides decision frameworks for choosing between references and embedded objects.
- Outlines patterns for content reuse, including shared components and field sets.
- Offers guidance on structuring taxonomies for consistent content classification.
- Helps identify and avoid common anti-patterns like over-abstraction.
- Supports planning for omnichannel content delivery.
When to use it
- When starting a new project and designing the initial content model.
- When evaluating whether content should be structured or free-form.
- When deciding between using references or embedding content directly.
- When planning for multi-channel content delivery requirements.
- When refactoring existing content structures to improve maintainability.
Advantages
- Promotes a single source of truth to reduce content duplication.
- Improves editor experience by streamlining content management workflows.
- Ensures content is flexible enough for future, unknown delivery channels.
- Reduces query complexity by applying appropriate modeling patterns.
- Provides clear, actionable implementation examples for schema design.
Usage examples
- “Should I use a reference or an embedded object for author profiles in my blog?”
- The agent explains that author profiles should be referenced because they are reusable, need central management, and have their own lifecycle independent of individual blog posts.
- “How can I avoid repeating SEO fields across my page and post types?”
- The agent provides a pattern for creating a shared field set that can be spread into multiple document types, ensuring consistency and reducing code duplication.
- “What are the signs that my content model is over-abstracted?”
- The agent lists indicators such as references used only once, editors needing to navigate multiple documents for a single page, and complex queries joining rarely-shared content.
- “How do I handle a product that needs to be referenced but occasionally requires a custom title?”
- The agent suggests a hybrid approach using an object that contains both a reference to the canonical product and an optional override field for the title.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/sanity-io/content-modeling-best-practices/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip content-modeling-best-practices.zip -d .agents/skills
Documentation by Sanity
Content Modeling Best Practices
Principles for designing structured content that's flexible, reusable, and maintainable. These concepts apply to any headless CMS but include Sanity-specific implementation notes.
When to Apply
Reference these guidelines when:
Starting a new project and designing the content model
Evaluating whether content should be structured or free-form
Deciding between references and embedded content
Planning for multi-channel content delivery
Refactoring existing content structures
Core Principles
Content is data, not pages — Structure content for meaning, not presentation
Single source of truth — Avoid content duplication
Future-proof — Design for channels that don't exist yet
Editor-centric — Optimize for the people creating content
References
Start with the reference that matches the modeling decision in front of you, instead of loading every topic at once. See references/ for detailed guidance on specific topics:
references/separation-of-concerns.md— Separating content from presentationreferences/reference-vs-embedding.md— When to use references vs embedded objectsreferences/content-reuse.md— Content reuse patterns and the reuse spectrumreferences/taxonomy-classification.md— Flat, hierarchical, and faceted classification
Files
- ATTRIBUTION.mdAdded by AutoGineer893 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md1.8 KiB
- references/content-reuse.md2.9 KiB
- references/reference-vs-embedding.md2.3 KiB
- references/separation-of-concerns.md2.1 KiB
- references/taxonomy-classification.md3.3 KiB
references/taxonomy-classification.md
Taxonomy and Classification
Organizing content with taxonomies enables filtering, navigation, and content relationships. Well-designed taxonomies scale; poorly designed ones become maintenance nightmares.
Types of Classification
Flat Taxonomy
Simple list of terms with no hierarchy.
Use for: Tags, simple categories Example: Blog tags: "javascript", "react", "tutorial"
defineType({
name: 'tag',
type: 'document',
fields: [
defineField({ name: 'title', type: 'string' }),
defineField({ name: 'slug', type: 'slug' }),
]
})Hierarchical Taxonomy
Terms with parent-child relationships.
Use for: Product categories, content sections Example: Electronics > Phones > Smartphones
defineType({
name: 'category',
type: 'document',
fields: [
defineField({ name: 'title', type: 'string' }),
defineField({ name: 'slug', type: 'slug' }),
defineField({
name: 'parent',
type: 'reference',
to: [{ type: 'category' }],
description: 'Parent category (leave empty for top-level)'
}),
]
})Faceted Classification
Multiple independent dimensions.
Use for: Complex filtering (e-commerce) Example: Filter by color AND size AND price range
// Multiple taxonomy types
defineField({ name: 'color', type: 'reference', to: [{ type: 'color' }] })
defineField({ name: 'size', type: 'reference', to: [{ type: 'size' }] })
defineField({ name: 'material', type: 'reference', to: [{ type: 'material' }] })Design Principles
1. Mutual Exclusivity (When Appropriate)
Categories should be distinct. If items frequently belong to multiple categories, consider tags instead.
Categories: One primary classification Tags: Many optional classifications
2. User-Centric Naming
Use terms your audience uses, not internal jargon.
Bad: "Content Assets" (internal term) Good: "Resources" or "Downloads" (user term)
3. Balanced Depth
Too shallow: Everything lumped together Too deep: Users can't find anything
Rule of thumb: 3-4 levels max for hierarchies
4. Scalable Structure
Design for 10x growth. Will your structure work with 10,000 items?
Querying Taxonomies
Get all items in a category
*[_type == "product" && category._ref == $categoryId]Get items in category OR children
// First get all descendant category IDs
*[_type == "product" && category._ref in
*[_type == "category" && (
_id == $categoryId ||
parent._ref == $categoryId ||
parent->parent._ref == $categoryId
)]._id
]Get category tree
*[_type == "category" && !defined(parent)]{
title,
slug,
"children": *[_type == "category" && parent._ref == ^._id]{
title,
slug,
"children": *[_type == "category" && parent._ref == ^._id]{
title,
slug
}
}
}Common Mistakes
Over-categorization
Creating a category for everything results in mostly-empty categories.
Fix: Start minimal, add categories as content grows.
Inconsistent Granularity
Some categories broad ("Technology"), others narrow ("React 18 Server Components").
Fix: Define clear criteria for category creation.
No Governance
Anyone can create taxonomy terms, leading to duplicates and inconsistency.
Fix: Limit who can create/edit taxonomy documents. Use validation.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Sanity
- Publisher
- Sanity (Official)
- Source
- sanity-io/agent-toolkit · skills/content-modeling-best-practices · commit 3ed3a14
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Sanity or Sanity.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download content-modeling-best-practices.zip