How-to
AGENTS.md Guide: How to Write Instructions Every AI Coding Agent Can Read
One Markdown file can replace a pile of tool-specific rule files. Here's what to put in it, a template you can copy, and the mistakes to avoid.
Every coding agent needs the same basics before it can help: how to install dependencies, how to run tests, and what the house rules are. For a while, each tool had its own file for this, such as .cursorrules or CLAUDE.md. AGENTS.md is the shared alternative.
Where AGENTS.md came from
OpenAI released AGENTS.md as an open format in August 2025, developed together with teams behind Amp, Jules, Cursor and Factory. In December 2025, it was contributed to the Agentic AI Foundation under the Linux Foundation, which now stewards it alongside the Model Context Protocol. The official site says it's used by more than 60,000 open-source projects.
How agents use it
- You place
AGENTS.mdin the root of your repository. - Agents read it automatically when they start working.
- If you list test or lint commands, agents will try to run them and fix failures before finishing.
- In a monorepo, you can add more AGENTS.md files in subfolders. The file closest to the code being edited takes precedence.
- Your direct instructions in chat override anything in AGENTS.md.
What to put in it
The format is just Markdown, so use any headings that make sense. The sections that help agents most:
- Project overview: one or two lines on what the app is and its stack.
- Setup commands: exactly how to install and run it locally.
- Testing and checks: the commands that must pass before work is done.
- Code style and conventions: naming, folder structure, patterns to follow and avoid.
- Boundaries: files and actions that are off-limits.
- Git and PR rules: branch naming, commit message format, what to include in a PR description.
A template you can copy
# AGENTS.md
## Project
Laravel 12 blog CMS with Filament admin. PHP 8.3, MariaDB, Tailwind, Vite.
## Setup
- composer install
- npm install
- cp .env.example .env && php artisan key:generate
- php artisan migrate --seed
## Checks (run before finishing)
- php artisan test --filter=<RelatedTest>
- vendor/bin/pint --test
- vendor/bin/phpstan analyse
- npm run build
## Conventions
- Business logic lives in app/Actions, not controllers.
- Use Form Requests for validation.
- Store money as integer paise, never floats.
- New features need a Pest feature test.
## Boundaries
- Never read or edit .env or any credentials file.
- Don't change files outside the task.
- Don't run destructive database commands against non-test databases.
- Don't push; leave changes as a local commit.
## Git
- Work on the dev branch.
- Commit messages: short imperative summary, then a blank line and details.
Replace the details with your own stack. The more specific the commands, the better the results.
Monorepos and subprojects
For a repository with several apps, put a short AGENTS.md in the root with shared rules, and a more specific one in each package:
/AGENTS.md shared rules
/apps/api/AGENTS.md API-specific commands and conventions
/apps/web/AGENTS.md frontend-specific commands
When an agent edits a file in apps/web, the nearest file wins.
Moving from other rule files
If you already have a tool-specific file, you don't need to maintain two copies. The official site suggests renaming the old file to AGENTS.md and adding a symbolic link with the old name:
mv AGENT.md AGENTS.md && ln -s AGENTS.md AGENT.md
Some tools need a small setting. For Aider, add read: AGENTS.md to .aider.conf.yml. For Gemini CLI, set the context file name to AGENTS.md in .gemini/settings.json.
If you use Laravel, Laravel Boost can write its framework guidelines into AGENTS.md inside a managed block, leaving your own notes untouched.
Common mistakes
- Writing an essay. Agents read the whole file every time. Long, vague text wastes context and dilutes the rules that matter.
- Copying the README. AGENTS.md should hold what agents need and humans don't, not repeat the project description.
- Vague rules. "Write clean code" doesn't help. "Use Form Requests for validation" does.
- Out-of-date commands. If a listed command fails, agents lose time or give up. Update the file when your tooling changes.
- Secrets. Never put API keys, passwords or private URLs in it. The file is usually committed and readable by anyone with repo access.
Does it actually help?
Research and team reports vary. The clearest benefit is consistency: agents stop asking the same setup questions and follow the same checks every time. It works best combined with a clear task brief for each job. Our guide on briefing an AI coding agent safely covers that side. And if your team just moved editors, such as Cursor becoming Grok Build, a shared AGENTS.md means your instructions move with you.
Related reading: How to brief an AI coding agent safely · Cursor is now Grok Build
Frequently asked questions
What is AGENTS.md?
It's a plain Markdown file in your repository that gives AI coding agents project-specific instructions, like setup commands, tests and conventions. It's often called a README for agents.
Which AI coding agents support AGENTS.md?
The official list includes OpenAI Codex, Cursor, GitHub Copilot's coding agent, Gemini CLI, Google Jules, JetBrains Junie, Zed, Windsurf, Devin, Aider, goose and others.
Does AGENTS.md have required sections?
No. It's standard Markdown with no required fields. Use whatever headings fit your project.
What happens if there are multiple AGENTS.md files?
The file closest to the code being edited takes precedence, and your direct chat instructions override all of them.
Sources: agents.md (official site and FAQ); Agentic AI Foundation blog; InfoQ on AGENTS.md's release (August 2025); Laravel Boost documentation. Tool support lists change; check each agent's docs.
Further reading: AGENTS.md official site · Agentic AI Foundation: Writing an effective AGENTS.md
Related
How-to
Laravel Boost Guide: Teach AI Coding Agents to Write Laravel Your Way
Laravel Boost gives AI coding agents Laravel-specific guidelines, on-demand skills, an MCP server with app-aware tools, and project rules your whole t...
AI
GPT-6.2 in ChatGPT: Sol, Astra and Luna Explained, Plus What Retires on 23 December
GPT-6.2 is now in ChatGPT's Chat tab for paid users. Here's what Sol, Astra and Luna mean, which plans get what, what changed in GPT-6.2, and which ol...
AI
ChatGPT and Codex Shared Usage Limits: What Plus Users Should Know
OpenAI has moved ChatGPT Plus, Pro and Business to a single usage allowance shared between ChatGPT and Codex. Here's what counts, what doesn't, where...
The stream
All storiesNew E-Commerce Rules from 1 January 2027: What Changes for Online Shoppers in India
India's new e-commerce rules take effect on 1 January 2027. Discounts must show the lowest price of the last 30 days, sponsored listings must be labelled, and bundled fees are restricted. Here's what...
Slopaganda Meaning: Oxford's 2026 Word of the Year and How to Spot It in Your Feed
Slopaganda is low-quality propaganda made with generative AI and spread on social media. Oxford named it the 2026 Word of the Year. Here's the meaning, the history and a checklist for spotting it.
Search Console AI Clicks Are Here: How to Read the New Generative AI Data
Search Console AI clicks are finally visible. Google now reports clicks and CTR from AI Overviews, AI Mode and Discover's AI features, plus grouped AI queries with an impression share band. Here's how...
Gemini 4 Carbon vs Argon: Which Google Model to Use, and the New API Price from December
Gemini 4 Carbon is now available to developers and Google AI Ultra subscribers. Here's how it compares with Gemini 4 Argon, which plans include each model, and what the end of introductory API pricing...
Laravel Boost Guide: Teach AI Coding Agents to Write Laravel Your Way
Laravel Boost gives AI coding agents Laravel-specific guidelines, on-demand skills, an MCP server with app-aware tools, and project rules your whole team shares. Here's how to set it up and use it wel...