// answer

Do I need to add AGENTS.md for Copilot code review?

Short answer

No. For Copilot code review,.github/copilot-instructions.md is the primary place for repo-wide rules, and AGENTS.md is optional extra context shared across agents.

Other people are working this out at the same time: See what people are building

Do I need to add AGENTS.md for Copilot code review to understand my repo rules

No. You do not need AGENTS.md for Copilot code review to understand repository rules. For Copilot-specific review guidance, GitHub recommends .github/copilot-instructions.md for repository-wide rules, and uses AGENTS.md as optional shared context across AI agents.

The part people get wrong is assuming one file replaces the other. It does not. If your goal is to shape how Copilot reviews pull requests in this repo, put the rule in .github/copilot-instructions.md. If your goal is to give a broader agent context that applies beyond Copilot, add AGENTS.md at the repository root. GitHub documents both, but for different purposes.

Copilot code review reads repository custom instructions, agent instructions, and agent skills from the branch being reviewed. GitHub’s docs also say custom instructions are enabled for Copilot code review by default, though repository owners can disable them in repository settings. That means the file only matters if it is present on the head branch and the setting allows it.

The simplest setup is usually one file for review rules and one file only if you need shared agent context. Put review behavior, standards, and expectations in .github/copilot-instructions.md. Put cross-tool project context in AGENTS.md. GitHub’s docs describe AGENTS.md as useful for patterns that are intentional, parts of the codebase that need closer scrutiny, and your team’s architecture and testing practices.

If you only add AGENTS.md, Copilot may still use it, but that is not the cleanest way to express code review rules. GitHub’s own guidance names .github/copilot-instructions.md as the repository-wide file for review guidance that should apply across the entire codebase. That is the file to create first when your aim is review quality, not general agent memory.

If your repository has different standards in different areas, path-specific instructions are the better tool. GitHub supports .github/instructions/**/*.instructions.md files for rules that apply only to matching files or directories. That is the right place for subsystem-specific review checks, such as extra validation for frontend/**, stricter testing expectations for payments/**, or language-specific guidance for one part of the tree.

A practical setup looks like this: one .github/copilot-instructions.md file for baseline review rules, one or more path-specific instruction files for special cases, and AGENTS.md only when you want a single root-level document that helps multiple agents understand the repo. That structure keeps the review rules visible, avoids duplication, and makes it easier to tell which instructions should affect Copilot.

The inconvenient part is that Copilot will only be as useful as the instructions you actually maintain. If the repository changed and the instructions did not, reviews can drift from your current conventions. GitHub’s docs also note that instructions are read from the branch under review, so a stale or missing file on that branch means Copilot reviews without that guidance. That is easy to miss in a fast-moving repo.

A concrete example helps. Suppose your repo forbids nested ternary operators, requires tests for any service-layer change, and wants security-sensitive code checked against a separate checklist. Put the always-on review rules in .github/copilot-instructions.md, put the service-specific rules in a path instruction file if they only apply under src/services/, and add AGENTS.md only if you want broader project context for multiple tools. GitHub explicitly shows this pattern in its examples.

If you are choosing between the two files, start with .github/copilot-instructions.md. Add AGENTS.md when you want extra repository context that is not just Copilot review policy. That gives you a clear split: review rules for Copilot, shared context for agents. DevConnect’s own guidance for builders follows the same idea, keep the working rules where the tool expects them and avoid making one file do every job.

If you want the short version: Copilot code review does not require AGENTS.md. It can use it, but the file you actually need for repository-wide review rules is .github/copilot-instructions.md, with path-specific .instructions.md files for exceptions and AGENTS.md only for broader shared context.

For teams that already have a root AGENTS.md, the rule to remember is not to move review policy there by default. Keep review policy in the Copilot instructions file so it is obvious, versioned with the repo, and easy to audit. Keep AGENTS.md for context that should help Copilot and other agents understand the project, but does not need to be the source of truth for code review behavior.

If you are setting this up in a new repository, start with a small, explicit instruction file and test it in one pull request. GitHub says Copilot uses the instructions from the head branch, so you can validate the change before merging it. That is the cleanest way to confirm the review reads the rules you meant to give it.

Frequently asked questions

What file should I create first for Copilot review rules

Create `.github/copilot-instructions.md` first. GitHub documents it as the repository-wide file for Copilot review guidance.

Can Copilot use path-specific rules instead of one repo-wide file

Yes. GitHub supports `.github/instructions/**/*.instructions.md` files for rules that only apply to matching paths or file types.

What is AGENTS.md for if I already have Copilot instructions

Use `AGENTS.md` for broader repository context that should help multiple agents, not as the primary place for Copilot review policy.

Will Copilot read instructions from the base branch or the PR branch

GitHub says Copilot reads repository custom instructions, agent instructions, and agent skills from the branch being reviewed.

Know someone stuck on this? Send them the answer.

Sources

Every link here was fetched and confirmed to resolve before this page went live.

More on this topic: Building with AI

Related questions

Not the question you had?

Ask it. Every source gets fetched and checked before anything goes up, so it takes a day or two, and questions that cannot be answered honestly do not get a page at all.

No account, no email address needed.

Everyone here builds with AI, and says so

DevConnect is for developers who use AI and are honest about it. The interesting part is not that the code was generated, it is what you did with it afterwards.