sanity-app-sdk

Installation
SKILL.md

Sanity App SDK

Get the maintained guide first

If the Sanity MCP server is configured, call its get_sanity_rules tool with the app-sdk rule before writing SDK code. That rule is maintained by Sanity, is more detailed, and supersedes the notes below. The notes below are a fallback for when MCP is not available.

Picking a hook

  • useDocuments / usePaginatedDocuments: lists of documents. Returns document handles, not full documents.
  • useDocumentProjection: read specific fields from a handle, for display.
  • useDocument plus useEditDocument: read and write a single document in real time.
  • useQuery: raw GROQ. Use sparingly; prefer handles plus projections.

Document handles

Fetch handles first, then spread them into other hooks:

const {data} = useDocuments({documentType: 'article'})
Installs
1
Repository
sanity-io/cli
GitHub Stars
11
First Seen
Oct 27, 2026