Back to Skills

sanity-typegen

verified

Troubleshoot and setup Sanity TypeGen configuration. Use when types are missing or incorrect.

View on GitHub

Marketplace

sanity-agent-toolkit

sanity-io/agent-toolkit

Plugin

sanity-plugin

Repository
Verified Org

sanity-io/agent-toolkit
55stars

sanity-plugin/skills/sanity-typegen/SKILL.md

Last Verified

January 14, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/sanity-io/agent-toolkit/blob/main/sanity-plugin/skills/sanity-typegen/SKILL.md -a claude-code --skill sanity-typegen

Installation paths:

Claude
.claude/skills/sanity-typegen/
Powered by add-skill CLI

Instructions

# TypeGen Setup & Fixer

This skill ensures TypeScript types are generating correctly for the Content Lake.

## Procedure

1.  **Check Configuration**
    * Check if `sanity-typegen.json` exists.
    * If missing, ask: "Do you want me to set up Sanity TypeGen?"
    * If yes, create the file based on `sanity://rules/sanity-typegen.mdc`.

2.  **Check Scripts**
    * Read `package.json`.
    * Ensure a `typegen` script exists: `"sanity schema extract && sanity typegen generate"`.
    * If missing, add it.

3.  **Run & Verify**
    * Run `npm run typegen`.
    * If it fails, read the error log and fix the `sanity-typegen.json` paths (often the `path` glob is incorrect for the project structure).
    * If successful, confirm that `sanity.types.ts` (or configured output) was updated.

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
744 chars