sanity-singletons
Installation
SKILL.md
Sanity Singletons
A "singleton" is a document with a fixed id that can be created exactly once. Common examples: site settings, navigation, footer content. Studio supports singletons as a first-class primitive via the document.singletons configuration registry plus a small set of Structure Tool helpers.
When to use this skill
- A developer asks how to create a "settings document" or "singleton".
- A studio configuration needs a
document.singletonsregistry entry. - Structure Tool needs to render a singleton as a list item or document pane.
- You're migrating an existing userland singleton implementation to the first-class API.
- You're migrating from a third-party singleton plugin such as
sanity-plugin-singleton-management(or its predecessorsanity-plugin-singleton-tools).
Registering a singleton
Singletons are registered in configuration, not on the schema type. A singleton definition binds a definition id to a document id and a schema type:
import {defineConfig, defineSingleton} from 'sanity'