Give AI agents intelligent access to your Sanity content. Unlike embedding-only approaches, Agent Context is schema-aware—agents can reason over your content structure, query with real field values, follow references, and combine structural filters with semantic search.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versioncreate-agent-with-sanity-contextExecute the skills CLI command in your project's root directory to begin installation:
Fetches create-agent-with-sanity-context from sanity-io/agent-context and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate create-agent-with-sanity-context. Access via /create-agent-with-sanity-context in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
0
total installs
0
this week
4
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
4
stars
Give AI agents intelligent access to your Sanity content. Unlike embedding-only approaches, Agent Context is schema-aware—agents can reason over your content structure, query with real field values, follow references, and combine structural filters with semantic search.
What this enables:
Agent Context gives agents your schema and teaches them GROQ, but it can't know your domain. You close that gap through the Instructions field (dataset-specific query guidance) and optionally the system prompt (agent behavior and tone).
Three actors in this workflow:
Before starting, gather these credentials:
| Credential | Where to get it |
|---|---|
| Sanity Project ID | Your sanity.config.ts or sanity.io/manage |
| Dataset name | Usually production — check your sanity.config.ts |
| Sanity API read token | Run npx sanity tokens add "Agent Context" --role=viewer --yes --json from the project directory (or pass --project-id=<id>). Alternatively, create at sanity.io/manage → Project → API → Tokens with Viewer role. |
| LLM API key | From your LLM provider (Anthropic, OpenAI, etc.) — any provider works |
An MCP server that gives AI agents structured access to Sanity content. The core integration pattern:
MCP URL formats:
https://api.sanity.io/v2026-03-03/agent-context/:projectId/:dataset — Base URL. No document needed, configure via query params or use as-is.https://api.sanity.io/v2026-03-03/agent-context/:projectId/:dataset/:slug — Document URL. Applies the configuration from an Agent Context document.Agent Context documents (type sanity.agentContext) are created in Sanity Studio and configure the MCP endpoint. They have three fields:
| Field | Schema field | Purpose |
|---|---|---|
| Slug | slug |
Unique URL identifier — becomes the :slug in the MCP URL |
| Instructions | instructions |
Domain-specific guidance for the agent, injected into tool descriptions |
| Content Filter | groqFilter |
A GROQ expression scoping which documents the agent can access |
This means Studio users can manage agent behavior without touching code — updating instructions or narrowing the content filter takes effect immediately.
URL query params override the document's configuration (useful for testing and development):
?instructions=<content> — Override instructions (use ?instructions="" for a blank slate)?groqFilter=<expression> — Override the content filterThe integration is simple: Connect to the MCP URL, get tools, use them. The reference implementation shows one way to do this—adapt to your stack and LLM provider.
| Tool | Purpose |
|---|---|
initial_context |
Get compressed schema overview (types, fields, document counts) |
groq_query |
Execute GROQ queries with optional semantic search |
schema_explorer |
Get detailed schema for a specific document type |
For development and debugging: The general Sanity MCP provides broader access to your Sanity project (schema deployment, document management, etc.). Useful during development but not intended for customer-facing applications.
A complete integration has three distinct components that may live in different places:
| Component | What it is | Examples |
|---|---|---|
| 1. Studio Setup | Configure the context plugin and create agent context documents | Sanity Studio (separate repo or embedded) |
| 2. Agent Implementation | Code that connects to Agent Context and handles LLM interactions | Next.js API route, Express server, Python service, or any MCP-compatible client |
| 3. Frontend (optional) | UI for users to interact with the agent | Chat widget, search interface, CLI—or none for backend services |
A deployed Studio (v5.1.0+) is always required. Not every integration needs the agent context plugin or document—the base MCP URL works without them, so users can start with just agent implementation and add document configuration later—or vice versa. Frontend depends on the use case (many agents run as backend services or integrate into existing UIs).
Ask the user which part they need help with:
Also understand:
The reference patterns use Next.js + Vercel AI SDK, but adapt to whatever the user is working with.
Before building the production agent, validate that the MCP endpoint is reachable. If the user doesn't have a read token yet, offer to create one from the terminal — detect the projectId from sanity.config.ts or sanity.cli.ts if available:
npx sanity tokens add "Agent Context" --role=viewer --yes --json
This outputs JSON with the token value. If not inside a Sanity project directory, pass --project-id=<id> explicitly.
Then test the endpoint:
curl -X POST https://api.sanity.io/v2026-03-03/agent-context/:projectId/:dataset \
-H "Authorization: Bearer $SANITY_API_READ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}'
This confirms the token works and the endpoint is reachable. The base URL (no slug) works without an Agent Context document—add a slug to apply a document's configuration.
The user already has an agent or MCP client? They just need to connect it to their Agent Context URL with a Bearer token. The tools will appear automatically.
Building from scratch? Help the user set up the MCP connection and LLM integration. The reference implementations use Vercel AI SDK with Anthropic, but the pattern works with any LLM provider (OpenAI, local models, etc.). Start with the basics and add advanced patterns as needed.
Framework-specific guides:
System prompts (applies to all frameworks): See references/system-prompts.md for structure and domain-specific examples (e-commerce, docs, support, content curation).
The framework guides cover:
react-markdown or marked is needed to display formatted output)Help the user configure the @sanity/agent-context/studio plugin in their Studio and create an Agent Context document. This document controls what the production agent can see (via groqFilter) and what guidance it receives (via instructions).
See references/studio-setup.md
Track and analyze agent conversations using Sanity Functions. Useful for analytics, debugging, and understanding user interactions.
See references/conversation-classification.md.
Once the production agent works:
Tune the Instructions field using the dial-your-context skill — an interactive session where you explore the user's dataset together, verify findings, and produce concise Instructions that teach the production agent what the schema alone doesn't make obvious: counter-intuitive field names, second-order reference chains, data quality issues, required filters, and query patterns. The skill can also help configure a groqFilter to scope what content the production agent sees.
Shape the system prompt (optional) using the shape-your-agent skill — if the user controls the production agent's system prompt, this helps define tone, boundaries, and guardrails. Skip this if the user doesn't control the system prompt.
Agent Context supports text::semanticSimilarity() for semantic ranking:
*[_type == "article" && category == "guides"]
| score(text::semanticSimilarity("getting started tutorial"))
| order(_score desc)
{ _id, title, summary }[0...10]
Always use order(_score desc) when using score() to get best matches first.
The MCP connection pattern is framework and LLM-agnostic. Whether Next.js, Remix, Express, or Python FastAPI—the HTTP transport works the same. Any LLM provider that supports tool calling will work.
See references/adapting-to-stacks.md for:
See references/system-prompts.md for domain-specific examples (e-commerce, docs, support, content curation).
_id in projections so agents can reference documentsgroqFilter to scope what the production agent sees — start broad, then narrow based on what it actually needs. The filter is a full GROQ expression (e.g., _type in ["product", "article"])dial-your-context skill.shape-your-agent skill.package.json files or use npm info <package> version rather than guessing. AI SDK and Sanity packages update frequently, and using outdated versions will cause errors that are hard to debug.Agent Context requires a deployed Studio. See Deploy Your Studio for instructions.
The SANITY_API_READ_TOKEN is missing or invalid. Generate a new token from the terminal:
npx sanity tokens add "Agent Context" --role=viewer --yes --json
Or create one at sanity.io/manage → Project → API → Tokens with Viewer role.
Check the Agent Context document's content filter (groqFilter):
mcpClient.tools() returns tools (log it)Make data-driven prioritization decisions faster
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Prerequisites
Time Estimate
30-60 minutes to see productivity improvements
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid when
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
mattpocock/skills
parcadei/continuous-claude-v3
cursor/plugins
ailabs-393/ai-labs-claude-skills
ailabs-393/ai-labs-claude-skills
pproenca/dot-skills
I recommend create-agent-with-sanity-context for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
I recommend create-agent-with-sanity-context for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
create-agent-with-sanity-context fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
Solid pick for teams standardizing on skills: create-agent-with-sanity-context is focused, and the summary matches what you get after install.
Registry listing for create-agent-with-sanity-context matched our evaluation — installs cleanly and behaves as described in the markdown.
create-agent-with-sanity-context has been reliable in day-to-day use. Documentation quality is above average for community skills.
create-agent-with-sanity-context reduced setup friction for our internal harness; good balance of opinion and flexibility.
create-agent-with-sanity-context fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
create-agent-with-sanity-context fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
I recommend create-agent-with-sanity-context for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
showing 1-10 of 47