deploy-schema
CommandDeploy Sanity schema to the Content Lake with verification.
Run Sanity TypeGen and troubleshoot type generation issues.
> /plugin marketplace add sanity-io/agent-toolkit> /plugin install sanity@sanity-agent-toolkit
name: typegen description: Run Sanity TypeGen and troubleshoot type generation issues.
I'll help you generate TypeScript types from your Sanity schema.
npm run typegen # or npx sanity schemas extract && npx sanity typegen generate
1. **Check Configuration**
2. **Run TypeGen**
3. **Troubleshoot Issues**
| Issue | Solution | |-------|----------| | "No schema found" | Fix `path` glob in `sanity.cli.ts` typegen config | | "Query not typed" | Wrap in `defineQuery()` or `groq` template | | Types outdated | Re-run after schema/query changes, or enable automatic generation | | Import errors | Check `sanity.types.ts` output path | | Using `sanity-typegen.json` | Migrate config to `sanity.cli.ts` (deprecated) |
Configure TypeGen in `sanity.cli.ts`:
// sanity.cli.ts
import { defineCliConfig } from 'sanity/cli'
export default defineCliConfig({
typegen: {
enabled: true, // Auto-generate during sanity dev/build
path: "./src/**/*.{ts,tsx,js,jsx,astro,svelte,vue}",
schema: "schema.json",
generates: "./sanity.types.ts",
overloadClientMethods: true,
},
})> "Run typegen" > "Fix my TypeGen configuration" > "Why are my types not updating?" > "Enable automatic type generation"
Deploy Sanity schema to the Content Lake with verification.
Review code for Sanity best practices and common issues.
Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.