Claude Code skill for Sanity Studio advisory field validation
Configure an advisory custom warning for an optional Sanity field, then compare empty and valid inputs in the Studio interface.
中文Install in Claude Code
Use Claude Code with a compatible local Sanity Studio development setup. Select an ordinary string field and check validation feedback in the local Studio interface.
- Review `.claude/skills/sanity-schema-validation/SKILL.md` and its requirements at the pinned GitHub commit.
- Create `.claude/skills/sanity-schema-validation/` in your project and save the reviewed file as `.claude/skills/sanity-schema-validation/SKILL.md`.
- Start Claude Code from that project's root, then select `/sanity-schema-validation` in the slash menu.
Example task
Add validation for the optional caption field. Use `rule.warning().custom(...)` and return the given message for empty content and true otherwise.
`caption` · `""` · `"Gallery view"` · `Add a short caption`What to check
An empty value shows `Add a short caption`, while the rule permits publishing. The warning clears for `Gallery view`.
Original SKILL.md on GitHub · Updated
Frequently asked question
How can I tell whether this is a warning or a publish-blocking error?
Set the level on the rule chain, compare empty and valid input in local Sanity Studio, and check whether other rules report errors.