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.
npx skills add sanity-io/next-sanity --skill next-cache-components-optimizergit clone --depth 1 https://github.com/sanity-io/next-sanityWrote 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.
[](https://agentmods.dev/skills/sanity-io/next-sanity/next-cache-components-optimizer)<a href="https://agentmods.dev/skills/sanity-io/next-sanity/next-cache-components-optimizer"><img src="https://agentmods.dev/badge/skills/sanity-io/next-sanity/next-cache-components-optimizer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00170 | $0.06003 |
| Opus 5 | $0.00085 | $0.03002 |
| Sonnet 5 | $0.00034 | $0.01201 |
| Haiku 4.5 | $0.00017 | $0.00600 |
Grade A, and why
next-cache-components-optimizer 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 8d 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.
This is a copy
97% identical to next-cache-components-optimizer — 24 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 480 lines — stays where its author put it; the contents beside it link to each section on GitHub.
next-cache-components-optimizer
Set up an agentic optimization loop that drives a Next.js route from "not
instant" to "instant" and keeps it there. The loop is test-driven: encode the
goal as a failing @next/playwright instant() test, work it to green, and
ship the test as the regression guard. Run it once per target route. Work the
phases P → G in order; each ends in a gate. Fix recipes live in two lazily-read
references — reference/patterns.md (before→after for each blocker type) and
reference/real-app-patterns.md (parallel routes, auth gates, the empty-shell
and responsive-skeleton failure modes). Read one only when its phase points
there.
What is invariant, and what is yours
One thing here is fixed. The rest is yours. Read this before treating any command, platform, or env var below as a requirement.
- Invariant: the verification loop. Maximizing the shell is worthless unless you can prove it. The proof is an automated check: under a lock that gates dynamic data, the static shell still commits. RED shows the gap, GREEN shows it closed, the test ships as the regression guard. It must run on a production-like build and must not be able to pass vacuously. Stand the loop up once; every later optimization is then verifiable by construction. The loop is the deliverable, not any one route.
- The mechanism:
@next/playwrightinstant(). This skill usesinstant()as a ruler, not a stopwatch (phase A). It comes from@next/playwright(installed alongside@playwright/test, on the same release line asnext), so it isn't tied to any host. Keep it. Timing a navigation by hand is too flaky to trust, and is the failure mode this skill exists to prevent. - Yours: the rig. How you build, deploy, authenticate, configure
Playwright, and loop belongs to your stack, not to this skill. A local
next build && next start, a CI/staging container, and a per-push preview deploy are equally valid rigs; the verdict comes from the build, never the platform. Phase 0 maps the invariant onto your repo. Read every platform name, env-var spelling, and command below as an example to translate, not a requirement.
What ships with it
5 files 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.
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.
- 8d ago First seen · 480 lines · 170 tokens per session scan A bea6ca9e35d2
next-cache-components-optimizer is a skill published in the GitHub repository sanity-io/next-sanity (949 stars, last pushed yesterday), licensed MIT. It adds 170 tokens to every session and 6,003 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. It is 97% identical to next-cache-components-optimizer, differing in 24 lines, and is treated as a copy.
Other skills, from other repositories
new-block
Scaffold a new page builder block for Turbo Start Sanity end-to-end — Sanity schema, GROQ projection, styled React component, Markdown serializer, tests, and all registrations. Use when asked to add, create, or scaffold a new page builder block, section, or content module (e.g. "add a testimonials block", "create a…
sanity-live-cache-components
Integrates Sanity Live with Next.js Cache Components in next-sanity v13+ apps. Sets up sanityFetch, , Visual Editing, Presentation Tool, draft mode handling, and the three-layer (Page/Dynamic/Cached) component pattern with explicit perspective/stega prop-drilling. Use when configuring or migrating a Next.js app to…
next-cache-components
Next.js 16 Cache Components - PPR, use cache directive, cacheLife, cacheTag, updateTag.
create-example
Create a new Liveblocks example app for the gallery under examples/. Use when asked to build a new example, demo, or showcase app, or when restructuring an existing example. Covers scaffolding, gallery conventions (exampleId, examplePreview, database.ts, HelpButton), providers configuration, AI patterns, styling…
vercel-composition-patterns
React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.
vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance…