agentleFS
sanity-iosanity-io/agent-toolkit/AGENTS.md

agent-toolkit

AGENTS.md194 starsChanged 6 months agoMITView on GitHub

This is a Sanity-powered project. Use the Knowledge Router below to find Sanity guidance for your task. Available as a Claude Code plugin and Cursor plugin. If the Sanity MCP server (https://mcp.sanity.io) is available, use listsanityrules and getsanityrules to load always up-to-date rules on demand. Otherwise, use the table below to find local reference files. For the full reference index, see skills/sanity-best-practices/SKILL.md.

  • Reads credentials

We split this AGENTS.md into the rules it gives an agent

12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the Sanity MCP server (https://mcp.sanity.io) is available, use list_sanity_rules and get_sanity_rules to load always up-to-date rules …

    line 35
  2. Distinctive:

    Read the corresponding reference file(s) using the file path

    line 75
  3. Distinctive:

    Follow the patterns and constraints defined in those references

    line 76
  4. Distinctive:

    Write best-practice, type-safe code using Sanity TypeGen.

    line 83
  5. Very specific:

    Critical: After schema changes, deploy with deploy_schema so content tools see the latest schema.

    line 144
  6. Very specific:

    Use defineQuery for all GROQ queries.

    line 148
  7. Distinctive:

    Prefer MCP tools for content operations (query, create, update, patch).

    line 149
  8. Very specific:

    Run deploy_schema after schema changes so MCP content tools use the latest schema.

    line 150
  9. Distinctive:

    Follow the "Deprecation Pattern" when removing fields (ReadOnly -> Hidden -> Deprecated).

    line 151
  10. Very specific:

    Run npm run typegen after schema or query changes (or enable automatic generation with typegen.enabled: true in sanity.cli.ts).

    line 152
  11. Distinctive:

    Before deleting any schema definition file.

    line 155
  12. Very specific:

    Use loose types (any) for Sanity content.

    line 158

≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Sanity Project

This is a Sanity-powered project. Use the Knowledge Router below to find Sanity guidance for your task. Available as a Claude Code plugin and Cursor plugin.

Commands

# MCP Setup
npx sanity@latest mcp configure  # Configure MCP for your AI editor

# Schema & Types
npx sanity schemas deploy     # Deploy schema to Content Lake for MCP/editor access
npx sanity schemas extract    # Extract schema for TypeGen
npx sanity typegen generate  # Generate TypeScript types

# Development
npx sanity dev               # Start Studio dev server
npx sanity build             # Build Studio for production
npx sanity deploy            # Deploy Studio to Sanity hosting

# Blueprints (infrastructure as code)
npx sanity blueprints init    # Initialize a Blueprint and create a Stack
npx sanity blueprints plan    # Preview infrastructure changes (read-only)
npx sanity blueprints deploy  # Apply the Blueprint to the Stack
npx sanity blueprints info    # Verify Stack status and deployed resources
npx sanity blueprints logs    # View Stack deployment logs

# Help
npx sanity docs search "query"  # Search Sanity documentation
npx sanity --help               # List all CLI commands

Knowledge Router

If the Sanity MCP server (https://mcp.sanity.io) is available, use list_sanity_rules and get_sanity_rules to load always up-to-date rules on demand. Otherwise, use the table below to find local reference files.

For the full reference index, see skills/sanity-best-practices/SKILL.md.

TopicTrigger KeywordsReference
Onboardingstart, setup, init, new projectskills/sanity-best-practices/references/get-started.md
Project Structurestructure, monorepo, embedded studio, file namingskills/sanity-best-practices/references/project-structure.md
Schemaschema, model, document, field, defineTypeskills/sanity-best-practices/references/schema.md
Deprecationdeprecate, remove field, legacy, migrationskills/sanity-best-practices/references/schema.md
Migration / Replatformingmigrate, migration, replatform, AEM, Contentful, Strapi, Webflow, WordPress, Payload, Drupal, WXR, CMS export, database dumpskills/sanity-migration/SKILL.md
Markdown Importmarkdown, mdx, frontmatter, static content, README import, markdown filesskills/sanity-migration/references/markdown.md
HTML / Portable Text Importhtml, portable text import, block-tools, htmlToBlocksskills/sanity-best-practices/references/migration.md
Next.jsnext.js, app router, server component, fetchskills/sanity-best-practices/references/nextjs.md
Nuxtnuxt, vue, nuxt.jsskills/sanity-best-practices/references/nuxt.md
Angularangular, signals, resource apiskills/sanity-best-practices/references/angular.md
Astroastro, islandsskills/sanity-best-practices/references/astro.md
Remix/React Routerremix, react router, loaderskills/sanity-best-practices/references/remix.md
Sveltesvelte, sveltekit, kitskills/sanity-best-practices/references/svelte.md
Visual Editingstega, visual editing, clean, overlay, presentation, usePresentationQueryskills/sanity-best-practices/references/visual-editing.md
Page Builderpage builder, pageBuilder, block component, alignment, switch renderskills/sanity-best-practices/references/page-builder.md
Rich Textportable text, rich text, block content, serializer, PTE, marks, annotationsskills/sanity-best-practices/references/portable-text.md
Imagesimage, urlFor, crop, hotspot, lqipskills/sanity-best-practices/references/image.md
Studio Structurestructure, desk, sidebar, singleton, groupingskills/sanity-best-practices/references/studio-structure.md
Singletonssingleton, document.singletons, defineSingleton, settings document, sanity-plugin-singleton-managementskills/sanity-singletons/SKILL.md
Form Component Suspensecustom input, components.input, components.field, components.item, form.components, Suspense, suspended without a <Suspense> boundary, React.lazy, layout shiftskills/sanity-form-component-suspense/SKILL.md
Localizationi18n, translation, localization, language, multilingual, localized singletonskills/sanity-best-practices/references/localization.md
SEOseo, metadata, sitemap, og image, open graph, json-ld, redirectskills/sanity-best-practices/references/seo.md
Shopify/Hydrogenshopify, hydrogen, e-commerce, storefront, sanity connectskills/sanity-best-practices/references/hydrogen.md
GROQgroq, query, defineQuery, projection, filter, orderskills/sanity-best-practices/references/groq.md
TypeGentypegen, typescript, types, infer, satisfies, type generationskills/sanity-best-practices/references/typegen.md
App SDKapp sdk, custom app, useDocuments, useDocument, DocumentHandle, SanityApp, sdk-reactskills/sanity-best-practices/references/app-sdk.md
Dashboarddashboard, defineApplication, init --dashboard, sdk-react/dashboard, deployment.appId, app visibilityskills/sanity-best-practices/references/dashboard.md
Blueprintsblueprints, IaC, infrastructure, stack, defineBlueprint, sanity.blueprint.ts, blueprints deployskills/sanity-best-practices/references/blueprints.md
Sanity Functions & Webhooksfunctions, webhook, serverless, event handler, documentEventHandler, defineDocumentFunction, sanity.blueprint.tsskills/sanity-best-practices/references/functions.md

Using the Knowledge Router

Before modifying any code:

  1. Identify which topics from the table above apply to your task
  2. Read the corresponding reference file(s) using the file path
  3. Follow the patterns and constraints defined in those references

Example: If asked to "create a blog post schema", read skills/sanity-best-practices/references/schema.md first.

Agent Behavior

  • Specialize in Structured Content, GROQ, and Sanity Studio configuration.
  • Write best-practice, type-safe code using Sanity TypeGen.
  • Build scalable content platforms, not just websites.
  • Detect the user's framework from package.json and consult the appropriate reference file.

MCP Server (Preferred for Content Operations)

Prefer MCP tools over writing scripts for content operations:

Content Operations:

ToolUse For
query_documentsRun GROQ queries
get_documentFetch a single document by exact ID
create_documentsCreate draft documents from structured content, or version documents when a release ID is provided
patch_documentsApply precise modifications to document fields; published documents are edited by creating/updating a draft
publish_documentsPublish one or more drafts
unpublish_documentsUnpublish documents (move back to drafts)
discard_draftsDiscard drafts while keeping published documents

Schema & Development:

ToolUse For
get_schemaGet full schema of the current workspace (MCP-managed first, then Studio-deployed, then legacy schema)
list_workspace_schemasList all available workspace schema names
deploy_schemaDeploy MCP-managed schema types to the cloud
deploy_studioDeploy a hosted Studio bound to an MCP-managed schema
search_docs / read_docsSearch and read Sanity documentation
list_sanity_rules / get_sanity_rulesLoad best-practice development rules
give_feedbackReport MCP tool errors, missing capabilities, confusing output, or documentation issues

Media & AI:

ToolUse For
generate_imageAI image generation for a document field
transform_imageAI transformation of an existing image

Releases:

ToolUse For
create_releaseCreate a release for coordinated content changes
list_releasesList active, scheduled, published, or archived releases
create_versionCreate a version document for a release
version_discardDiscard document versions from a release
version_unpublish_documentMark document to be unpublished when release runs

Project Management:

ToolUse For
whoamiVerify the authenticated Sanity user
list_projects / list_organizationsList projects and organizations
get_project_studiosList Studio applications linked to a project
create_projectCreate a new Sanity project
list_datasets / create_dataset / update_datasetManage datasets
add_cors_originAdd CORS origins for client-side requests
list_embeddings_indices / semantic_searchSemantic search on embeddings

Critical: After schema changes, deploy with deploy_schema so content tools see the latest schema. If using an MCP-managed Studio, redeploy it with deploy_studio after schema changes.

Boundaries

  • Always:
    • Use defineQuery for all GROQ queries.
    • Prefer MCP tools for content operations (query, create, update, patch). For bulk migrations or when MCP is unavailable, NDJSON scripts are a valid alternative. Never use NDJSON scripts when MCP tools can accomplish the same task more simply.
    • Run deploy_schema after schema changes so MCP content tools use the latest schema. If a local Studio exists, update schema files first to keep them in sync with the deployed schema. If using an MCP-managed Studio, run deploy_studio after deploy_schema.
    • Follow the "Deprecation Pattern" when removing fields (ReadOnly -> Hidden -> Deprecated).
    • Run npm run typegen after schema or query changes (or enable automatic generation with typegen.enabled: true in sanity.cli.ts).
  • Ask First:
    • Before modifying sanity.config.ts.
    • Before deleting any schema definition file.
  • Never:
    • Hardcode API tokens (use process.env).
    • Use loose types (any) for Sanity content.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.