| name | sanity-typegen |
| description | Troubleshoot and setup Sanity TypeGen configuration. Use when types are missing or incorrect. |
TypeGen Setup & Fixer
This skill ensures TypeScript types are generating correctly for the Content Lake.
Procedure
Check Configuration
- Check if
sanity-typegen.jsonexists. - If missing, ask: "Do you want me to set up Sanity TypeGen?"
- If yes, create the file based on
sanity://rules/sanity-typegen.mdc.
- Check if
Check Scripts
- Read
package.json. - Ensure a
typegenscript exists:"sanity schema extract && sanity typegen generate". - If missing, add it.
- Read
Run & Verify
- Run
npm run typegen. - If it fails, read the error log and fix the
sanity-typegen.jsonpaths (often thepathglob is incorrect for the project structure). - If successful, confirm that
sanity.types.ts(or configured output) was updated.
- Run