Skip to content
Back to skills

Sanity

ASecurity

Sanity schemas, GROQ queries, Studio configuration and dataset imports and exports. Use when changing a Sanity content model, writing GROQ, or moving Sanity datasets.

  • 80 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 28, 2026
ai-agentsfrontend

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned October 5, 2026

npx -y skills add monkilabs/opencastle --skill sanity-cms --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sanity?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sanity
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/monkilabs-sanity/badge)](https://www.skillsdirectory.com/skills/monkilabs-sanity)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sanity-cms
description: "Sanity schemas, GROQ queries, Studio configuration and dataset imports and exports. Use when changing a Sanity content model, writing GROQ, or moving Sanity datasets."
---

# Sanity CMS

Project config, schemas, plugins, document types, and GROQ examples: `.opencastle/stack/sanity-config.md`. Docs: https://www.sanity.io/docs

## Rules that prevent silent failures

1. **Call `get_schema` before writing any GROQ.** Field names and shapes are not guessable from the frontend code.
2. **Check array vs single reference.** `author->` on an array field (or `author[]->` on a single one) returns null with **no error** — the query just yields empty data.
3. **Account for the `drafts.` prefix.** Unpublished documents live at `drafts.<id>`; queries and mutations that ignore it silently miss or clobber content.
4. **Local schema files are the source of truth** — never edit a deployed schema in Studio; change local files and redeploy.
5. **Use `defineType` / `defineField`** for every schema — plain object literals lose type safety.
6. **Validate GROQ in Vision against real data** before shipping it.
7. **Queries live in the shared queries library**, never inline in components.

## Change → validate → deploy

1. Edit local schema files; `sanity start` surfaces schema errors immediately.
2. Run representative queries in Vision against local data.
3. For risky changes, `sanity dataset export` then `sanity dataset import` into a temporary dataset and re-run queries there.
4. Deploy the schema, then run a full site build to catch runtime breakage.
5. Any failure: revert locally, fix, restart from step 1.

Files in this skill

  • SKILL.md3 KB
  • config.ts1.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…