Skip to content

Commit 7d10f72

Browse files
authored
Merge pull request #40208 from github/repo-sync
Repo sync
2 parents fe168b8 + 1e23f84 commit 7d10f72

14 files changed

+140
-90
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ When you reach your monthly quota you will not be able to get a code review from
5757
* Premium feature. Uses one premium request from your monthly quota per review.
5858
* Supports custom instructions and custom coding guidelines.
5959

60+
## Providing instructions for {% data variables.product.prodname_copilot_short %} code reviews
61+
62+
You can tailor the reviews that {% data variables.product.prodname_copilot_short %} generates by providing custom instructions. This helps {% data variables.product.prodname_copilot_short %} to review the code in a way that matches your team's coding standards, tools, and practices. See [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-repository-instructions?tool=webui) and [AUTOTITLE](/copilot/how-tos/configure-custom-instructions/add-organization-instructions).
63+
6064
## Validating {% data variables.product.prodname_copilot_short %} code reviews
6165

6266
{% data variables.product.prodname_copilot_short %} isn't guaranteed to spot all problems or issues in a pull request, and sometimes it will make mistakes. Always validate {% data variables.product.prodname_copilot_short %}'s feedback carefully, and supplement {% data variables.product.prodname_copilot_short %}'s feedback with a human review.

content/copilot/concepts/response-customization.md

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,9 @@ contentType: concepts
5959

6060
### About repository custom instructions
6161

62-
Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository.
62+
You can create two types of repository custom instructions for {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %}:
6363

64-
Repository custom instructions files are used for chat responses, for code review, and also by {% data variables.product.prodname_copilot_short %} when you assign it to an issue or ask it to create a pull request. Instructions included in this file can help {% data variables.product.prodname_copilot_short %} to work on files in a way that matches your team's working practices and conforms to coding standards for your project. See [AUTOTITLE](/copilot/using-github-copilot/coding-agent/about-assigning-tasks-to-copilot).
65-
66-
{% data reusables.copilot.repository-custom-instructions-example %}
67-
68-
{% data reusables.copilot.repository-cust-instr-code-review %}
64+
{% data reusables.copilot.custom-instructions-about %}
6965

7066
{% endwebui %}
7167

@@ -75,7 +71,7 @@ Repository custom instructions files are used for chat responses, for code revie
7571

7672
There are two types of files you can use to provide context and instructions to {% data variables.copilot.copilot_chat %} in {% data variables.product.prodname_vscode_shortname %}:
7773

78-
* **Repository custom instructions** allow you to specify repository-wide instructions and preferences, in a single file, that apply to any conversation held in the context of the repository.
74+
* **Repository custom instructions** allow you to specify instructions and preferences that {% data variables.product.prodname_copilot_short %} will consider when working in the context of the repository.
7975
* **Prompt files** (public preview) allow you to save common prompt instructions and relevant context in Markdown files (`*.prompt.md`) that you can then reuse in your chat prompts. Prompt files are only available in {% data variables.product.prodname_vscode_shortname %}.
8076

8177
While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction.
@@ -117,7 +113,9 @@ There are two types of repository custom instructions you can use to provide con
117113

118114
Custom instructions consist of natural language instructions and are most effective when they are short, self-contained statements. Consider the scope over which you want the instruction to apply when choosing whether to add an instruction on the personal, repository, or (if available) organization level.
119115

120-
{% data reusables.copilot.custom-instructions-interactions-note %}
116+
> [!NOTE]
117+
> * {% data reusables.copilot.custom-instructions-chat-precedence %}
118+
> * {% data reusables.copilot.custom-instructions-conflict %}
121119
122120
Here are some common use cases and examples for each type of custom instructions:
123121
* **Personal custom instructions:**
@@ -138,19 +136,9 @@ Here are some common use cases and examples for each type of custom instructions
138136

139137
## About repository custom instructions
140138

141-
Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions.
142-
143-
Common use cases include:
144-
145-
* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework.
146-
* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code.
147-
* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include.
148-
149-
### Example
150-
151-
{% data reusables.copilot.repository-custom-instructions-example %}
139+
You can create two types of repository custom instructions for use in {% data variables.product.prodname_vscode_shortname %}:
152140

