examples / cms-sanity-graphql-fragments
CLAUDE.md5.2k starsChanged 10 months agoMITView on GitHub
Trending
Quiet this year.thin dataabout the whole repository
Who's talking about vercel/examples
- @github-trending-js.bsky.social“📦 vercel / examples ⭐ 4,129 (+67) 🗒 TypeScript Enjoy our curated collection of examples and solutions. …”Bluesky · Sep 9, 2025 · 1 likes
- @github-trending.bsky.social“📦 vercel / examples ⭐ 4,129 (+67) 🗒 TypeScript Enjoy our curated collection of examples and solutions. …”Bluesky · Sep 9, 2025 · 1 likes
- @dailygithubtrends.bsky.social“今日のGitHubトレンド vercel/examples このリポジトリは、Vercelが提供する公式テンプレート集です。 …”Bluesky · Sep 9, 2025 · 1 likes
- @github-trending-js.bsky.social“📦 vercel / examples ⭐ 3,949 (+32) 🗒 TypeScript Enjoy our curated collection of examples and solutions. …”Bluesky · Aug 9, 2025 · 1 likes
- A Hacker News story“Vercel Edge Functions are being deprecated”Hacker News · May 19, 2025 · 1 points
The biggest 5 of 6 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 6
Talked about on Bluesky and Hacker News (6 times).
On Bluesky · 4
- Sep 9, 2025📦 vercel / examples ⭐ 4,129 (+67) 🗒 TypeScript Enjoy our curated collection of examples and solutions. Use these patterns to build your… — @github-trending-js.bsky.social1 likes and repost
- Sep 9, 2025📦 vercel / examples ⭐ 4,129 (+67) 🗒 TypeScript Enjoy our curated collection of examples and solutions. Use these patterns to build your… — @github-trending.bsky.social1 likes and repost
- Sep 9, 2025今日のGitHubトレンド vercel/examples このリポジトリは、Vercelが提供する公式テンプレート集です。 vercel.com/templatesで公開される多様なアプリケーション例やソリューションを管理し、ユーザーに提供することを主な目的としています。… — @dailygithubtrends.bsky.social1 likes and repost
- Aug 9, 2025📦 vercel / examples ⭐ 3,949 (+32) 🗒 TypeScript Enjoy our curated collection of examples and solutions. Use these patterns to build your… — @github-trending-js.bsky.social1 likes and repost
On Hacker News · 2
- May 19, 2025Vercel Edge Functions are being deprecated1 point
- Oct 26, 2021Next.js Edge, Rate Limiting at Edge1 point
In this repository5 other files it gives its agents.
- rust/wait-until/AGENTS.mdAGENTS.md
- rust/websocket/AGENTS.mdAGENTS.md
- websockets/next-chat/AGENTS.mdAGENTS.md
- websockets/next-chat/CLAUDE.mdCLAUDE.md
- web-design-guidelinesSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
16 rules. About 0 are common, 3 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
No test command configured: - check with user if tests are needed
- Very specific: line 18
Component Files: Use kebab-case for component filenames (e.g., my-component.tsx)
- Distinctive: line 20
Error Handling: Use TypeScript strict mode, handle async errors properly
- Very specific: line 31
Use next/image for images, next/font for fonts
- Very specific: line 33
Use className prop for styling
- Very specific: line 38
Client Setup: Use createGraphQLClient() from @/lib/graphql
- Very specific: line 54
Error Handling: Always check for error object and provide user-friendly error UI
- Very specific: line 55
ISR: Use export const revalidate = 60 for Incremental Static Regeneration
- Very specific: line 60
Update types: Run npm run schema:generate to regenerate TypeScript types
- Very specific: line 62
Import types: Use generated types from @/lib/graphql for type safety
- Very specific: line 69
Fragment files: Use -fragment.ts suffix (e.g., nav-link-fragment.ts)
- Very specific: line 72
When a component needs "use client" directive:
- Very specific: line 129
Development: Use npm run sanity:dev to start Sanity Studio
- Very specific: line 130
Schema Changes: After modifying src/lib/schema.ts, deploy with npm run sanity:deploy
- Very specific: line 131
Type Generation: Run npm run schema:generate to update GraphQL types
- Distinctive: line 132
Content Creation: Use Sanity Studio to create and manage content
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.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.
Files
Agent Guidelines for cms-graphql-fragments
Commands
- Build:
npm run build(uses Next.js with Turbopack) - Dev:
npm run dev(development server with Turbopack) - Lint:
npm run lint(Biome linter) - Format:
npm run format(Biome formatter) - Sanity Studio:
npm run sanity:dev(start Sanity Studio development server) - Deploy GraphQL:
npm run sanity:deploy(deploy GraphQL API to Sanity) - Generate Types:
npm run schema:generate(generate GraphQL types from Sanity schema) - No test command configured - check with user if tests are needed
Code Style
- Formatter: Biome with 2-space indentation
- Imports: Auto-organized by Biome, use
@/*for src imports - Types: Strict TypeScript, explicit types for props/exports
- Naming: camelCase for variables/functions, PascalCase for components
- Component Files: Use kebab-case for component filenames (e.g.,
my-component.tsx) - Components: Function declarations with explicit return types when complex
- Error Handling: Use TypeScript strict mode, handle async errors properly
Biome Configuration
- Import Organization: Automatically enabled on save/format
- Domain Rules: Next.js and React recommended rules enabled
- Ignored Files:
node_modules,.next,dist,build,.sanity,lib/generated - VCS Integration: Git integration enabled with ignore file support
Framework Specifics
- Next.js 15 App Router with React 19
- Tailwind CSS for styling
- Use
next/imagefor images,next/fontfor fonts - Export metadata objects for SEO
- Use
classNameprop for styling
GraphQL & Data Fetching
- Client: URQL with
@urql/next/rscfor React Server Components - Type Safety: gql.tada with GraphQL introspection from
src/lib/generated/graphql-env - Client Setup: Use
createGraphQLClient()from@/lib/graphql - Query Pattern:
import { registerUrql } from "@urql/next/rsc"; import { createGraphQLClient, graphql } from "@/lib/graphql"; const { getClient } = registerUrql(createGraphQLClient); const QUERY = graphql(` query QueryName($param: String!) { field } `); const { data, error } = await getClient().query(QUERY, { param: "value" }); - Error Handling: Always check for
errorobject and provide user-friendly error UI - ISR: Use
export const revalidate = 60for Incremental Static Regeneration - Scalars: DateTime, Date (string), JSON (TypedObject from Sanity)
Schema Generation Workflow
- After Sanity schema changes: Deploy GraphQL API with
npm run sanity:deploy - Update types: Run
npm run schema:generateto regenerate TypeScript types - Generated files: Types are created in
src/lib/generated/(auto-ignored by Biome) - Import types: Use generated types from
@/lib/graphqlfor type safety
GraphQL Fragment Colocation
Fragment Definition Rules
- Server Components: Define fragments directly in component files
- Client Components: Define fragments in separate
.tsfiles to avoid client/server boundary issues - Fragment files: Use
-fragment.tssuffix (e.g.,nav-link-fragment.ts)
Client Component Pattern
When a component needs "use client" directive:
- Fragment Definition (
component-fragment.ts):import { graphql } from "@/lib/graphql"; export const componentFragment = graphql(` fragment ComponentName on Type { field1 field2 } `); - Client Component (
component.tsx):"use client"; import { type FragmentOf } from "@/lib/graphql"; import type { componentFragment } from "./component-fragment"; interface Props { data: FragmentOf<typeof componentFragment>; } export function Component({ data }: Props) { // Client-side logic (hooks, event handlers, etc.) } - Parent Server Component:
import { componentFragment } from "./component-fragment"; import { Component } from "./component"; const parentFragment = graphql(`...`, [componentFragment]);
Why This Pattern?
- Prevents Runtime Errors: Avoids "f.definitions is not iterable" errors
- Maintains Colocation: Fragments stay close to components that use them
- Respects Boundaries: Separates server-side GraphQL logic from client-side interactivity
- Type Safety: Components get proper TypeScript types via
FragmentOf<typeof {GraphQL Fragment}>
Sanity CMS Integration
Available Schema Types
The project includes comprehensive Sanity schemas defined in src/lib/schema.ts:
- Post: Blog posts with title, slug, excerpt, content, publishedAt
- Page: Static pages with title, slug, excerpt, content, SEO settings, published status
- Navigation: Site navigation with title and navigation items (label, href, isExternal)
- Footer: Footer configuration with title, description, links, social links, copyright
- SEO: SEO settings object with metaTitle and metaDescription
- Social Links: Platform-specific social media links (Twitter, GitHub, LinkedIn, etc.)
Content Management Workflow
- Development: Use
npm run sanity:devto start Sanity Studio - Schema Changes: After modifying
src/lib/schema.ts, deploy withnpm run sanity:deploy - Type Generation: Run
npm run schema:generateto update GraphQL types - Content Creation: Use Sanity Studio to create and manage content
- ISR: Content changes trigger revalidation automatically (only available on deployed project)
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.

