sanity-studio-listeners

sanity-studio-listeners is a skill for Claude Code from sanity-io/agent-toolkit. It costs 153 tokens per session (1,956 once invoked), scanned A, original, MIT.

A coding guide for Sanity Studio, a web editor for Sanity content. It explains how to avoid opening a separate live data connection for every document, card, row, or preview item.

In plain words
What is it for?
Use it when writing or reviewing custom tools, inputs, document views, structures, or plugins that read validation, permissions, previews, or other document data.
Why use it?
Too many live connections can use up the browser's connections to Sanity and make Studio tabs stop loading or hang. It helps keep custom Studio features from multiplying those connections.

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 when writing or reviewing custom tools, inputs, document views, structures, or plugins that read validation, permissions, previews, or other document data.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sanity-io/agent-toolkit/sanity-studio-listeners
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-studio-listeners
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-studio-listeners

README.md
[![agentmods](https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-studio-listeners/github.svg)](https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-studio-listeners)
Your own site
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-studio-listeners"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-studio-listeners/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-studio-listeners

Your own site · 80×15
<a href="https://agentmods.dev/skills/sanity-io/agent-toolkit/sanity-studio-listeners"><img src="https://agentmods.dev/badge/skills/sanity-io/agent-toolkit/sanity-studio-listeners.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 153 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,956 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.00153 $0.01956
Opus 5.5 $0.00061 $0.00782
Sonnet 5.5 $0.00031 $0.00391
Haiku 4.5 $0.00015 $0.00196

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

Security

Grade A, and why

sanity-studio-listeners 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 6d 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-studio-listeners/SKILL.md · 127 lines

How it starts

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

Studio listeners

Studio keeps data live with listeners: long-lived requests that stream changes from the Sanity API. A browser runs at most 100 requests at a time on its connection to the API, and every Studio tab shares that connection (on HTTP/1.1, browsers open only 6 connections per host). A listener holds its slot for as long as it is open, and a Studio tab normally has 6 to 12 open.

Code that opens a listener for every item it renders multiplies by items, then by tabs. Once the slots run out, every request in every tab waits: the newest tab hangs on its spinner, documents and previews stop loading, and a tab that does load can show missing validation errors. The goal is that your code adds a constant number of listeners, never one per item.

Studio already keeps one listener open that follows every document in the dataset. Read documents, validation and permissions through it, and open a listener of your own only when it can't serve the query.

Workflow

  1. Find listeners opened per item. Look in components rendered once per card, row, list item, search result or preview for:

    • useValidationStatus( or useDocumentPairPermissions( without listener: 'global'. By default they load the document the way the editor does, which opens a listener for it.
    • documentStore.listenQuery(, listenQuery(, client.listen(, client.observable.listen(. Every call opens its own listener, even for a query another component already runs.
    • useListeningQuery( from sanity-plugin-utils, and plugins built on it. Each call opens a listener. As of 2.0.23, when the listener fails, its error handler throws "You provided an invalid object where a stream was expected" and the hook stops updating.

    Also look for the same query run by several components (a settings document read by the structure, a tool and a badge).

  2. Check the Studio version. {listener: 'global'} needs sanity 6.24.0 or later. On an older version, propose the upgrade first (see the sanity-studio-upgrade skill).

  3. Replace each one by what the item needs:

Read the full file on GitHub · 127 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 6d ago First seen · 127 lines · 153 tokens per session scan A 7bc68091bc06

Subscribe to this mod's changes

sanity-studio-listeners is a skill published in the GitHub repository sanity-io/agent-toolkit (203 stars, last pushed today), licensed MIT. It adds 153 tokens to every session and 1,956 once invoked, about $0.0006 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-11-24.

Related

sanity-studio-listeners compared with skills from other repositories

sanity-studio-listeners next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
sanity-studio-listenerssanity-io/agent-toolkitSkill203todayMITA153Claude Code
opik-diagnosecomet-ml/opik-claude-code-pluginSkill95d agoApache-2.0A187Claude Code
doctorkalinbogatzevski/captain-memoSkill56d agoApache-2.0A52Claude Code
errorsayrshare/ayrshare-social-media-api-claude-pluginSkill214d agononeA209Claude Code
inventoryggemba/squad-mcpSkill44mo agoApache-2.0A0Claude Code
debugggemba/squad-mcpSkill44mo agoApache-2.0A0Claude Code
opik-explaincomet-ml/opik-claude-code-pluginSkill95d agoApache-2.0A113Claude Code