153-
{% data reusables.copilot.repository-cust-instr-code-review %}
141+
{% data reusables.copilot.custom-instructions-about %}
154142

155143
## About prompt files
156144

content/copilot/how-tos/configure-custom-instructions/add-organization-instructions.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Adding organization custom instructions for GitHub Copilot
33
shortTitle: Add organization instructions
4-
intro: 'Customize {% data variables.copilot.copilot_chat %} responses for members of your organization.'
4+
intro: 'Customize {% data variables.product.prodname_copilot_short %} responses for members of your organization.'
55
permissions: Organization owners
66
product: 'Organizations with a {% data variables.copilot.copilot_for_business %} or {% data variables.copilot.copilot_enterprise %} plan'
77
versions:
@@ -15,18 +15,28 @@ redirect_from:
1515
contentType: how-tos
1616
---
1717

18-
{% data reusables.copilot.organization-instructions-note %}
18+
> [!NOTE]
19+
> This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change.
20+
>
21+
> Organization custom instructions are currently only supported for {% data variables.copilot.copilot_chat_short %} on {% data variables.product.prodname_dotcom_the_website %} and {% data variables.copilot.copilot_code-review_short %}.
1922
2023
For an overview of the methods you can use to customize {% data variables.copilot.copilot_chat %} responses, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=webui).
2124

22-
## About organization custom instructions for {% data variables.copilot.copilot_chat %}
25+
## About organization custom instructions for {% data variables.product.prodname_copilot_short %}
2326

24-
Organization owners can add instructions for {% data variables.copilot.copilot_chat %} in order to tailor chat responses to the needs and preferences of your organization. For example, you can choose to always have {% data variables.copilot.copilot_chat_short %} respond in your company's language of choice or with a particular style. Some examples of instructions you could add are:
27+
Organization owners can add instructions for {% data variables.product.prodname_copilot_short %}, to tailor responses to the needs and preferences of your organization. For example, you can choose to always have {% data variables.copilot.copilot_chat_short %} respond in your company's language of choice or with a particular style.
28+
29+
Custom instructions defined in an organization's {% data variables.product.prodname_copilot_short %} settings are used for all members of the organization, irrespective of whether they receive their {% data variables.product.prodname_copilot_short %} subscription from that organization.
30+
31+
Some examples of instructions you could add are:
2532
* `Always respond in Spanish.`
2633
* `Do not generate code blocks in responses.`
2734
* `For questions related to security, use the Security Docs Knowledge Base.`
2835

29-
{% data reusables.copilot.custom-instructions-interactions-note %}
36+
> [!NOTE]
37+
> * {% data reusables.copilot.custom-instructions-chat-precedence %}
38+
> * For {% data variables.copilot.copilot_code-review_short %}, the order of precedence is: instructions in any applicable `.github/instructions/NAME.instructions.md` file, then the instructions in the `.github/copilot-instructions.md` file, then the organization-level custom instructions.
39+
> * {% data reusables.copilot.custom-instructions-conflict %}
3040
3141
## Adding organization custom instructions
3242

content/copilot/how-tos/configure-custom-instructions/add-personal-instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ You can add custom instructions for {% data variables.copilot.copilot_chat %} in
2424
* `Your style is a helpful colleague, minimize explanations but provide enough context to understand the code.`
2525
* `Always provide examples in TypeScript.`
2626

27-
{% data reusables.copilot.custom-instructions-interactions-note %}
27+
> [!NOTE]
28+
> * {% data reusables.copilot.custom-instructions-chat-precedence %}
29+
> * {% data reusables.copilot.custom-instructions-conflict %}
2830
2931
## Adding personal custom instructions
3032

content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ This version of this article is for using repository custom instructions in Ecli
5656

5757
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences.
5858

59-
{% data reusables.copilot.repository-custom-instructions-support %}
59+
Repository custom instructions are currently supported for:
60+
* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vscode_shortname %}
61+
* **{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vs %}, JetBrains IDEs, Xcode, Eclipse, and on the {% data variables.product.github %} website (`copilot-instructions.md` file only)
62+
* **{% data variables.copilot.copilot_coding_agent %}**
63+
* **{% data variables.copilot.copilot_code-review_short %}**
6064

