agentleFS
t-code4changet-code4change/nextjs-claude-skills/AGENTS.md

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.

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
  1. Very specific:

    Default to Server Components — no 'use client' unless component needs useState/useEffect/browser APIs

    line 10
  2. Very specific:

    Place 'use client' at leaf components only (smallest boundary)

    line 11
  3. Very specific:

    Never import Server Components into Client Components — pass as children instead

    line 12
  4. Very specific:

    Use Promise.all() for parallel fetches — never sequential awaits

    line 18
  5. Very specific:

    Every page needs: unique <title>, <meta description>, canonical URL

    line 24
  6. Very specific:

    Use generateMetadata() for dynamic routes

    line 27
  7. Very specific:

    Never use CSR (useEffect fetch) for SEO-indexed content

    line 28
  8. Very specific:

    Never block /_next/ in robots.txt

    line 29
  9. Distinctive:

    Add JSON-LD structured data on key pages

    line 31
  10. Very specific:

    Always use next/image — never <img> tag

    line 35
  11. Very specific:

    All images need explicit width/height or fill with sized container

    line 37
  12. Very specific:

    Use quality={85} for hero images, default 75 for others

    line 39
  13. Very specific:

    Always use next/font — never Google Fonts <link> or @import

    line 43
  14. Very specific:

    Use @next/third-parties/google for GA4

    line 49
  15. Distinctive:

    Import directly from file, not from barrel index files

    line 53
  16. Very specific:

    Use dynamic() for heavy components that aren't needed on first load

    line 54
  17. Very specific:

    Never use any type

    line 58
  18. Very specific:

    Always pair with cacheTag() and cacheLife()

    line 64
  19. Very specific:

    Never call cookies()/headers() inside 'use cache' scope

    line 65
  20. Very specific:

    Call updateTag() after mutations in Server Actions

    line 66
  21. Very specific:

    Never skip priority on the LCP image

    line 72
  22. Distinctive:

    Never introduce layout shift — always reserve space for async content

    line 73

≈ “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.

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

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 children instead
  • 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
  • metadataBase must be set in root layout
  • viewport must be a separate export — never inside metadata object
  • Use generateMetadata() for dynamic routes
  • Never use CSR (useEffect fetch) 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 priority prop
  • All images need explicit width/height or fill with sized container
  • Set sizes attribute 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" via next/script
  • Use @next/third-parties/google for 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 any type
  • 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() and cacheLife()
  • 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 priority on the LCP image
  • Never introduce layout shift — always reserve space for async content
  • Animate transform/opacity, never layout properties

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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.