What to put in an AGENTS.md for React
React says little about how an app is built, so say it: a framework or plain Vite, and whether React Compiler is on. Agents still reach for older React patterns, and 'use client' means nothing without Server Components.
Which commands should it list?
vitedev server, for an app not on a frameworkvite buildproduction build; transpiles onlytsc --noEmittype check: Vite does noteslint .with eslint-plugin-react-hooks for the rules of hooks
Write them as your repo runs them, with its package manager and flags, plus how to run one test.
What layout should it explain?
- Framework (React Router, Next.js, …) or plain Vite; with a framework, link its own guide.
- Whether React Compiler is on, and for which directories if adoption is incremental.
- Where components, hooks and tests live, and which package is the app in a monorepo.
What do agents get wrong?
- With React Compiler on, don't add
useMemo,useCallbackorReact.memoby hand. - Hooks go at the top level: not in loops, conditions, nested functions or try/catch, and never after an early return.
- StrictMode runs every effect's setup and cleanup an extra time in development; a double log is not a bug, a missing cleanup is.
'use client'only matters with React Server Components in a framework that supports them.
From the official docs: react.dev/creating-a-react-app (new tab) · react.dev/react-compiler (new tab) · react.dev/rules-of-hooks (new tab) · react.dev/StrictMode (new tab) · react.dev/use-client (new tab) · vite.dev/features (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.
React repos with an AGENTS.md or CLAUDE.md (8)
Built on React; 6 pass the AGENTS.md check in full. react/react has one too, for contributors to React itself.
| Repo | File | Length | Language |
|---|---|---|---|
| excalidraw/ | AGENTS.md | 372 chars | |
| mui/ | AGENTS.md | 10,407 chars | |
| grafana/ | AGENTS.md | 11,087 chars | |
| makeplane/ | AGENTS.md | 4,073 chars | |
| tldraw/ | AGENTS.md | 13,885 chars | |
| chakra-ui/ | CLAUDE.md | 9,339 chars | |
| mattermost/ | AGENTS.md | 738 chars | |
| Uniswap/ | AGENTS.md | 11,442 chars |
More examples: Next.js · FastAPI · Django · Rails · Vue · Laravel · Android · Flutter · all examples