Skip to content

Commit 7d77302

Browse files
vgrlguntrip
andauthored
[Fast follow] CCR: AGENTS.md support (#62035)
Co-authored-by: Felix Guntrip <guntrip@github.com>
1 parent e9d50b5 commit 7d77302

6 files changed

Lines changed: 54 additions & 7 deletions

File tree

content/copilot/concepts/agents/code-review.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,21 @@ The more {% data variables.product.prodname_copilot_short %} knows about the cod
186186

187187
These are short, natural-language statements that you write and store as one or more files in a repository. If you are the owner of an organization on {% data variables.product.github %}, you can also define custom instructions in the settings for your organization. For more information, see [AUTOTITLE](/copilot/concepts/prompting/response-customization?tool=webui#about-repository-custom-instructions).
188188

189+
### Choosing between custom instructions, AGENTS.md, and skills
190+
191+
{% data variables.copilot.copilot_code-review_short %} can draw on several sources of customization, and each serves a different purpose. Use `.github/copilot-instructions.md` for repository-wide rules specific to {% data variables.product.prodname_copilot_short %}, use path-specific `*.instructions.md` files under `.github/instructions/` for rules that apply only to certain files or directories, use `AGENTS.md` for standing rules you want to share across AI tools and agents, and use skills for task-specific workflows that {% data variables.product.prodname_copilot_short %} runs on demand. The following table summarizes when to use each and how to provide rules.
192+
193+
| Use | `copilot-instructions.md` | Path-specific `*.instructions.md` | `AGENTS.md` | Skills |
194+
| --- | --- | --- | --- | --- |
195+
| Best for | Repository-wide, always-on rules for {% data variables.product.prodname_copilot_short %} | Always-on rules for specific paths, file types, or directories | Always-on rules shared across AI agents | Task-specific review workflows |
196+
| Stored in | `.github/copilot-instructions.md` | `.github/instructions/**/*.instructions.md` | Repository root (`AGENTS.md`) | `.github/skills/...` |
197+
| Examples | Coding standards, architecture defaults, test expectations | `content/**` writing rules, `src/**` coding conventions, language-specific guidance | Shared repository conventions that should apply beyond {% data variables.product.prodname_copilot_short %} | Reviews, releases, migrations, analysis |
198+
| Activation | Automatic | Automatic when the changed files match the instruction scope | Automatic (read from repository root) | Automatic when relevant (e.g. review-focused skills such as `code-review`), or on demand |
199+
| Scope | Repository-wide and {% data variables.product.prodname_copilot_short %}-specific | Repository sub-paths and {% data variables.product.prodname_copilot_short %}-specific | Cross-tool / agent-agnostic | Invoked per task |
200+
| Rule | "{% data variables.product.prodname_copilot_short %}, always know this for this repository" | "{% data variables.product.prodname_copilot_short %}, always know this when working in these paths" | "Any agent, always know this" | "Do this when needed" |
201+
202+
For more information, see [AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/customize-cloud-agent/add-skills) and [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions).
203+
189204
### {% data variables.copilot.copilot_memory %} ({% data variables.release-phases.public_preview %})
190205

191206
If you have a {% data variables.copilot.copilot_pro_short %}, {% data variables.copilot.copilot_pro_plus_short %}, or {% data variables.copilot.copilot_max_short %} plan, you can enable {% data variables.copilot.copilot_memory %}. This allows {% data variables.product.prodname_copilot_short %} to store useful details it has learned about a repository. {% data variables.product.prodname_copilot_short %} can then use this information when it reviews pull requests in that repository. For more information, see [AUTOTITLE](/copilot/concepts/agents/copilot-memory).

content/copilot/how-tos/copilot-on-github/use-copilot-agents/overview.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Pick a repository where {% data variables.copilot.copilot_cloud_agent %} is enab
3030
While {% data variables.product.prodname_copilot_short %} works on the issue, start a second, non-coding task to see two sessions running in parallel.
3131

3232
1. In the same repository, click the **{% octicon "agent" aria-hidden="true" aria-label="agent" %} Agents** tab.
33-
1. Type a research prompt.
34-
33+
1. Type a research prompt.
34+
3535
For example: `Investigate which dependencies in this repo are outdated and summarize what upgrading would involve.`
3636
1. Click **{% octicon "paper-airplane" aria-label="Start task" %}** or press <kbd>Enter</kbd>.
3737

@@ -52,7 +52,7 @@ For more details on monitoring, steering, and stopping sessions, see [AUTOTITLE]
5252
When the coding task finishes, {% data variables.product.prodname_copilot_short %} opens a pull request and adds you as a reviewer.
5353

5454
1. Open the pull request from the notification or from the session log.
55-
1. In the right sidebar, click **Reviewers**, then select **{% data variables.product.prodname_copilot_short %}**.
55+
1. Under "Reviewers" in the right sidebar, next to **{% data variables.product.prodname_copilot_short %}**, click **Request**.
5656
1. Wait for {% data variables.copilot.copilot_code-review_short %} to leave comments—usually under 30 seconds.
5757

5858
Read through the review comments. {% data variables.product.prodname_copilot_short %} may suggest changes you can apply directly with a click.

content/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ category:
2424

2525
For a full introduction to {% data variables.copilot.copilot_code-review %}, see [AUTOTITLE](/copilot/concepts/agents/code-review).
2626

27+
{% data variables.copilot.copilot_code-review_short %} uses {% data variables.product.prodname_actions %} to run agentic capabilities. For more information, see [Agentic capabilities for {% data variables.copilot.copilot_code-review_short %}](/copilot/concepts/agents/code-review#usage-of-github-actions-runners-for-agentic-capabilities-in-code-review).
28+
2729
{% webui %}
2830

2931
{% data variables.copilot.copilot_code-review_short %} is also available for organization members without a {% data variables.product.prodname_copilot_short %} license, when enabled by an enterprise administrator or organization owner. See [{% data variables.copilot.copilot_code-review_short %} for organization members without a {% data variables.product.prodname_copilot_short %} license](/copilot/concepts/agents/code-review#copilot-code-review-for-organization-members-without-a-copilot-license).

content/copilot/reference/custom-instructions-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ WRITING NOTE: The following tables have been written using HTML rather than Mark
5252
<ul style="list-style: none; padding-left: 1.5em; margin-left: 0;">
5353
{% data reusables.copilot.ci-support-repository %}
5454
{% data reusables.copilot.ci-support-path %}
55+
{% data reusables.copilot.ci-support-agents-only %}
5556
{% data reusables.copilot.ci-support-organization %}
5657
</ul>
5758
</td>

content/copilot/tutorials/customize-code-review.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ const activeUsers = users.filter(user => user.isActive);
109109

110110
## Organizing instructions across files
111111

112-
{% data variables.copilot.copilot_code-review_short %} supports two types of instruction files:
112+
{% data variables.copilot.copilot_code-review_short %} supports several types of instruction files:
113113

114114
1. **`copilot-instructions.md`**: Repository-wide instructions that apply to all files.
115115
1. **`*.instructions.md`**: Path-specific instructions that apply to certain files or directories.
116+
1. **`AGENTS.md`**: Repository-level agent-specific instructions.
116117

117118
Use path-specific instructions to keep {% data variables.product.prodname_copilot_short %} focused and prevent it from applying language-specific rules to the wrong files.
118119

@@ -229,11 +230,37 @@ applyTo: "src/components/**/*.{tsx,jsx}"
229230
- Ensure color contrast meets WCAG AA standards
230231
````
231232

233+
### When to use agent-specific instructions
234+
235+
Use `AGENTS.md` for instructions that apply to specific {% data variables.copilot.custom_agents_short %} in your repository. This allows you to tailor the behavior of different agents for different tasks, including shaping {% data variables.copilot.copilot_code-review_short %} feedback to better reflect your repository's conventions and expectations.
236+
237+
**Example: Agent-specific instructions**
238+
239+
Create a file called `AGENTS.md` at the root of your repository:
240+
241+
````markdown copy
242+
# AGENTS.md
243+
244+
## Code Review
245+
246+
Your primary goal is to validate that incoming code changes are secure, performant, and match this repository's engineering standards.
247+
248+
### Code Style & Anti-Patterns
249+
250+
Enforce these strict patterns for code inspection:
251+
252+
- **Asynchronous Code:** Prefer `async/await` syntax over explicit `.then()` chains.
253+
- **Error Handling:** Every API call must be wrapped in a structured `try/catch` block.
254+
- **State Management:** React components must keep local UI state completely isolated from global stores.
255+
````
256+
232257
### Breaking up complex instruction sets
233258

234259
For large repositories with many concerns, break instructions into multiple focused files:
235260

236261
```text
262+
AGENTS.md # Agent-specific
263+
237264
.github/
238265
copilot-instructions.md # General standards
239266

data/reusables/copilot/code-review/custom-instructions-information.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
You can customize {% data variables.copilot.copilot_code-review_short %} by adding custom instructions to your repository.
1+
You can customize {% data variables.copilot.copilot_code-review_short %} by adding custom instructions to your repository. Repository custom instructions can either be repository wide or path specific.
22

3-
Repository custom instructions can either be repository wide or path specific. You specify repository-wide custom instructions in a `.github/copilot-instructions.md` file in your repository. You can use this file to store information that you want {% data variables.product.prodname_copilot_short %} to consider when reviewing code anywhere in the repository.
3+
Use `.github/copilot-instructions.md` for repository-wide review guidance that should apply across the entire codebase. This is a good place to describe organization-wide expectations, such as coding standards, review criteria, or general practices that {% data variables.product.prodname_copilot_short %} should consider in every review.
44

5-
You can also write instructions that {% data variables.product.prodname_copilot_short %} will only use when reviewing code in files that match a specified path. You write these instructions in one or more `.github/instructions/**/*.instructions.md` files.
5+
Use an `AGENTS.md` file in the root of your repository to provide additional repository context that helps {% data variables.product.prodname_copilot_short %} better understand how your project works. For example, you can explain which patterns are intentional, which parts of the codebase need closer scrutiny, and what your team considers good architecture, testing, and implementation practices. This helps make reviews more relevant and aligned with the way your team builds software.
6+
7+
Use `.github/instructions/**/*.instructions.md` files for path-specific instructions that only apply when reviewing matching files. This is useful when different parts of the repository follow different conventions, require specialized checks, or need review guidance tailored to a particular language, framework, or subsystem.
68

79
For more information, see [AUTOTITLE](/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions).
810

0 commit comments

Comments
 (0)