> sanity
Assists with building content platforms using Sanity's structured content and real-time collaboration features. Use when defining schemas, writing GROQ queries, configuring Sanity Studio, or integrating with Next.js for content-driven sites. Trigger words: sanity, groq, sanity studio, structured content, portable text, content lake, sanity schema.
curl "https://skillshub.wtf/TerminalSkills/skills/sanity?format=md"Sanity
Overview
Sanity is a structured content platform with real-time collaboration, GROQ querying, and a customizable React-based Studio. Content is stored in the Content Lake with CDN delivery, Portable Text for structured rich content, and visual editing capabilities for live frontend previews.
Instructions
- When defining schemas, use
defineType()anddefineField()with validation rules, model content for reuse by separating pages from content blocks, and use references over inline objects for shared content. - When querying data, write GROQ queries with projections to fetch only needed fields, use the
->dereference operator for joined data, and setuseCdn: truefor production reads. - When customizing Sanity Studio, configure desk structure for sidebar navigation, add custom input components for specialized editing, and create custom publish workflows with actions.
- When building rich content, use Portable Text which is structured data (not HTML) that renders on any platform, with customizable toolbar, custom blocks, and inline objects.
- When integrating with Next.js, use
next-sanitywith ISR, preview mode, and visual editing, and@sanity/visual-editingfor click-to-edit overlays in the frontend. - When managing environments, use datasets (production, staging, development) for content isolation, GROQ-powered webhooks for filtered build triggers, and set
apiVersionto a specific date to avoid breaking changes. - When handling images, use Sanity's image with hotspot for focal point selection and
sanity-image-urlfor generating responsive image URLs with transforms.
Examples
Example 1: Build a content-driven marketing site
User request: "Set up Sanity with Next.js for a marketing site with modular page builder"
Actions:
- Define page, hero, feature, CTA, and testimonial schemas as reusable block types
- Configure Sanity Studio with desk structure and live preview
- Set up
next-sanitywith ISR and GROQ queries for each page type - Enable visual editing with
@sanity/visual-editingfor click-to-edit overlays
Output: A modular marketing site where editors build pages from reusable content blocks with live preview.
Example 2: Implement real-time content preview
User request: "Add live preview to our Sanity + Next.js site so editors see changes as they type"
Actions:
- Configure Sanity Studio's Presentation tool for side-by-side editing
- Set up
@sanity/visual-editingin the Next.js frontend for click-to-edit overlays - Use
client.listen()for real-time content updates in preview mode - Configure draft content display with
!(_id in path("drafts.**"))filtering
Output: A live editing experience where content changes appear in the frontend as editors type.
Guidelines
- Use
defineType()anddefineField()for schema definitions; they provide TypeScript types for the Studio. - Model content for reuse: separate pages from content blocks so blocks can appear on any page.
- Use references over inline objects for content that appears in multiple places.
- Query with GROQ projections to fetch only needed fields, not entire documents.
- Use the CDN API (
useCdn: true) for production reads; it is free and fast. - Set
apiVersionto a specific date to avoid breaking changes. - Use Portable Text for rich content; it is structured data that renders on any platform.
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> xero-accounting
Integrate with the Xero accounting API to sync invoices, expenses, bank transactions, and contacts — and generate financial reports like P&L and balance sheet. Use when: connecting apps to Xero, automating bookkeeping workflows, syncing accounting data, or pulling financial reports programmatically.
> windsurf-rules
Configure Windsurf AI coding assistant with .windsurfrules and workspace rules. Use when: customizing Windsurf for a project, setting AI coding standards, creating team-shared Windsurf configurations, or tuning Cascade AI behavior.