sanity-singletons

sanity-singletons is a skill for Claude Code from sanity-io/agent-toolkit. It costs 90 tokens per session (4,633 once invoked), scanned A, original, MIT.

Guidance for configuring a Sanity Studio document that exists once under a fixed ID, such as site settings, navigation, or footer content.

In plain words
What is it for?
Use it to register, display, hide, or migrate singleton documents in Sanity Studio, including Structure Tool integration.
Why use it?
It prevents users from creating duplicates or treating a single settings document like a normal list of content. It also covers migration from older custom or third-party approaches.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the sanity plugin — 11 skills, 4 commands, 1 MCP server shipped together

Good fit Use it to register, display, hide, or migrate singleton documents in Sanity Studio, including Structure Tool integration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sanity-io/agent-toolkit/sanity-singletons
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add sanity-io/agent-toolkit --skill sanity-singletons
Clone the repo
git clone --depth 1 https://github.com/sanity-io/agent-toolkit

Made for: Claude Code.

Or install sanity, the plugin that ships this one along with the rest of its 11 skills, 4 commands, 1 MCP server.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sanity-singletons

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-singletons/github.svg)](https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-singletons)
Your own site
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-singletons"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-singletons/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sanity-singletons

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-singletons"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-singletons.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 90 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,633 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00090 $0.04633
Opus 5.5 $0.00036 $0.01853
Sonnet 5.5 $0.00018 $0.00927
Haiku 4.5 $0.00009 $0.00463

Measured 11d ago against content hash 1c525e009a3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sanity-singletons scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/sanity-singletons/SKILL.md · 224 lines

How it starts

The opening of the file, as written. The whole thing — 224 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Sanity Singletons

A "singleton" is a document with a fixed id that can be created exactly once. Common examples: site settings, navigation, footer content. Studio supports singletons as a first-class primitive via the document.singletons configuration registry plus a small set of Structure Tool helpers.

Requires sanity 6.17.0 or later. Check the installed version in the lockfile before using this API. On older Studios, either upgrade first or use the userland pattern (fixed documentId in a custom structure, plus manual newDocumentOptions and duplicate filtering) described in sanity-best-practices → studio-structure.

When to use this skill

  • A developer asks how to create a "settings document" or "singleton".
  • A studio configuration needs a document.singletons registry entry.
  • Structure Tool needs to render a singleton as a list item or document pane.
  • You're migrating an existing userland singleton implementation to the first-class API.
  • You're migrating from a third-party singleton plugin such as sanity-plugin-singleton-management (or its predecessor sanity-plugin-singleton-tools).

Registering a singleton

Singletons are registered in configuration, not on the schema type. A singleton definition binds a definition id to a document id and a schema type:

import {defineConfig, defineSingleton} from 'sanity'

export default defineConfig({
  schema: {
    types: [/* siteSettings and campaign are ordinary document types */],
  },
  document: {
    singletons: [
      // String shorthand — expands to
      // {id: 'siteSettings', documentId: 'siteSettings', schemaType: 'siteSettings'}
      'siteSettings',

      // Definition object. `defineSingleton` is an optional typed identity
      // helper; a plain object literal works too. `id` is omitted here, so it
      // inherits each `documentId`.
      defineSingleton({
        documentId: 'springCampaign',
        schemaType: 'campaign',
        title: 'Spring campaign', // optional display metadata
        initialValue: {season: 'spring'}, // optional per-singleton initial value
      }),
      defineSingleton({
        documentId: 'summerCampaign',
        schemaType: 'campaign',
        title: 'Summer campaign',
        initialValue: {season: 'summer'},
      }),
    ],
  },
})

Read the full file on GitHub · 224 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago Changed · +24 lines 1c525e009a3f
  2. 1mo ago First seen · 200 lines · 90 tokens per session scan A 1234349f082c

Subscribe to this mod's changes

sanity-singletons is a skill published in the GitHub repository sanity-io/agent-toolkit (203 stars, last pushed today), licensed MIT. It adds 90 tokens to every session and 4,633 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-13.

Related

sanity-singletons compared with skills from other repositories

sanity-singletons next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
sanity-singletonssanity-io/agent-toolkitSkill203todayMITA90Claude Code
verifywenlan-app/wenlanSkill502todayApache-2.0A63Claude Code
run-wenlanwenlan-app/wenlanSkill502todayApache-2.0C53Claude Code
webhooksayrshare/ayrshare-social-media-api-claude-pluginSkill215d agononeA205Claude Code
api-lifecycledoancan/magsSkill39mo agoMITA58Claude Code
n8n-subworkflowsczlonkowski/n8n-mcpSkill23ktodayMITA121Claude Code, Codex
add-cloud-flowmicrosoft/power-platform-skillsSkill1.2ktodayMITA91Claude Code