6165
## Prerequisites for repository custom instructions
6266

@@ -98,13 +102,13 @@ Repository custom instructions let you provide {% data variables.product.prodnam
98102

99103
{% endeclipse %}
100104

101-
## Creating a repository custom instructions file
105+
## Creating custom instructions
102106

103107
{% jetbrains %}
104108

105-
JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
109+
JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository, and a locally stored `global-copilot-instructions.md` file.
106110

107-
You can create a custom instructions file in your repository using the {% data variables.product.prodname_copilot_short %} settings page, or you can create the file manually.
111+
You can create the `.github/copilot-instructions.md` file in your repository using the {% data variables.product.prodname_copilot_short %} settings page, or you can create the file manually.
108112

109113
Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.
110114

@@ -184,40 +188,31 @@ Once saved, these instructions will apply to the current project in Eclipse that
184188

185189
{% vscode %}
186190

187-
{% data variables.product.prodname_vscode_shortname %} supports either:
191+
{% data variables.product.prodname_vscode_shortname %} supports two types of repository custom instructions:
188192

189-
* A single `.github/copilot-instructions.md` custom instructions file stored in the repository
190-
* One or more `.instructions.md` files stored within `.github/instructions` in the repository. Each file can specify `applyTo` frontmatter to define what files or directories its instructions apply to.
193+
* **Repository-wide custom instructions**, which apply to all requests made in the context of a repository.
191194

192-
### Using a single `.github/copilot-instructions.md` file
195+
These are specified in a `copilot-instructions.md` file in the `.github` directory of the repository. See [Creating repository-wide custom instructions](#creating-repository-wide-custom-instructions).
193196

194-
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
197+
* **Path-specific custom instructions**, which apply to requests made in the context of files that match a specified path.
195198

196-
Create the `.github` directory if it does not already exist.
199+
These are specified in one or more `NAME.instructions.md` files within the `.github/instructions` directory in the repository. See [Creating path-specific custom instructions](#creating-path-specific-custom-instructions).
197200

198-
1. Add natural language instructions to the file, in Markdown format.
201+
If the path you specify matches a file that {% data variables.product.prodname_copilot_short %} is working on, and a repository-wide custom instructions file also exists, then the instructions from both files are used.
199202

200-
Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.
203+
## Creating repository-wide custom instructions
201204

202-
### Using one or more `.instructions.md` files
205+
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
203206

204-
1. Create the `.github/instructions` directory if it does not already exist.
207+
Create the `.github` directory if it does not already exist.
205208

206-
1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s).
209+
1. Add natural language instructions to the file, in Markdown format.
207210

208211
Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.
209212

210-
1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax.
213+
## Creating path-specific custom instructions
211214

212-
```markdown
213-
---
214-
applyTo: "app/models/**/*.rb"
215-
---
216-
217-
Add custom instructions here
218-
```
219-
220-
To apply the instructions to all files, use the `**` pattern.
215+
{% data reusables.copilot.custom-instructions-path %}
221216

222217
{% endvscode %}
223218

@@ -237,19 +232,35 @@ Once saved, these instructions will apply to the current project in Eclipse that
237232

238233
{% webui %}
239234

240-
**{% data variables.copilot.copilot_chat_short %}** on the {% data variables.product.github %} website, **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}** support a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
235+
You can create several types of repository custom instructions for use on {% data variables.product.prodname_dotcom_the_website %}:
236+
237+
* **Repository-wide custom instructions** apply to all requests made in the context of a repository.
238+
239+
Supported by: **{% data variables.copilot.copilot_chat_short %}**, **{% data variables.copilot.copilot_coding_agent %}**, and **{% data variables.copilot.copilot_code-review_short %}**.
240+
241+
These are specified in a `copilot-instructions.md` file in the `.github` directory of the repository. See [Creating repository-wide custom instructions](#creating-repository-wide-custom-instructions-1).
242+
243+
* **Path-specific custom instructions** apply to requests made in the context of files that match a specified path.
241244

242-
In addition, **{% data variables.copilot.copilot_coding_agent %}** supports:
245+
Supported by: **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}**.
243246

244-
* One or more `.instructions.md` files stored within `.github/instructions` in the repository. Each file can specify `applyTo` frontmatter to define what files or directories its instructions apply to.
245-
* One or more `AGENTS.md` files stored anywhere within the repository. When {% data variables.product.prodname_copilot_short %} is working, the nearest `AGENTS.md` file in the directory tree will take precedence.
246-
* A single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository.
247+
These are specified in one or more `NAME.instructions.md` files within the `.github/instructions` directory in the repository. See [Creating path-specific custom instructions](#creating-path-specific-custom-instructions-1).
247248

248-
### Using a single `.github/copilot-instructions.md` file
249+
If the path you specify matches a file that {% data variables.product.prodname_copilot_short %} is working on, and a repository-wide custom instructions file also exists, then the instructions from both files are used.
249250

250-
You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.github/copilot-instructions.md` file, or you can write your own instructions file.
251+
* **Agent instructions** are used by AI agents.
251252

252-
#### Asking {% data variables.copilot.copilot_coding_agent %} to generate a `.github/copilot-instructions.md` file
253+
Supported by: **{% data variables.copilot.copilot_coding_agent %}**.
254+
255+
You can create one or more `AGENTS.md` files, stored anywhere within the repository. When {% data variables.product.prodname_copilot_short %} is working, the nearest `AGENTS.md` file in the directory tree will take precedence.
256+
257+
Alternatively, you can use a single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository.
258+
259+
## Creating repository-wide custom instructions
260+
261+
You can create your own custom instructions file from scratch. See [Writing your own copilot-instructions.md file](#writing-your-own-copilot-instructionsmd-file). Alternatively, you can ask {% data variables.copilot.copilot_coding_agent %} to generate one for you.
262+
263+
### Asking {% data variables.copilot.copilot_coding_agent %} to generate a `copilot-instructions.md` file
253264

254265
> [!NOTE]
255266
> {% data reusables.copilot.coding-agent.preview-note-text %}
@@ -341,7 +352,7 @@ You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.gi
341352

342353
{% data variables.product.prodname_copilot_short %} will start a new session, which will appear in the list below the prompt box. {% data variables.product.prodname_copilot_short %} will create a draft pull request, write your custom instructions, push them to the branch, then add you as a reviewer when it has finished, triggering a notification.
343354

344-
#### Writing your own `.github/copilot-instructions.md` file
355+
### Writing your own `copilot-instructions.md` file
345356

346357
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
347358

@@ -354,25 +365,12 @@ You can ask {% data variables.copilot.copilot_coding_agent %} to generate a `.gi
354365
> [!TIP]
355366
> The first time you create a pull request in a given repository with {% data variables.copilot.copilot_coding_agent %}, {% data variables.product.prodname_copilot_short %} will leave a comment with a link to automatically generate custom instructions for the repository.
356367

357-
### Using one or more `.instructions.md` files
358-
359-
1. Create the `.github/instructions` directory if it does not already exist.
360-
361-
1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s).
368+
## Creating path-specific custom instructions
362369

363-
Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility.
364-
365-
1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax.
366-
367-
```markdown
368-
---
369-
applyTo: "app/models/**/*.rb"
370-
---
371-
372-
Add custom instructions here
373-
```
370+
> [!NOTE]
371+
> Currently, on {% data variables.product.prodname_dotcom_the_website %}, path-specific custom instructions are only supported for {% data variables.copilot.copilot_coding_agent %} and {% data variables.copilot.copilot_code-review_short %}.
374372

375-
To apply the instructions to all files, use the `**` pattern.
373+
{% data reusables.copilot.custom-instructions-path %}
376374

377375
{% endwebui %}
378376

@@ -459,7 +457,9 @@ Whenever repository custom instructions are used by {% data variables.copilot.co
459457

460458
You can click the reference to open the file.
461459

462-
{% data reusables.copilot.custom-instructions-interactions-note %}
460+
> [!NOTE]
461+
> * {% data reusables.copilot.custom-instructions-chat-precedence %}
462+
> * {% data reusables.copilot.custom-instructions-conflict %}
463463
464464
{% endwebui %}
465465

0 commit comments

Comments
 (0)