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/agents/copilot-coding-agent/best-practices-for-using-copilot-to-work-on-tasks.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -70,7 +70,7 @@ By adding custom instructions to your repository, you can guide {% data variable
70
70
71
71
If {% data variables.product.prodname_copilot_short %} is able to build, test and validate its changes in its own development environment, it is more likely to produce good pull requests which can be merged quickly.
72
72
73
-
Add instructions to a `.github/copilot-instructions.md` file in the repository. For more information, see [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot?tool=webui).
73
+
You can add instructions in a single `.github/copilot-instructions.md` file in the repository, or create one or more `.github/instructions/**/*.instructions.md` files applying to different files or directories in your repository. For more information, see [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot?tool=webui).
74
74
75
75
Here is an example of an effective `copilot-instructions.md` file:
76
76
@@ -107,7 +107,7 @@ This is a Go based repository with a Ruby client for certain API endpoints. It i
107
107
5. Document public APIs and complex logic. Suggest changes to the `docs/` folder when appropriate
108
108
```
109
109
110
-
If you choose not to include a `.github/copilot-instructions.md` file in your repository, {% data variables.product.prodname_copilot_short %} will fall back to pre-existing custom instructions including `CLAUDE.md`, `AGENTS.md` and `GEMINI.md`.
110
+
If you choose not to include any {% data variables.product.prodname_copilot_short %} instructions files in your repository, {% data variables.product.prodname_copilot_short %} will fall back to pre-existing custom instructions including `CLAUDE.md`, `AGENTS.md` and `GEMINI.md`.
Copy file name to clipboardExpand all lines: content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md
+66-37Lines changed: 66 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,27 +17,12 @@ topics:
17
17
18
18
This version of this article is for using repository custom instructions on the {% data variables.product.github %} website. Click the tabs above for information on using custom instructions in other environments. <!-- markdownlint-disable-line MD027 -->
19
19
20
-
## About repository custom instructions for {% data variables.product.prodname_copilot_short %}
21
-
22
-
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences. For a full introduction to custom instructions, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=webui).
23
-
24
-
{% data reusables.copilot.repository-custom-instructions-support %}
25
-
***{% data variables.copilot.copilot_coding_agent %}**
26
-
***{% data variables.copilot.copilot_code-review_short %}**
27
-
28
20
{% endwebui %}
29
21
30
22
{% vscode %}
31
23
32
24
This version of this article is for using repository custom instructions and prompt files in {% data variables.product.prodname_vscode_shortname %}. Click the tabs above for instructions on using custom instructions in other environments.
33
25
34
-
## About repository custom instructions and prompt files for {% data variables.product.prodname_copilot_short %}
35
-
36
-
You can provide {% data variables.product.prodname_copilot_short %} with repository-wide instructions or reusable prompt files to give it context and guidance when working in {% data variables.product.prodname_vscode_shortname %}. For a full introduction to repository custom instructions and prompt files, including examples, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=vscode).
37
-
38
-
{% data reusables.copilot.repository-custom-instructions-support %}
39
-
***{% data variables.copilot.copilot_code-review_short %}**
40
-
41
26
{% endvscode %}
42
27
43
28
{% visualstudio %}
@@ -46,13 +31,6 @@ You can provide {% data variables.product.prodname_copilot_short %} with reposit
46
31
47
32
This version of this article is for using repository custom instructions in {% data variables.product.prodname_vs %}. Click the tabs above for instructions on using custom instructions in other environments.
48
33
49
-
## About repository custom instructions for {% data variables.product.prodname_copilot_short %}
50
-
51
-
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences. For a full introduction to custom instructions, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=visualstudio).
52
-
53
-
{% data reusables.copilot.repository-custom-instructions-support %}
54
-
***{% data variables.copilot.copilot_code-review_short %}**
55
-
56
34
{% endvisualstudio %}
57
35
58
36
{% jetbrains %}
@@ -61,12 +39,6 @@ Repository custom instructions let you provide {% data variables.product.prodnam
61
39
62
40
This version of this article is for using repository custom instructions in JetBrains IDEs. Click the tabs above for instructions on using custom instructions in other environments.
63
41
64
-
## About repository custom instructions for {% data variables.copilot.copilot_chat %}
65
-
66
-
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences. For a full introduction to custom instructions, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=jetbrains).
67
-
68
-
{% data reusables.copilot.repository-custom-instructions-support %}
69
-
70
42
{% endjetbrains %}
71
43
72
44
{% xcode %}
@@ -75,14 +47,14 @@ Repository custom instructions let you provide {% data variables.product.prodnam
75
47
76
48
This version of this article is for using repository custom instructions in Xcode. Click the tabs above for instructions on using custom instructions in other environments.
77
49
78
-
## About repository custom instructions for {% data variables.copilot.copilot_chat %}
50
+
{% endxcode %}
51
+
52
+
## About repository custom instructions for {% data variables.product.prodname_copilot_short %}
79
53
80
-
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences. For a full introduction to custom instructions, see [AUTOTITLE](/copilot/concepts/about-customizing-github-copilot-chat-responses?tool=xcode).
54
+
Repository custom instructions let you provide {% data variables.product.prodname_copilot_short %} with repository-specific guidance and preferences.
81
55
82
56
{% data reusables.copilot.repository-custom-instructions-support %}
83
57
84
-
{% endxcode %}
85
-
86
58
## Prerequisites for repository custom instructions
87
59
88
60
* You must have a custom instructions file (see the instructions below).
@@ -123,6 +95,8 @@ Repository custom instructions let you provide {% data variables.product.prodnam
123
95
124
96
{% jetbrains %}
125
97
98
+
JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
99
+
126
100
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.
127
101
128
102
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.
@@ -164,6 +138,8 @@ Once saved, these instructions will apply globally across all workspaces in JetB
164
138
165
139
{% xcode %}
166
140
141
+
Xcode supports a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
142
+
167
143
You can create a custom instructions file in your repository via the {% data variables.product.prodname_copilot_short %} settings page.
168
144
169
145
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.
@@ -176,6 +152,13 @@ Whitespace between instructions is ignored, so the instructions can be written a
176
152
177
153
{% vscode %}
178
154
155
+
{% data variables.product.prodname_vscode_shortname %} supports either:
156
+
157
+
* A single `.github/copilot-instructions.md` custom instructions file stored in the repository
158
+
* 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.
159
+
160
+
### Using a single `.github/copilot-instructions.md` file
161
+
179
162
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
180
163
181
164
Create the `.github` directory if it does not already exist.
@@ -184,10 +167,32 @@ Whitespace between instructions is ignored, so the instructions can be written a
184
167
185
168
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.
186
169
170
+
### Using one or more `.instructions.md` files
171
+
172
+
1. Create the `.github/instructions` directory if it does not already exist.
173
+
174
+
1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s).
175
+
176
+
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.
177
+
178
+
1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax.
179
+
180
+
```markdown
181
+
---
182
+
applyTo: "app/models/**/*.rb"
183
+
---
184
+
185
+
Add custom instructions here
186
+
```
187
+
188
+
To apply the instructions to all files, use the `**` pattern.
189
+
187
190
{% endvscode %}
188
191
189
192
{% visualstudio %}
190
193
194
+
{% data variables.product.prodname_vs %} supports a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
195
+
191
196
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
192
197
193
198
Create the `.github` directory if it does not already exist.
@@ -200,6 +205,12 @@ Whitespace between instructions is ignored, so the instructions can be written a
200
205
201
206
{% webui %}
202
207
208
+
**{% data variables.copilot.copilot_chat_short %}** on the {% data variables.product.github %} website and **{% data variables.copilot.copilot_code-review_short %}** support a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
209
+
210
+
In addition, **{% data variables.copilot.copilot_coding_agent %}** supports 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.
211
+
212
+
### Using a single `.github/copilot-instructions.md` file
213
+
203
214
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
204
215
205
216
Create the `.github` directory if it does not already exist.
@@ -208,7 +219,25 @@ Whitespace between instructions is ignored, so the instructions can be written a
208
219
209
220
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.
210
221
211
-
To see your instructions in action, go to [https://github.com/copilot](https://github.com/copilot), attach the repository containing the instructions file, and start a conversation.
222
+
### Using one or more `.instructions.md` files
223
+
224
+
1. Create the `.github/instructions` directory if it does not already exist.
225
+
226
+
1. Create one or more `.instructions.md` files, adding natural language instructions to the file(s).
227
+
228
+
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.
229
+
230
+
1. Specify what files or directories the instructions apply to by adding `applyTo` frontmatter to the Markdown files, using glob syntax.
231
+
232
+
```markdown
233
+
---
234
+
applyTo: "app/models/**/*.rb"
235
+
---
236
+
237
+
Add custom instructions here
238
+
```
239
+
240
+
To apply the instructions to all files, use the `**` pattern.
212
241
213
242
{% endwebui %}
214
243
@@ -222,16 +251,16 @@ Did you successfully add a custom instructions file to your repository?
The instructions you add to the `.github/copilot-instructions.md`file should be short, self-contained statements that provide {% data variables.product.prodname_copilot_short %} with relevant information to help it work in this repository. Because the instructions are sent with every chat message, they should be broadly applicable to most requests you will make in the context of the repository.
254
+
The instructions you add to your custom instruction file(s) should be short, self-contained statements that provide {% data variables.product.prodname_copilot_short %} with relevant information to help it work in this repository. Because the instructions are sent with every chat message, they should be broadly applicable to most requests you will make in the context of the repository.
226
255
227
-
The exact structure you utilize for your instructions file will vary by project and need, but the following guidelines provide a good starting point:
256
+
The exact structure you utilize for your instructions file(s) will vary by project and need, but the following guidelines provide a good starting point:
228
257
229
258
* Provide an overview of the project you're working on, including its purpose, goals, and any relevant background information.
230
259
* Include the folder structure of the repository, including any important directories or files that are relevant to the project.
231
260
* Specify the coding standards and conventions that should be followed, such as naming conventions, formatting rules, and best practices.
232
261
* Include any specific tools, libraries, or frameworks that are used in the project, along with any relevant version numbers or configurations.
233
262
234
-
The following instructions file is an example of these practices in action:
263
+
The following instructions file(s) is an example of these practices in action:
235
264
236
265
```markdown
237
266
# Project Overview
@@ -283,7 +312,7 @@ Answer all questions in less than 1000 characters, and words of no more than 12
283
312
284
313
## Repository custom instructions in use
285
314
286
-
The instructions in the `.github/copilot-instructions.md`file are available for use by {% data variables.copilot.copilot_chat_short %} as soon as you save the file. 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 %}.
315
+
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 %}.
Repository custom instructions are currently supported for:
2
-
***{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vs %}, {% data variables.product.prodname_vscode_shortname %}, JetBrains IDEs, Xcode, and on the {% data variables.product.github %} website
2
+
***{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vscode_shortname %}
3
+
***{% data variables.copilot.copilot_coding_agent %}**
4
+
***{% data variables.copilot.copilot_chat_short %}** in {% data variables.product.prodname_vs %}, JetBrains IDEs, Xcode, and on the {% data variables.product.github %} website (`copilot-instructions.md` file only)
5
+
***{% data variables.copilot.copilot_code-review_short %}** (`copilot-instructions.md` file only)
0 commit comments