Agent skill
sanity-schema-manager
Manages schema lifecycle including scaffolding, safe field deprecation, and data migrations. Use when modifying existing schemas.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/sanity-schema-manager
SKILL.md
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:
typescript
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."
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?