Sanity schema design
Schema conventions for Sanity studios that editors actually enjoy using. The recurring theme: every field teaches the editor what it does, every type carries an icon, and the folder structure scales past the tenth page builder block without turning into a junk drawer.
Basic structure
For TypeScript files, always import the Sanity helpers and use them everywhere: defineType around the whole type, defineField on every field, defineArrayMember only when needed.
Always use named exports for schema types.
Icons
Every document and block type gets an icon. Prefer @sanity/icons first; fall back to whichever icon set the project already has installed (lucide-react is common). An iconless type in a page builder insert menu is unfindable once the menu passes ten entries.
Studio folder structure
Rough shape, with an index at each level so types compose into arrays near where they live:
Do not copy these names literally; the point is the layering. documents/ for queryable document types, blocks/ for page builder sections, definitions/ for reusable field-level types.
Block index pattern
Each folder's index.ts exports an array, so registering a new block is one import plus one array entry, and the root index stays small:
Common field templates
Every field gets a name, title, description, and type, with the description written for a non-technical editor and placed above type. These templates cover the fields almost every block needs:
Eyebrow
Title
Heading level toggle
Rich text
Buttons
Image
Type generation
After adding or changing schema, regenerate TypeScript definitions:
Run this in the same change as the schema edit so the frontend types never drift.
Building schema from screenshots
When asked to produce schema from a design screenshot, describe the types using the conventions above and lean on these visual cues:
- Tiny text above a title is likely an eyebrow
- Large unformatted text that reads as a header is a title or subtitle
- Text with formatting (bold, italics, lists) needs richText
- Every image gets an alt text field
- Repeated button patterns use the reusable button array
- If the project already defines
richTextFieldorbuttonsFieldhelpers, use them
Always include editor-facing descriptions based on what the element does in the design.
About this skill
Maintained by Roboto Studio, a UK agency that has shipped Sanity studios for startups through enterprise. It distills the schema conventions we hold every project to. If you would rather have it done for you: robotostudio.com/services/sanity.
Licensed MIT. Wow, I can't believe people are actually using these. Tell me if it worked: yo@robotostudio.com