Any repository AGENTS.md
Put one short instruction file at the root of a repository so every coding agent starts with the same limits. This starter covers scope, secrets, and how to report the result. Add a language file from this directory when the stack is known.
Edit the checks before you commit it. An instruction that names a script the repository does not have will send the agent looking for a command that fails.
What to tell the agent
Do
- Keep the root file short enough that a nested file can cover one package.
- Name the real test command once you know it, and delete the placeholder.
- Say which files are off limits, such as generated clients or lockfiles you do not want rewritten.
- Ask for a plan when the change crosses a service boundary.
Leave alone
- Leaving a generic 'run the tests' line in a repo whose test script has a specific name.
- Telling the agent to commit, push, or open a pull request on its own.
- Duplicating a long style guide that the linter already enforces.
AGENTS.md to copy
Save this as AGENTS.md at the root of the repository, or next to the package it covers. Replace the commands with the ones in this repo. See which agents read the file.
# Agent instructions ## Scope - Do the requested change only. Leave unrelated refactors, renames, and formatting for a separate task. - Prefer editing an existing function over adding a new file. - If the request needs a new dependency, a schema change, or more than a handful of files, say so and wait. ## Secrets - Read tokens and passwords from the environment. Do not print them, paste them into source, or commit them. - Do not add .env files to git. ## Checks - Run the repository's existing test or typecheck command before saying the work is finished. - If a check fails, report the command and the first error. Do not claim success. ## Report - List the files that changed. - Name the command you ran and what it printed. - Suggest a one-line commit message.
Checks named in the file
Confirm each command exists here before you rely on it. Delete the ones this repository does not use.
- Look up the scripts the repo already has.
cat package.json - Or, in a Python repo, the task runner.
cat pyproject.toml
Questions
What is the Any repository AGENTS.md for?
It sets scope, secret handling, and a proof step for any repository that does not have its own instruction file yet.
How long should a root AGENTS.md be?
Short enough to read in a minute. Codex stops adding instruction files at 32 KiB by default. Put package-specific checks in a nested AGENTS.md next to that package.
Can one file serve Cursor, Codex, and Claude Code?
AGENTS.md is the shared file. Claude Code reads it when the repo has no CLAUDE.md. Gemini CLI reads it after you list the filename in context.fileName. The who-reads section on the rules hub has the current vendor behavior.