Skip to main content
Exécutez n'importe quel Skill dans Manus
en un clic

sanity-keys-and-ids

Étoiles16
Forks7
Mis à jour7 juillet 2026 à 16:25

How to handle Sanity document `_id`s and array `_key`s correctly across every write surface in this repo. Covers why deterministic IDs (hashed emails, derived strings) are an anti-pattern, the reference-field + GROQ-filter pattern that replaces them, and the per-surface mechanism for `_key` generation: `autoGenerateArrayKeys` for `@sanity/client`, automatic key handling in App SDK hooks (`useEditDocument`, `useApplyDocumentActions`), and automatic key handling in `sanity/migrate`. Use when writing or reviewing any code that creates, upserts, or patches Sanity content -- particularly `client.create*`, `client.patch().commit()`, mutations from `@sanity/sdk-react`, or `defineMigration`. Triggers on `_id`, `_key`, `generateKey`, hashed document IDs, `createIfNotExists`, `append/insert/setIfMissing`, and any helper that builds a Sanity `_id` or `_key` from another value.

Installation

Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.

SKILL.md
readonly