nextjs-claude-skills
AGENTS.md2 starsChanged 5 months agoMITView on GitHub
This file is automatically read by Codex and OpenAI-compatible agents. Source: https://github.com/t-code4change/nextjs-claude-skills
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- for-copilot/copilot-instructions.mdCopilot instructions
- nextjs-cachingSkill
- nextjs-coreSkill
- nextjs-react-best-practicesSkill
- nextjs-seo-performanceSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
22 rules. About 0 are common, 3 are distinctive, and 19 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.
19
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Default to Server Components — no 'use client' unless component needs useState/useEffect/browser APIs
- Very specific: line 11
Place 'use client' at leaf components only (smallest boundary)
- Very specific: line 12
Never import Server Components into Client Components — pass as children instead
- Very specific: line 18
Use Promise.all() for parallel fetches — never sequential awaits
- Very specific: line 24
Every page needs: unique <title>, <meta description>, canonical URL
- Very specific: line 27
Use generateMetadata() for dynamic routes
- Very specific: line 28
Never use CSR (useEffect fetch) for SEO-indexed content
- Very specific: line 29
Never block /_next/ in robots.txt
- Distinctive: line 31
Add JSON-LD structured data on key pages
- Very specific: line 35
Always use next/image — never <img> tag
- Very specific: line 37
All images need explicit width/height or fill with sized container
- Very specific: line 39
Use quality={85} for hero images, default 75 for others
- Very specific: line 43
Always use next/font — never Google Fonts <link> or @import
- Very specific: line 49
Use @next/third-parties/google for GA4
- Distinctive: line 53
Import directly from file, not from barrel index files
- Very specific: line 54
Use dynamic() for heavy components that aren't needed on first load
- Very specific: line 58
Never use any type
- Very specific: line 64
Always pair with cacheTag() and cacheLife()
- Very specific: line 65
Never call cookies()/headers() inside 'use cache' scope
- Very specific: line 66
Call updateTag() after mutations in Server Actions
- Very specific: line 72
Never skip priority on the LCP image
- Distinctive: line 73
Never introduce layout shift — always reserve space for async content
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.
Files
Next.js Best Practices — AI Agent Rules
This file is automatically read by Codex and OpenAI-compatible agents. Source: https://github.com/t-code4change/nextjs-claude-skills
CRITICAL: Server vs Client Components
- Default to Server Components — no
'use client'unless component needs useState/useEffect/browser APIs - Place
'use client'at leaf components only (smallest boundary) - Never import Server Components into Client Components — pass as
childreninstead - Props from Server to Client must be serializable
CRITICAL: Data Fetching
- Fetch data in Server Components — never useEffect for data fetching
- Use
Promise.all()for parallel fetches — never sequential awaits - Server Actions are for MUTATIONS ONLY — never use for data fetching
- Next.js 15+: always
await params,await cookies(),await headers()
SEO — Always Apply
- Every page needs: unique
<title>,<meta description>, canonical URL metadataBasemust be set in root layoutviewportmust be a separate export — never insidemetadataobject- Use
generateMetadata()for dynamic routes - Never use CSR (
useEffectfetch) for SEO-indexed content - Never block
/_next/in robots.txt - Set canonical URL on every indexable page to prevent duplicate content
- Add JSON-LD structured data on key pages
Images
- Always use
next/image— never<img>tag - LCP image must have
priorityprop - All images need explicit
width/heightorfillwith sized container - Set
sizesattribute to match actual rendered dimensions - Use
quality={85}for hero images, default 75 for others
Fonts
- Always use
next/font— never Google Fonts<link>or@import - Always set
display: 'swap'
Scripts / Analytics
- Load analytics with
strategy="afterInteractive"vianext/script - Use
@next/third-parties/googlefor GA4
Bundle
- Import directly from file, not from barrel index files
- Use
dynamic()for heavy components that aren't needed on first load
TypeScript
- Never use
anytype - Page props in Next.js 15+:
params: Promise<{ slug: string }>
Caching (Next.js 16, cacheComponents: true)
'use cache'must be first statement, function must be async- Always pair with
cacheTag()andcacheLife() - Never call
cookies()/headers()inside'use cache'scope - Call
updateTag()after mutations in Server Actions - Wrap dynamic content in
<Suspense>
Core Web Vitals Targets
- LCP < 2.5s, INP < 200ms, CLS < 0.1
- Never skip
priorityon the LCP image - Never introduce layout shift — always reserve space for async content
- Animate
transform/opacity, never layout properties
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.

