Marketplace
sanity-schema-manager
Manages schema lifecycle including scaffolding, safe field deprecation, and data migrations. Use when modifying existing schemas.
$ Installer
git clone https://github.com/sanity-io/agent-toolkit /tmp/agent-toolkit && cp -r /tmp/agent-toolkit/sanity-plugin/skills/sanity-schema-manager ~/.claude/skills/agent-toolkit// tip: Run this command in your terminal to install the skill
SKILL.md
name: sanity-schema-manager description: Manages schema lifecycle including scaffolding, safe field deprecation, and data migrations. Use when modifying existing schemas.
Schema Manager
This skill handles the lifecycle of Sanity Schema types.
Procedure
-
Scaffold (Create)
- Use templates to create
document,object, orsingletontypes. - Constraint: Ensure
defineTypeanddefineFieldare used. - Constraint: Ensure an icon is imported from
@sanity/icons.
- Use templates to create
-
Deprecate (Update)
- Ask: "Which field do you want to deprecate?"
- Action: Apply the "ReadOnly -> Hidden -> Deprecated" pattern to the field definition.
- Output:
defineField({ name: 'oldField', deprecated: { reason: 'Use newField instead' }, readOnly: true, hidden: ({value}) => value === undefined, initialValue: undefined })
-
Migrate (Data)
- Generate a migration script using
@sanity/migrateor standard client patches. - Template: Iterate over documents ->
patch(doc.id).set({ newField: doc.oldField }).unset(['oldField']).
- Generate a migration script using
-
Clean (Delete)
- Only allow deleting a field definition if the user confirms "I have migrated the data and the field is undefined in all documents."
Repository

sanity-io
Author
sanity-io/agent-toolkit/sanity-plugin/skills/sanity-schema-manager
37
Stars
3
Forks
Updated1w ago
Added1w ago