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/customizing-copilot/adding-custom-instructions-for-github-copilot.md
+86-12Lines changed: 86 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,57 @@ topics:
8
8
- Copilot
9
9
---
10
10
11
-
> [!NOTE]
12
-
> * This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change.
13
-
> * Custom instructions are currently only supported for {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vscode_shortname %} and {% data variables.product.prodname_vs %}.
14
11
15
-
## About custom instructions for {% data variables.product.prodname_copilot %}
12
+
{% webui %}
13
+
14
+
{% data reusables.copilot.custom-instructions-note %}
15
+
>
16
+
> This version of this article is for using 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 -->
17
+
18
+
{% endwebui %}
19
+
20
+
{% vscode %}
21
+
22
+
{% data reusables.copilot.custom-instructions-note %}
23
+
>
24
+
> This version of this article is for using custom instructions in {% data variables.product.prodname_vscode_shortname %}. Click the tabs above for instructions on using custom instructions in other environments. <!-- markdownlint-disable-line MD027 -->
25
+
26
+
{% endvscode %}
27
+
28
+
{% visualstudio %}
29
+
30
+
{% data reusables.copilot.custom-instructions-note %}
31
+
>
32
+
> This version of this article is for using custom instructions in {% data variables.product.prodname_vs %}. Click the tabs above for instructions on using custom instructions in other environments. <!-- markdownlint-disable-line MD027 -->
33
+
34
+
{% endvisualstudio %}
35
+
36
+
## About custom instructions for {% data variables.product.prodname_copilot_chat %}
16
37
17
38
{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to the way your team works, the tools you use, or the specifics of your project, if you provide it with enough context to do so. Instead of repeatedly adding this contextual detail to your chat questions, you can create a file that automatically adds this information for you. The additional information is not displayed in the chat, but is available to {% data variables.product.prodname_copilot_short %} to allow it to generate higher quality responses.
18
39
19
40
## Prerequisites
20
41
21
42
* A custom instructions file (see the instructions below).
22
-
* The **Use Instruction Files** ({% data variables.product.prodname_vscode_shortname %}) or **Enable custom instructions** ({% data variables.product.prodname_vs %}) option enabled in your settings. See [Enabling or disabling custom instructions](#enabling-or-disabling-custom-instructions) later in this article.
23
43
24
-
> [!NOTE] The setting is enabled by default in {% data variables.product.prodname_vscode_shortname %} and disabled by default in {% data variables.product.prodname_vs %}.
44
+
{% webui %}
45
+
46
+
* Your personal choice of whether to use custom instructions must be set to enabled. This is enabled by default. See [Enabling or disabling custom instructions](#enabling-or-disabling-custom-instructions) later in this article.
47
+
* During the {% data variables.release-phases.public_preview %}, if you have a {% data variables.product.prodname_copilot_business_short %} {% ifversion ghec %}or {% data variables.product.prodname_copilot_enterprise_short %}{% endif %} subscription, then the organization {% ifversion ghec %}or enterprise{% endif %} from which you receive your subscription must have the **Opt in to preview features** setting enabled. See [AUTOTITLE](/enterprise-cloud@latest/copilot/managing-copilot/managing-github-copilot-in-your-organization/managing-policies-for-copilot-in-your-organization#enabling-copilot-features-in-your-organization){% ifversion ghec %} and [AUTOTITLE](/enterprise-cloud@latest/copilot/managing-copilot/managing-copilot-for-your-enterprise/managing-policies-and-features-for-copilot-in-your-enterprise#copilot-in-githubcom){% endif %}.
48
+
49
+
{% endwebui %}
50
+
51
+
{% vscode %}
52
+
53
+
* The **Use Instruction Files** option must be enabled in your settings. This is enabled by default. See [Enabling or disabling custom instructions](#enabling-or-disabling-custom-instructions) later in this article.
54
+
55
+
{% endvscode %}
56
+
57
+
{% visualstudio %}
58
+
59
+
* The **Enable custom instructions** option must be enabled in your settings. This is disabled by default. See [Enabling or disabling custom instructions](#enabling-or-disabling-custom-instructions) later in this article.
60
+
61
+
{% endvisualstudio %}
25
62
26
63
## Creating a custom instructions file
27
64
@@ -69,27 +106,64 @@ Answer all questions in less than 1000 characters, and words of no more than 12
69
106
70
107
## Custom instructions in use
71
108
72
-
The instructions in the `.github/copilot-instructions.md` file are available for use by {% data variables.product.prodname_copilot_chat_short %} as soon as you save the file. The complete set of instructions will be automatically attached to requests that you submit in either the {% data variables.product.prodname_copilot_chat_short %} view, or in inline chat, in {% data variables.product.prodname_vscode_shortname %} and {% data variables.product.prodname_vs %}.
109
+
{% webui %}
110
+
111
+
The instructions in the `.github/copilot-instructions.md` file are available for use by {% data variables.product.prodname_copilot_chat_short %} as soon as you save the file. The complete set of instructions will be automatically added to chat prompts that relate to the repository containing the instructions file.
73
112
74
-
Custom instructions are not visible in the Chat view or inline chat, but you can verify that they are being used by {% data variables.product.prodname_copilot_short %} by looking at the References list of a response. If custom instructions were added to the prompt that was sent to the model, the `.github/copilot-instructions.md` file is listed as a reference. You can click the reference to open the file.
113
+
In immersive mode (the [https://github.com/copilot](https://github.com/copilot) page), you can start a conversation that uses custom instructions by adding, as an attachment, the repository that contains the instructions file.
75
114
76
-

115
+
Custom instructions are not visible in {% data variables.product.prodname_copilot_chat_short %}, but you can verify that they are being used by {% data variables.product.prodname_copilot_short %} by expanding the list of references at the top of a chat response in the Chat panel. If custom instructions were added to the prompt that was sent to the model, the `.github/copilot-instructions.md` file is listed as a reference.
116
+
117
+

118
+
119
+
You can click the reference to open the file.
120
+
121
+
{% endwebui %}
122
+
123
+
{% vscode %}
124
+
125
+
{% data reusables.copilot.custom-instructions-reference %}
126
+
127
+

128
+
129
+
{% endvscode %}
130
+
131
+
{% visualstudio %}
132
+
133
+
{% data reusables.copilot.custom-instructions-reference %}
134
+
135
+

136
+
137
+
{% endvisualstudio %}
77
138
78
139
## Enabling or disabling custom instructions
79
140
80
-
You can choose whether or not to have custom instructions added to your chat questions. To do this, select or clear the option in the settings for the {% data variables.product.prodname_copilot_short %} extension.
141
+
You can choose whether or not to have custom instructions added to your chat questions.
142
+
143
+
{% webui %}
144
+
145
+
1. Click the {% octicon "kebab-horizontal" aria-label="Conversation options" %} button at the top of the Chat panel, or the top right of the immersive page.
146
+
1. Click **Disable custom instructions** or **Enable custom instructions**.
81
147
82
-
### In {% data variables.product.prodname_vscode_shortname %}
148
+
Your choice persists until you change it.
149
+
150
+
{% endwebui %}
151
+
152
+
{% vscode %}
83
153
84
154
1. Open the Setting editor by using the keyboard shortcut <kbd>Command</kbd>+<kbd>,</kbd> (Mac) / <kbd>Ctrl</kbd>+<kbd>,</kbd> (Linux/Windows).
85
155
1. Type `instruction file` in the search box.
86
156
1. Select or clear the checkbox under **Code Generation: Use Instruction Files**.
87
157
88
-
### In {% data variables.product.prodname_vs %}
158
+
{% endvscode %}
159
+
160
+
{% visualstudio %}
89
161
90
162
1. In the {% data variables.product.prodname_vs %} menu bar, under **Tools**, click **Options**.
91
163
92
164

93
165
94
166
1. In the "Options" dialog, type `custom instructions` in the search box.
95
167
1. Select or clear the checkbox for **(Preview) Enable custom instructions to be loaded from .github/copilot-instructions.md files and added to requests**.
> * This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change.
3
+
> * Custom instructions are currently supported for {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vs %}, {% data variables.product.prodname_vscode_shortname %} and on the {% data variables.product.github %} website.
The instructions in the `.github/copilot-instructions.md` file are available for use by {% data variables.product.prodname_copilot_chat_short %} as soon as you save the file. The complete set of instructions will be automatically attached to requests that you submit in either the {% data variables.product.prodname_copilot_chat_short %} view, or in inline chat.
2
+
3
+
Custom instructions are not visible in the Chat view or inline chat, but you can verify that they are being used by {% data variables.product.prodname_copilot_short %} by looking at the References list of a response in the Chat view. If custom instructions were added to the prompt that was sent to the model, the `.github/copilot-instructions.md` file is listed as a reference. You can click the reference to open the file.
0 commit comments