원클릭으로
sanity
Manages Sanity CMS content via API. Use for querying, analyzing, and modifying documents including drafts.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Manages Sanity CMS content via API. Use for querying, analyzing, and modifying documents including drafts.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Queries Salesforce Commerce Cloud via OCAPI Shop API. Use for categories, products, and product search.
Queries Shopify via Admin and Storefront GraphQL APIs. Use for products, collections, filters, inventory, and orders.
| name | sanity |
| description | Manages Sanity CMS content via API. Use for querying, analyzing, and modifying documents including drafts. |
bun --env-file=.claude/skills/sanity/.env .claude/skills/sanity/scripts/query.js --query='*[_type == "homePage"][0]'
Always check the schema first — type names are not guessable (e.g. productPage, not product). Use GROQ introspection to discover types:
bun --env-file=.claude/skills/sanity/.env .claude/skills/sanity/scripts/query.js --query='array::unique(*[]._type) | order(@)'
If a schema.json file is available (check tmp/), use it for field-level details:
# List all document types
jq '[.[].name] | sort' tmp/schema.json
# Fields for a specific type
jq '.[] | select(.name == "TYPE") | .fields[] | .name' tmp/schema.json
# Full field details (name, type, required)
jq '.[] | select(.name == "TYPE") | .fields[] | {name, type: .type.type, required: (.validation // [] | map(select(.flag == "presence")) | length > 0)}' tmp/schema.json
query.js — GROQ queries
bun --env-file=.claude/skills/sanity/.env .claude/skills/sanity/scripts/query.js --query='*[_type == "homePage"][0]'
bun --env-file=.claude/skills/sanity/.env .claude/skills/sanity/scripts/query.js --query='*[_type == "page"][0...5] { _id, title }' --dataset=acceptance
Options:
--query=<groq> — GROQ query string (required)--params=<json> — query parameters (optional)--dataset=<name> — dataset name (default: development)--perspective=<name> — raw, previewDrafts, or published (default: raw)Write a custom script for: pagination, data transformation, or mutations.
Env vars: SANITY_PROJECT_ID, SANITY_API_TOKEN.
import { createClient } from '@sanity/client';
const client = createClient({
projectId: process.env.SANITY_PROJECT_ID,
dataset: 'development', // or 'acceptance'
apiVersion: '2026-01-01',
token: process.env.SANITY_API_TOKEN,
useCdn: false,
perspective: 'raw', // or 'previewDrafts', 'published'
});
| Perspective | Use case |
|---|---|
raw | See exact documents including drafts.* IDs |
previewDrafts | Drafts overlay published (like preview mode) |
published | Published documents only |
// Query
const docs = await client.fetch('*[_type == "homePage"]');
// Delete
await client.delete('drafts.some-id');
// Bulk delete (single transaction for circular refs)
const tx = client.transaction();
ids.forEach(id => tx.delete(id));
await tx.commit();
// Patch
await client.patch('doc-id').set({ field: 'value' }).commit();
// Create
await client.createOrReplace({ _id: 'my-id', _type: 'myType', title: 'Doc' });
my-doc-iddrafts.my-doc-idReferences should use base ID (my-doc-id). If a draft references drafts.X explicitly, preview mode breaks.
*[_type == "page"] { "title": title[_key == "en"][0].value }