A comprehensive skill for working with Sanity Content Operating System, following Anthropic's skill authoring best practices.
sanity-development/
├── SKILL.md # Main skill file (overview, tool selection, common patterns)
├── README.md # This file
└── reference/
├── groq-patterns.md # Advanced GROQ query patterns and examples
├── schema-design.md # Schema design best practices
└── debugging.md # Common pitfalls and debugging workflows
The skill follows a progressive disclosure pattern:
- SKILL.md contains essential information Claude needs for most Sanity operations
- Reference files provide deep-dive content for complex scenarios
- Claude reads reference files only when needed for specific tasks
Claude should use this skill when:
- Working with Sanity projects
- Writing or debugging GROQ queries
- Creating, updating, or querying documents
- Designing schemas or content models
- Managing releases and versioning
- Handling Sanity-specific operations
Always check schema before querying content to avoid failed queries and ensure correct field references.
query_documents- Search and retrievecreate_document- AI-generated contentpatch_document- Precise changes (no AI)update_document- AI-powered rewritestransform_document- Format-preserving transformations
- Verify document existence before operations
- Respect 5-document operation limit
- Use releases for coordinated updates
- Check array vs single reference in schema
- Quote computed field names in GROQ projections
# Basic query with filtering
*[_type == "post" && published == true][0...10]
# With projections (note quoted field names)
*[_type == "post"]{ _id, title, "author": author->name }
# References
*[_type == "post" && author._ref == $id] # Single reference
*[_type == "post" && $id in authors[]._ref] # Array reference
# Text search
*[_type == "post" && body match text::query("search")]
// Create
create_document({ type, instruction, resource, workspaceName });
// Update with AI
update_document({ operations, paths, resource, workspaceName });
// Precise edit
patch_document({ documentId, operation, resource, workspaceName });
// Publish
publish_document({ id, resource });Main entry point covering:
- Tool selection guide
- Schema-first principle
- Common GROQ patterns
- Document operations
- Releases workflow
- Anti-patterns
- Best practices
Keep under 500 lines per best practices.
Deep dive into GROQ:
- Filtering and operators
- Joins and dereferencing
- Aggregations
- Performance optimization
- Error prevention
- Advanced patterns
Schema best practices:
- Document type design
- Field types and validation
- References and relationships
- Portable Text patterns
- Localization strategies
- Performance considerations
Troubleshooting guide:
- Common GROQ errors
- Schema validation issues
- Reference problems
- Performance issues
- Document operation errors
- Tool selection mistakes
- Debugging workflows
- Assume Claude knows basics
- Only add Sanity-specific knowledge
- Remove redundant explanations
When new patterns emerge:
- Add to appropriate reference file
- If critical, add brief mention in SKILL.md
- Keep SKILL.md under 500 lines
Test with:
- Various document types
- Different query complexities
- Multiple tool combinations
- Error scenarios
- SKILL.md covers 80% of use cases
- Reference files handle edge cases and deep dives
- Progressive disclosure keeps context window efficient
- Consistent terminology throughout all files
Tools are categorized by operation type (discovery, creation, modification, lifecycle) rather than alphabetically, making selection intuitive.
Repeated emphasis on checking schema first because it's the single most important pattern for preventing query failures.
The skill includes specific recommendations (not just options) because:
- Reduces cognitive load
- Prevents common mistakes
- Follows Sanity best practices
- Provides clear defaults with escape hatches
When updating this skill:
- Follow concise writing principles
- Use concrete examples over abstract explanations
- Keep SKILL.md under 500 lines
- Test changes with real Sanity operations
- Maintain consistent terminology
- Update README if structure changes
- v1.0 (2025-10-29): Initial skill creation
- Core tool selection guide
- GROQ pattern reference
- Schema design guide
- Debugging and pitfalls reference
- Following Anthropic best practices for skills