Skip to content
Development
Command

/sanity-review

Review code for Sanity best practices and common issues.

From plugin
1714 skills4 commands1 MCP
shell
$ npx -y skills add sanity-io/agent-toolkit --agent claude-code

Ships with sanity. Installing the plugin gets this command.

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/sanity-review

Context preview

What this command does when you run it.

Review code for Sanity best practices and common issues.

Command definition

sanity-review.md
name: sanity-review
description: Review code for Sanity best practices and common issues.

Sanity Code Review

I'll review your Sanity code for best practices. Here's what I check:

Schema Review

1. **Definition Syntax**

  • Using `defineType`, `defineField`, `defineArrayMember`
  • Icons assigned from `@sanity/icons`
  • Proper validation rules

2. **Data Modeling**

  • "Data > Presentation" philosophy (no `bigHero`, `redButton`)
  • Correct use of references vs nested objects
  • Proper deprecation pattern for removed fields

3. **Organization**

  • File naming conventions (kebab-case)
  • Schema directory structure

Query Review

1. **TypeGen Compatibility**

  • Queries wrapped in `defineQuery`
  • SCREAMING_SNAKE_CASE naming
  • Proper field projections (not `*`)

2. **Performance**

  • No unnecessary deep expansions
  • Using query parameters (not string interpolation)

Frontend Review

1. **Visual Editing**

  • Using `_key` for array item keys (not index)
  • `stegaClean` for logic-critical values
  • No stega in `<head>` tags

2. **Type Safety**

  • Using generated types from `sanity.types.ts`
  • No manual typing of query results

Usage

Just ask me to review specific files or your whole Sanity setup: > "Review my post schema" > "Check my GROQ queries for issues" > "Review my Sanity frontend integration"

Read it on GitHub โ†—
Ships withsanity

Collection of resources to help AI agents build better with Sanity.

Get the whole plugin, auto-invoked
Stats
171
Stars
0
Views
25
Forks
Active
Maintenance
JavaScript
Language
MIT
License
6h ago
Last commit
1y ago
Created

Repo: sanity-io/agent-toolkit