sanity-development

Author GROQ queries and manage Sanity document lifecycle operations.

Updated Oct 29, 2025
One-click install
npx skills add https://github.com/kmelve/sanity-developer-skill --skill sanity-development
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sanity-development
Source: https://github.com/kmelve/sanity-developer-skill/tree/main
Command: npx skills add https://github.com/kmelve/sanity-developer-skill --skill sanity-development

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you avoid broken Sanity queries and unsafe content updates by enforcing a schema-first workflow and pairing the right Sanity tool to the right task.

Core Features & Use Cases

  • Schema-first querying: Always verify workspaces and document schemas before writing GROQ or assuming fields exist.
  • Correct GROQ patterns: Build robust filters, projections (including quoted computed fields), joins/dereferencing, and modern text search using match text::query().
  • Safe document operations: Choose between query_documents, create_document, patch_document (precise edits), update_document (AI rewrites), transform_document (format-preserving rich text edits), and release-based coordination.

Use this when you need to write or debug GROQ, create/update/query Sanity documents, design content models, or coordinate multi-document publish workflows with releases.

Quick Start

Ask for the exact GROQ query you need for a specific Sanity document type after first retrieving the workspace schema, including the correct projection and any dereferenced fields.

Frequently Asked Questions about sanity-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write safe GROQ queries for Sanity documents without breaking projections?▼

To write safe GROQ queries, first retrieve the workspace schema to verify document fields exist, then apply specific syntax rules for computed projections, references, and modern text search using match text::query().

What is the correct way to update Portable Text in a Sanity document?▼

Use the transform_document operation to apply format-preserving rich text edits to Portable Text fields, ensuring the existing document structure and formatting remain intact during updates.

When should I use patch_document versus update_document for Sanity content operations?▼

Use patch_document for precise field edits within Sanity datasets, and use update_document when you need AI-driven rewrites of the document content, ensuring you select the correct operation for the task.

Does this workflow support coordinating release-based changes across multiple Sanity documents?▼

Yes, it supports release-based coordination, allowing you to safely group, schedule, and publish changes across multiple Sanity documents and datasets within a structured release lifecycle.

Why do my Sanity GROQ queries fail when assuming document fields exist?▼

GROQ queries fail because a schema-first workflow is mandatory; you must fetch and verify workspaces and document schemas before writing queries to avoid broken filters and unsafe content updates.