Skip to content
Agent Friendly Code

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 framework
  • vite buildproduction build; transpiles only
  • tsc --noEmittype check: Vite does not
  • eslint .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, useCallback or React.memo by 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.

React repos with an AGENTS.md or CLAUDE.md
RepoFileLength
excalidraw/excalidrawAGENTS.md 372
mui/material-uiAGENTS.md 10,407
grafana/grafanaAGENTS.md 11,087
makeplane/planeAGENTS.md 4,073
tldraw/tldrawAGENTS.md 13,885
chakra-ui/chakra-uiCLAUDE.md 9,339
mattermost/mattermostAGENTS.md 738
Uniswap/interfaceAGENTS.md 11,442

More examples: Next.js · FastAPI · Django · Rails · Vue · Laravel · Android · Flutter · all examples