You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/copilot/how-tos/configure-custom-instructions/add-repository-instructions.md
+51-9Lines changed: 51 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,14 @@ This version of this article is for using repository custom instructions in Xcod
65
65
66
66
{% endxcode %}
67
67
68
+
{% copilotcli %}
69
+
70
+
This version of this article is for using repository custom instructions with the {% data variables.product.prodname_copilot %} CLI. Click the tabs above for instructions on using custom instructions in other environments.
71
+
72
+
{% data reusables.copilot.repository-custom-instructions-prerequisites %}
73
+
74
+
{% endcopilotcli %}
75
+
68
76
{% eclipse %}
69
77
70
78
> [!NOTE] This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change.
@@ -197,9 +205,45 @@ Once saved, these instructions will apply to the current project in Eclipse that
197
205
198
206
{% endeclipse %}
199
207
208
+
{% copilotcli %}
209
+
210
+
{% data variables.product.prodname_copilot %} supports three types of repository custom instructions. See the table above for details of which {% data variables.product.prodname_copilot %} features support these types of instructions.
211
+
212
+
***Repository-wide custom instructions**, which apply to all requests made in the context of a repository.
213
+
214
+
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).
215
+
216
+
***Path-specific custom instructions**, which apply to requests made in the context of files that match a specified path.
217
+
218
+
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).
219
+
220
+
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. You should avoid potential conflicts between instructions as {% data variables.product.prodname_copilot_short %}'s choice between conflicting instructions is non-deterministic.
221
+
222
+
***Agent instructions** are used by AI agents.
223
+
224
+
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. For more information, see the [openai/agents.md repository](https://github.com/openai/agents.md).
225
+
226
+
Alternatively, you can use a single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository.
227
+
228
+
## Creating repository-wide custom instructions
229
+
230
+
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
231
+
232
+
Create the `.github` directory if it does not already exist.
233
+
234
+
1. Add natural language instructions to the file, in Markdown format.
235
+
236
+
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.
237
+
238
+
## Creating path-specific custom instructions
239
+
240
+
{% data reusables.copilot.custom-instructions-path %}
241
+
242
+
{% endcopilotcli %}
243
+
200
244
{% vscode %}
201
245
202
-
{% data variables.product.prodname_vscode_shortname %} supports two types of repository custom instructions:
246
+
{% data variables.product.prodname_vscode_shortname %} supports three types of repository custom instructions. See the table above for details of which {% data variables.product.prodname_copilot %} features support these types of instructions.
203
247
204
248
***Repository-wide custom instructions**, which apply to all requests made in the context of a repository.
205
249
@@ -211,6 +255,10 @@ Once saved, these instructions will apply to the current project in Eclipse that
211
255
212
256
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.
213
257
258
+
***Agent instructions** are used by AI agents.
259
+
260
+
For {% data variables.copilot.copilot_chat_short %} in {% data variables.product.prodname_vscode_shortname %}, instructions must be in a file called `AGENTS.md` in the root of the workspace. For more information, see the [openai/agents.md repository](https://github.com/openai/agents.md).
261
+
214
262
## Creating repository-wide custom instructions
215
263
216
264
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
@@ -243,26 +291,20 @@ Once saved, these instructions will apply to the current project in Eclipse that
243
291
244
292
{% webui %}
245
293
246
-
You can create several types of repository custom instructionsfor use on {% data variables.product.prodname_dotcom_the_website %}:
294
+
{% data variables.product.prodname_copilot_short %} on {% data variables.product.github %} supports three types of repository custom instructions. See the table above for details of which {% data variables.product.prodname_copilot %} features support these types of instructions.
247
295
248
296
***Repository-wide custom instructions** apply to all requests made in the context of a repository.
249
297
250
-
Supported by: **{% data variables.copilot.copilot_chat_short %}**, **{% data variables.copilot.copilot_coding_agent %}**, and **{% data variables.copilot.copilot_code-review_short %}**.
251
-
252
298
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).
253
299
254
300
***Path-specific custom instructions** apply to requests made in the context of files that match a specified path.
255
301
256
-
Supported by: **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}**.
257
-
258
302
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).
259
303
260
304
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.
261
305
262
306
***Agent instructions** are used by AI agents.
263
307
264
-
Supported by: **{% data variables.copilot.copilot_coding_agent %}** and {% data variables.copilot.copilot_cli_short %}.
265
-
266
308
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. For more information, see the [openai/agents.md repository](https://github.com/openai/agents.md).
267
309
268
310
Alternatively, you can use a single `CLAUDE.md` or `GEMINI.md` file stored in the root of the repository.
@@ -453,7 +495,7 @@ Answer all questions in less than 1000 characters, and words of no more than 12
453
495
454
496
## Repository custom instructions in use
455
497
456
-
The instructions in the file(s) are available for use by {% data variables.copilot.copilot_chat_short %} as soon as you save the file(s). The complete set of instructions will be automatically added to requests that you submit to {% data variables.product.prodname_copilot_short %} in the context of that repository. For example, they are added to the prompt you submit to {% data variables.copilot.copilot_chat_short %}.
498
+
The instructions in the file(s) are available for use by {% data variables.product.prodname_copilot_short %} as soon as you save the file(s). The complete set of instructions will be automatically added to requests that you submit to {% data variables.product.prodname_copilot_short %} in the context of that repository. For example, they are added to the prompt you submit to {% data variables.copilot.copilot_chat_short %}.
0 commit comments