// How-to · Share rules and skills across agents
How to write AGENTS.md
AGENTS.md is a file in your repository written for coding agents, like a README for a new colleague: how to build, how to test, code style and commit rules.
verified 2026-10-102 official sources
Scenario: Share rules and skills across agents →
Symptoms
- The agent rediscovers how to run tests every time
- Different agents produce code in different styles
Common causes
- The repository has no stable instructions for agents, or they are scattered across tool-specific files
How to fix
- Create
AGENTS.mdat the repository root with the exact commands to install dependencies, build, run tests and lint - Add code-style rules, key points about the directory layout and things not to do (e.g. do not edit generated files, do not push to main)
- In large repositories, add
AGENTS.mdfiles in subdirectories to override rules locally - Keep it short and concrete: commands and rules, not slogans; update it together with the code
- Claude Code reads
CLAUDE.md; reference or linkAGENTS.mdfrom it so you maintain one copy
Official references
Compiled from official documentation and public discussions on 2026-10-10; not yet reproduced in our own environment. Follow the official docs if they differ.