Skip to content

Commit 140a3f7

Browse files
authored
Add Copilot CLI support and improve custom instructions article (#57672)
1 parent 431e315 commit 140a3f7

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

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

Lines changed: 51 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ This version of this article is for using repository custom instructions in Xcod
6565

6666
{% endxcode %}
6767

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+
6876
{% eclipse %}
6977

7078
> [!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
197205

198206
{% endeclipse %}
199207

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+
200244
{% vscode %}
201245

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

204248
* **Repository-wide custom instructions**, which apply to all requests made in the context of a repository.
205249

@@ -211,6 +255,10 @@ Once saved, these instructions will apply to the current project in Eclipse that
211255

212256
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.
213257

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+
214262
## Creating repository-wide custom instructions
215263

216264
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
243291

244292
{% webui %}
245293

246-
You can create several types of repository custom instructions for 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.
247295

248296
* **Repository-wide custom instructions** apply to all requests made in the context of a repository.
249297

250-
Supported by: **{% data variables.copilot.copilot_chat_short %}**, **{% data variables.copilot.copilot_coding_agent %}**, and **{% data variables.copilot.copilot_code-review_short %}**.
251-
252298
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).
253299

254300
* **Path-specific custom instructions** apply to requests made in the context of files that match a specified path.
255301

256-
Supported by: **{% data variables.copilot.copilot_coding_agent %}** and **{% data variables.copilot.copilot_code-review_short %}**.
257-
258302
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).
259303

260304
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.
261305

262306
* **Agent instructions** are used by AI agents.
263307

264-
Supported by: **{% data variables.copilot.copilot_coding_agent %}** and {% data variables.copilot.copilot_cli_short %}.
265-
266308
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).
267309

268310
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
453495

454496
## Repository custom instructions in use
455497

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

458500
{% webui %}
459501

data/reusables/copilot/repository-custom-instructions-support.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The following table shows which {% data variables.product.prodname_copilot_short
1010

1111
| | Eclipse | JetBrains IDEs | {% data variables.product.prodname_vs %} | {% data variables.product.prodname_vscode_shortname %} | {% data variables.product.prodname_dotcom_the_website %} | Xcode |
1212
| --- | --- | --- | --- | --- | --- | --- |
13-
| {% data variables.copilot.copilot_chat_short %} | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> |
13+
| {% data variables.copilot.copilot_chat_short %} | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>3</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>1</sup> |
1414
| {% data variables.copilot.copilot_coding_agent %} | N/A | N/A | N/A | {% octicon "check" aria-label="Included" %} <sup>3</sup> | {% octicon "check" aria-label="Included" %} <sup>3</sup> | N/A |
1515
| {% data variables.copilot.copilot_code-review_short %} | N/A | {% octicon "x" aria-label="Not included" %} | {% octicon "check" aria-label="Included" %} <sup>1</sup> | {% octicon "check" aria-label="Included" %} <sup>2</sup> | {% octicon "check" aria-label="Included" %} <sup>2</sup> | {% octicon "x" aria-label="Not included" %} |
1616

src/tools/lib/all-tools.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const allTools: ToolsMapping = {
1515
bash: 'Bash',
1616
cli: 'GitHub CLI',
1717
codespaces: 'Codespaces',
18+
copilotcli: 'Copilot CLI',
1819
curl: 'curl',
1920
desktop: 'Desktop',
2021
eclipse: 'Eclipse',

0 commit comments

Comments
 (0)