Skip to main content
An AGENTS.md file works like an onboarding document for AI coding agents. The goal is to give the agent the same context you’d give a new teammate on their first day: what the project does, how to set it up, how to run tests, and what standards to follow. There are no required fields — it’s plain Markdown. The more specific and accurate you are, the better the agent performs.

Essential sections

Project overview

A short description of what the project does and how it’s structured.

Dev environment setup

Commands to install dependencies and start the dev server.

Build and test commands

Exact commands to build and run the test suite. Agents will attempt to execute these automatically.

Code style guidelines

Language preferences, formatting rules, linting setup.

PR and commit instructions

Title formats, branch conventions, what to run before committing.

Security considerations

Secrets handling, known gotchas, anything risky to get wrong.

Project overview

Describe what the project does in a few sentences. Mention the tech stack and any non-obvious architectural decisions. This helps the agent understand what it’s working with before touching any code.
## Project overview
This is a monorepo containing the web app, API, and shared packages for Acme.
The frontend is React + Vite (TypeScript). The API is a Node.js Express server.
Packages live under `packages/` and apps under `apps/`.

Dev environment setup

List the exact commands to get from a fresh clone to a running dev environment.
## Setup commands
- Install deps: `pnpm install`
- Start dev server: `pnpm dev`
- Copy env file: `cp .env.example .env`

Build and test commands

Be explicit. Agents will attempt to execute test commands they find in AGENTS.md automatically — make sure the commands are accurate.
Agents auto-execute testing commands found in AGENTS.md. Use real commands from your project, not placeholders.
## Testing instructions
- Run all tests: `pnpm test`
- Run tests for one package: `pnpm turbo run test --filter <project_name>`
- Run a single test by name: `pnpm vitest run -t "<test name>"`
- After moving files or changing imports, run `pnpm lint --filter <project_name>`
  to confirm ESLint and TypeScript rules still pass.
- Add or update tests for any code you change, even if nobody asked.

Code style guidelines

Document the conventions that aren’t obvious from the code itself.
## Code style
- TypeScript strict mode
- Single quotes, no semicolons
- Use functional patterns where possible
- Prefer named exports over default exports

PR and commit instructions

If your project has title formats, branch naming conventions, or required checks, put them here.
## PR instructions
- Title format: [<project_name>] <Title>
- Always run `pnpm lint` and `pnpm test` before committing.
- Commits should pass all tests before merging.

Security considerations

Mention anything that could cause harm if done incorrectly: secrets handling, production data, rate-limited APIs, destructive migrations.
## Security
- Never commit `.env` files or API keys.
- Do not run migrations against production without a manual review step.
- The `STRIPE_SECRET_KEY` variable must never appear in client-side bundles.

Optional but useful sections

These aren’t always necessary, but they pay off in complex projects. Architecture notes — explain folder structure, module boundaries, or why things are organized the way they are. Deployment steps — document the deploy process if it’s non-obvious or involves manual steps. Known gotchas — things that have tripped up developers before: flaky tests, environment-specific behavior, tools that need special flags. Large datasets — if the project involves large files or datasets, tell the agent what to avoid downloading or modifying.

Tips for writing a good AGENTS.md

  • Be specific with commands. pnpm test is better than “run the tests.”
  • Use real commands from the project. Copy them from your CI config or README.
  • Keep it updated. Treat AGENTS.md as living documentation — update it whenever workflows change.
  • Think like a new teammate. If you’d explain it during onboarding, put it in AGENTS.md.

Complete example

# AGENTS.md

## Project overview
Monorepo for the Acme platform. Frontend is React + Vite (TypeScript).
API is Node.js + Express. Packages live under `packages/`, apps under `apps/`.

## Dev environment tips
- Use `pnpm dlx turbo run where <project_name>` to jump to a package
  instead of scanning with `ls`.
- Run `pnpm install --filter <project_name>` to add a package to your
  workspace so Vite, ESLint, and TypeScript can see it.
- Check the `name` field inside each package's `package.json` to confirm
  the right name — skip the top-level one.

## Setup commands
- Install deps: `pnpm install`
- Start dev server: `pnpm dev`

## Testing instructions
- Find the CI plan in the `.github/workflows` folder.
- Run `pnpm turbo run test --filter <project_name>` to run every check
  defined for that package.
- From the package root you can just call `pnpm test`.
- To focus on one step: `pnpm vitest run -t "<test name>"`.
- Fix any test or type errors until the whole suite is green.
- After moving files or changing imports, run
  `pnpm lint --filter <project_name>` to confirm ESLint and TypeScript
  rules still pass.
- Add or update tests for the code you change, even if nobody asked.

## Code style
- TypeScript strict mode
- Single quotes, no semicolons
- Use functional patterns where possible

## PR instructions
- Title format: [<project_name>] <Title>
- Always run `pnpm lint` and `pnpm test` before committing.

## Security
- Never commit `.env` files.
- Do not touch production data without a manual review.

Build docs developers (and LLMs) love