sanity
Skill15 starsChanged 2 months agoMITView on GitHub
Expert Sanity.io headless CMS assistance covering GROQ queries, Content Lake, schema definitions, and Sanity Studio. Use when building structured content platforms and headless digital experiences.
- Reads credentials
4 other projects use a version of this.
Adopted by
Most recently taken up by
- display-design-studio/skillstheir own version, first seen Oct 13, 2026
- Mindrally/skillstheir own version, first seen Oct 8, 2026
- monogramdesign/skillstheir own version, first seen Aug 19, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Mindrally/skills★ 275same name
- display-design-studio/skills★ 3same name
- conjure-3301/skills★ 0same name
- monogramdesign/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository350 other files it gives its agents.
- airflowSkill
- catboostSkill
- claudeSkill
- comfyuiSkill
- cursor-aiSkill
- dalleSkill
- daskSkill
- dbtSkill
- deepseekSkill
- fastaiSkill
- geminiSkill
- github-copilotSkill
- huggingfaceSkill
- jaxSkill
- jupyterSkill
- kerasSkill
- langchainSkill
- lightgbmSkill
- llamaindexSkill
- llamaSkill
- matplotlibSkill
- midjourneySkill
- mistralSkill
- mlflowSkill
- nltkSkill
- numpySkill
- ollamaSkill
- openai-gptSkill
- opencvSkill
- pandasSkill
- perplexitySkill
- plotlySkill
- polarsSkill
- pytorchSkill
- raySkill
- scikit-learnSkill
- seabornSkill
- spacySkill
- sparkSkill
- stable-diffusionSkill
- tensorflowSkill
- vaexSkill
- weights-biasesSkill
- whisperSkill
- xgboostSkill
- api-gatewaySkill
- clean-architectureSkill
- cqrsSkill
- domain-driven-designSkill
- event-drivenSkill
- event-sourcingSkill
- graphqlSkill
- grpcSkill
- hexagonalSkill
- microservicesSkill
- modular-monolithSkill
- monolithSkill
- rest-apiSkill
- sagaSkill
- serverlessSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 183
Use Sanity TypeGen (sanity typegen generate) to generate TypeScript types from GROQ queries automatically.
- Distinctive: line 186
Use Portable Text for rich editorial content rather than raw HTML or Markdown.
- Very specific: line 190
Use *[] without type constraints in GROQ.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sanity
Sanity is "Content as Data". The Studio v3 is a real-time React application that you host, giving you complete control over the editing experience.
When to Use
- Structured Content Platforms: Headless CMS providing real-time collaboration and custom editing studios.
- Multi-Channel Omnichannel Publishing: Distributing content to websites, mobile apps, e-commerce, and signage.
- Sanity Studio v3 Customization: Customizing React-based editorial workspaces with schema-as-code.
- Real-Time Visual Editing: Combining GROQ queries with Vercel Visual Editing and live content previews.
Quick Start
// schemaTypes/post.ts
import { defineField, defineType } from "sanity";
export const postType = defineType({
name: "post",
title: "Blog Post",
type: "document",
fields: [
defineField({
name: "title",
type: "string",
validation: (rule) => rule.required(),
}),
defineField({ name: "slug", type: "slug", options: { source: "title" } }),
defineField({ name: "publishedAt", type: "datetime" }),
],
});Core Concepts
Declarative Schema-as-Code
Defining content types, fields, and validation rules:
// schemas/post.ts
import { defineType, defineField } from "sanity";
export const postType = defineType({
name: "post",
title: "Blog Post",
type: "document",
fields: [
defineField({
name: "title",
title: "Title",
type: "string",
validation: (Rule) => Rule.required().min(10).max(100),
}),
defineField({
name: "slug",
title: "Slug",
type: "slug",
options: { source: "title", maxLength: 96 },
validation: (Rule) => Rule.required(),
}),
defineField({
name: "publishedAt",
title: "Published At",
type: "datetime",
initialValue: () => new Date().toISOString(),
}),
defineField({
name: "content",
title: "Body Content",
type: "array",
of: [{ type: "block" }, { type: "image" }],
}),
],
});Type-Safe GROQ Queries with Sanity TypeGen
Querying structured content with filter and projection:
import { createClient, groq } from "next-sanity";
export const client = createClient({
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!,
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET!,
apiVersion: "2026-01-01",
useCdn: false, // false for fresh drafts in preview mode
});
// GROQ query projection
export const POSTS_QUERY = groq`
*[_type == "post" && defined(slug.current)] | order(publishedAt desc)[0...10] {
_id,
title,
"slug": slug.current,
publishedAt,
"authorName": author->name
}
`;Portable Text Rendering in React
Rendering structured block content with custom components:
import { PortableText, PortableTextComponents } from "@portabletext/react";
const customComponents: PortableTextComponents = {
types: {
image: ({ value }) => (
<img
src={value.imageUrl}
alt={value.alt || "Content image"}
className="rounded-lg my-4"
/>
),
},
marks: {
link: ({ children, value }) => {
const target = (value?.href || "").startsWith("http")
? "_blank"
: undefined;
return (
<a
href={value?.href}
target={target}
rel="noopener noreferrer"
className="text-blue-500 underline"
>
{children}
</a>
);
},
},
};
export function ArticleBody({ value }: { value: any }) {
return <PortableText value={value} components={customComponents} />;
}Common Patterns
GROQ Query with Projection and Filter
Problem: Fetching complete nested documents when only a few fields are needed by the frontend.
Solution: Use GROQ projections:
import { createClient } from "@sanity/client";
const client = createClient({
projectId: "your-project-id",
dataset: "production",
useCdn: true,
apiVersion: "2024-01-01",
});
const query = `*[_type == "post" && defined(slug.current)] | order(publishedAt desc)[0...10] {
_id,
title,
"slug": slug.current,
"authorName": author->name
}`;
const posts = await client.fetch(query);Best Practices
Do:
- Use Sanity TypeGen (
sanity typegen generate) to generate TypeScript types from GROQ queries automatically. - Configure fine-grained webhook listeners for On-Demand Revalidation in Next.js / Nuxt / Remix.
- Pin the
apiVersionparameter ('2026-01-01') to prevent breaking changes. - Use Portable Text for rich editorial content rather than raw HTML or Markdown.
Don't:
- Use
*[]without type constraints in GROQ; always specify_type == "..."for indexing. - Expose write tokens (
SANITY_API_WRITE_TOKEN) to client-side bundles. - Query entire document trees without projections; project only the fields required by the UI.
Troubleshooting
| Error | Cause | Solution |
ClientError: Project ID not configured | Missing projectId in client options or environment variables. | Provide valid projectId in createClient(...). |
Unknown type "..." in schema | Referenced schema type not imported or exported in schemaTypes/index.ts. | Add missing type definition to the schemaTypes array in sanity.config.ts. |
CORS Error: Origin not allowed | Frontend domain not added to Sanity API Allowed Origins. | Add domain in Sanity management dashboard under API settings. |
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

