Skip to content
Agent Friendly Code

What is AGENTS.md? Format, best practices and a template

AGENTS.md is an open format for guiding AI coding agents: a markdown file at the repo root saying what the project is, how it is laid out, which commands build and test it, and which rules to follow. No fields or headings are required. The Agentic AI Foundation, under the Linux Foundation, stewards it. CLAUDE.md is the same file under Claude Code's name.

By Himanshu Singh · Updated · How we score →

How many repos have an AGENTS.md?

Of the 434 repos on the leaderboard, 247 pass in full (57%), 13 pass in part (3%) and 174 fail (40%).

Why do AI coding agents need an AGENTS.md?

It is the one file most agents load unasked. Claude Code loads CLAUDE.md every session, or AGENTS.md when there is no CLAUDE.md. Codex reads AGENTS.md before any work, as do Cursor, Devin, Kimi Code CLI, OpenHands and Pi. Without it, an agent guesses your build steps and conventions from the code.

What should I put in an AGENTS.md?

Whatever an agent can't work out from the code, kept short enough to read in full every session:

  • What the project is. A sentence or two, plus languages, frameworks and package manager (pnpm, not npm; uv, not pip).
  • Exact commands. Setup, build, test, lint and type check, copy-pasteable with flags. Include running one test file; an agent does that most.
  • Where things are. Only what a directory listing doesn't say: where generated code and fixtures live, which package is the entry point.
  • Rules a reviewer would repeat. Conventions the linter doesn't enforce: naming, error handling, which module owns database access.
  • Boundaries. What never to touch (generated files, lockfiles, secrets) and what to ask about first (migrations, new dependencies).
  • When a change is done. The checks that must pass, usually the ones CI runs.

What to leave out

  • Style rules a linter or formatter already enforces.
  • A full file tree: it goes stale, and the agent can list the directory.
  • Secrets, tokens or internal URLs: the file is committed.
  • Long how-tos for one part of the code. Link a doc, or put an AGENTS.md in that directory.

The median of the 260 on the leaderboard is 7,104 characters. Read them.

Examples by language: TypeScript · Python · Rust · Go · Java · Kotlin · C++ · JavaScript · PHP · Ruby · Swift · C# · Dart

By framework, with what to put in the file: Next.js · React · FastAPI · Flutter · Android · .NET · Rails · Vue · Laravel · Django · Angular · React Native · Spring Boot · iOS

What makes a good AGENTS.md?

  • Keep it short. Claude Code's docs target under 200 lines per CLAUDE.md, Codex stops adding files at 32 KiB combined, and Devin reads the first 16 KiB of each. How long real ones are.
  • One per package in a monorepo. The closest AGENTS.md to the edited file wins, and an explicit chat prompt overrides everything. AGENTS.md in a monorepo.
  • Write it once for every agent. Claude Code skips AGENTS.md when a CLAUDE.md exists, so import @AGENTS.md there. Gemini CLI needs AGENTS.md in context.fileName, Aider under read:. One file for all agents.
  • Any headings work. Standard markdown, no required fields. Common sections: project overview, build and test commands, code style, testing instructions, security considerations.
  • Keep it current. The agents.md site calls it living documentation: change it in the same commit as the commands it describes.
  • Check what loaded. Run /memory in Claude Code or /memory show in Gemini CLI, or ask Codex to list the instruction sources it loaded.

From the docs: code.claude.com/memory (new tab) · learn.chatgpt.com/agents-md (new tab) · docs.devin.ai/agents-md (new tab) · agents.md (new tab) · geminicli.com/gemini-md (new tab)

AGENTS.md template

Replace the commands and rules with your repo's, and delete any section with nothing true to say.

# AGENTS.md

## Project
One or two sentences on what this is. TypeScript, Next.js, pnpm.

## Commands
- Install: `pnpm install`
- Test all: `pnpm test`
- Test one file: `pnpm test path/to/file.test.ts`
- Lint and type check: `pnpm lint && pnpm typecheck`

## Layout
- `src/generated/` comes from `pnpm codegen`; never edit it by hand.
- Only `src/db/` talks to the database.

## Conventions
- Return errors as values; don't throw across modules.

## Boundaries
- Never commit secrets or edit the lockfile by hand.
- Ask before adding a dependency or a migration.

## Done means
- `pnpm lint`, `pnpm typecheck` and `pnpm test` pass, as in CI.

More on AGENTS.md

How long should an AGENTS.md be?

  • Full pass: the first with content of AGENTS.md, CLAUDE.md and AGENT.md at the repo root, then .claude/CLAUDE.md and .claude/AGENTS.md, has 800 or more characters.
  • 80%: the file has 200 to 799 characters.
  • 50%: the file has under 200 characters.
  • 20%: the file exists but is empty, as is any other of the five.
  • Fail: none of the five files exists.

How checks become a score: methodology.

How do I add an AGENTS.md to my repo?

Add an AGENTS.md at the repo root with the contents above. An existing CLAUDE.md passes as is, but when a repo has both, Claude Code reads only CLAUDE.md unless it imports @AGENTS.md. Cursor rule files have their own check.

Which AI agents read AGENTS.md?

Pass rate by language

Top-scoring repos that pass

Popular repos that fail it

Every check, grouped into what to do first: how to make your repo ready for AI coding agents.