Skip to content

Commit 39a2400

Browse files
timrogersCopilothubwriter
authored
[2025-07-23] GitHub Copilot coding agent supports custom instructions with .instructions.md files (#56762)
Co-authored-by: Copilot <[email protected]> Co-authored-by: hubwriter <[email protected]>
1 parent af6dbd1 commit 39a2400

File tree

3 files changed

+72
-40
lines changed

3 files changed

+72
-40
lines changed

content/copilot/how-tos/agents/copilot-coding-agent/best-practices-for-using-copilot-to-work-on-tasks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ By adding custom instructions to your repository, you can guide {% data variable
7070

7171
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.
7272

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).
7474

7575
Here is an example of an effective `copilot-instructions.md` file:
7676

@@ -107,7 +107,7 @@ This is a Go based repository with a Ruby client for certain API endpoints. It i
107107
5. Document public APIs and complex logic. Suggest changes to the `docs/` folder when appropriate
108108
```
109109

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`.
111111

112112
## Using the Model Context Protocol (MCP)
113113

content/copilot/how-tos/custom-instructions/adding-repository-custom-instructions-for-github-copilot.md

Lines changed: 66 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,12 @@ topics:
1717
1818
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 -->
1919

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-
2820
{% endwebui %}
2921

3022
{% vscode %}
3123

3224
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.
3325

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-
4126
{% endvscode %}
4227

4328
{% visualstudio %}
@@ -46,13 +31,6 @@ You can provide {% data variables.product.prodname_copilot_short %} with reposit
4631
4732
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.
4833

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-
5634
{% endvisualstudio %}
5735

5836
{% jetbrains %}
@@ -61,12 +39,6 @@ Repository custom instructions let you provide {% data variables.product.prodnam
6139
6240
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.
6341

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-
7042
{% endjetbrains %}
7143

7244
{% xcode %}
@@ -75,14 +47,14 @@ Repository custom instructions let you provide {% data variables.product.prodnam
7547
7648
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.
7749

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 %}
7953

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.
8155

8256
{% data reusables.copilot.repository-custom-instructions-support %}
8357

84-
{% endxcode %}
85-
8658
## Prerequisites for repository custom instructions
8759

8860
* 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
12395

12496
{% jetbrains %}
12597

98+
JetBrains IDEs support a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
99+
126100
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.
127101

128102
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
164138

165139
{% xcode %}
166140

141+
Xcode supports a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
142+
167143
You can create a custom instructions file in your repository via the {% data variables.product.prodname_copilot_short %} settings page.
168144

169145
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
176152

177153
{% vscode %}
178154

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+
179162
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
180163

181164
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
184167

185168
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.
186169

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+
187190
{% endvscode %}
188191

189192
{% visualstudio %}
190193

194+
{% data variables.product.prodname_vs %} supports a single `.github/copilot-instructions.md` custom instructions file stored in the repository.
195+
191196
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
192197

193198
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
200205

201206
{% webui %}
202207

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+
203214
1. In the root of your repository, create a file named `.github/copilot-instructions.md`.
204215

205216
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
208219

209220
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.
210221

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.
212241

213242
{% endwebui %}
214243

@@ -222,16 +251,16 @@ Did you successfully add a custom instructions file to your repository?
222251

223252
## Writing effective repository custom instructions
224253

225-
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.
226255

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:
228257

229258
* Provide an overview of the project you're working on, including its purpose, goals, and any relevant background information.
230259
* Include the folder structure of the repository, including any important directories or files that are relevant to the project.
231260
* Specify the coding standards and conventions that should be followed, such as naming conventions, formatting rules, and best practices.
232261
* Include any specific tools, libraries, or frameworks that are used in the project, along with any relevant version numbers or configurations.
233262

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:
235264

236265
```markdown
237266
# Project Overview
@@ -283,7 +312,7 @@ Answer all questions in less than 1000 characters, and words of no more than 12
283312

284313
## Repository custom instructions in use
285314

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 %}.
287316

288317
{% webui %}
289318

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
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

Comments
 (0)