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-repository-custom-instructions-for-github-copilot.md
+28-14
Original file line number
Diff line number
Diff line change
@@ -197,7 +197,7 @@ Your choice persists until you change it.
197
197
198
198
> [!NOTE] Prompt files are {% data variables.release-phases.public_preview %} and subject to change.
199
199
200
-
Prompt files let you build and share reusable prompt instructions with additional context. A prompt file is a Markdown file that mimics the existing format of writing prompts in {% data variables.product.prodname_copilot_chat_short %} (for example, `Rewrite #file:x.ts`). This allows blending natural language instructions, additional context, and even linking to other prompt files as dependencies.
200
+
Prompt files let you build and share reusable prompt instructions with additional context. A prompt file is a Markdown file, stored in your workspace, that mimics the existing format of writing prompts in {% data variables.product.prodname_copilot_chat_short %} (for example, `Rewrite #file:x.ts`). This allows blending natural language instructions, additional context, and even linking to other prompt files as dependencies.
201
201
202
202
While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction.
203
203
@@ -208,11 +208,13 @@ Common use cases include:
208
208
***Team collaboration**. Document patterns and guidelines with references to specs and documentation.
209
209
***Onboarding**. Create step-by-step guides for complex processes or project-specific patterns.
210
210
211
+
You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose.
212
+
211
213
### Prompt file examples
212
214
213
215
The following examples demonstrate how to use prompt files.
214
216
215
-
*`react-form.prompt.md` - documents a reusable task for generating a form.
217
+
*`New React form.prompt.md` - contains instructions for a reusable task to generate a form using React.
216
218
217
219
```markdown
218
220
Your goal is to generate a new React form component.
@@ -231,7 +233,7 @@ The following examples demonstrate how to use prompt files.
231
233
- Customize UX-friendly validation rules
232
234
```
233
235
234
-
*`security-api.prompt.md` - documents reusable security practices for REST APIs, which can be used to do security reviews of REST APIs.
236
+
*`API security review.prompt.md` - contains reusable information about security practices for REST APIs, which can be used to do security reviews of REST APIs.
235
237
236
238
```markdown
237
239
Secure REST API review:
@@ -242,22 +244,34 @@ The following examples demonstrate how to use prompt files.
242
244
…
243
245
```
244
246
245
-
### Using prompt files
247
+
### Enabling prompt files
248
+
249
+
To enable prompt files, configure the workspace settings.
250
+
251
+
1. Open the command palette by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) / <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac).
252
+
1. Type "Open Workspace Settings (JSON)" and select the option that's displayed.
253
+
1. In the `settings.json` file, add `"chat.promptFiles": true` to enable the `.github/prompts` folder as the location for prompt files. This folder will be created if it does not already exist.
246
254
247
-
To enable prompt files, configure the `chat.promptFiles` {% data variables.product.prodname_vscode_shortname %} setting. Set it to `true` or use the `{ "/path/to/folder": boolean }` notation to specify a different path. Relative paths are resolved from the root folder(s) of your workspace, and the default value of `.github/prompts` is used if no other path is provided. For more detailed instructions, see [{% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vscode_shortname %} settings reference](https://code.visualstudio.com/docs/copilot/copilot-settings) in the {% data variables.product.prodname_vscode %} documentation.
255
+
### Creating prompt files
248
256
249
-
1. Create a `.prompt.md` file in the `.github/prompts` directory of your workspace.
250
-
1. Write prompt instructions by using Markdown formatting.
257
+
1. Open the command palette by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Windows/Linux) / <kbd>Command</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd> (Mac).
258
+
1. Type "prompt" and select **Chat: Create Prompt**.
259
+
1. Enter a name for the prompt file, excluding the `.prompt.md` file name extension. The name can contain alphanumeric characters and spaces and should describe the purpose of the prompt information the file will contain.
260
+
1. Write the prompt instructions, using Markdown formatting.
261
+
262
+
You can reference other files in the workspace by using Markdown links—for example, `[index](../../web/index.ts)`—or by using the `#file:../../web/index.ts` syntax. Paths are relative to the prompt file. Referencing other files allows you to provide additional context, such as API specifications or product documentation.
263
+
264
+
### Using prompt files
251
265
252
-
Reference additional workspace files as Markdown links (`[index](../index.ts)`), or as `#file:../index.ts` references within the prompt file. You can also reference other `.prompt.md` files.
266
+
1. At the bottom of the {% data variables.product.prodname_copilot_chat_short %} view, click the **Attach context** icon ({% octicon "paperclip" aria-hidden="true" %}).
267
+
1. In the dropdown menu, click **Prompt...** and choose the prompt file you want to use.
268
+
1. Optionally, attach additional files, including prompt files, to provide more context.
269
+
1. Optionally, type additional information in the chat prompt box.
253
270
254
-
1. Select the attach icon, then select **Prompt...** and choose the prompt file to attach it in {% data variables.product.prodname_copilot_chat_short %} or {% data variables.product.prodname_copilot_edits_vscode_short %}.
255
-
1. Optionally, attach additional context files required for the task.
256
-
1. Send the chat prompt.
271
+
Whether you need to do this or not depends on the contents of the prompt you are using.
257
272
258
-
* For reusable tasks, send the prompt without any additional instructions.
259
-
* Include additional instructions to provide more context for the task at hand.
273
+
1. Submit the chat prompt.
260
274
261
-
> [!TIP] Reference additional context files like API specs or documentation by using Markdown links to provide {% data variables.product.prodname_copilot_short %} with more complete information.
275
+
For more information about prompt files, see [Custom instructions for GitHub Copilot in VS Code](https://code.visualstudio.com/docs/copilot/copilot-customization#_reusable-prompt-files-experimental) in the {% data variables.product.prodname_vscode %} documentation.
Copy file name to clipboardexpand all lines: content/copilot/using-github-copilot/copilot-chat/asking-github-copilot-questions-in-your-ide.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -172,8 +172,11 @@ To leave feedback about the {% data variables.product.prodname_copilot_chat %} e
172
172
173
173
***Access to {% data variables.product.prodname_copilot %}**. See [AUTOTITLE](/copilot/about-github-copilot/what-is-github-copilot#getting-access-to-copilot).
174
174
***{% data variables.product.prodname_vs %} 2022 version 17.8 or later**. See [Install {% data variables.product.prodname_vs %}](https://learn.microsoft.com/visualstudio/install/install-visual-studio) in the {% data variables.product.prodname_vs %} documentation.
175
-
***{% data variables.product.prodname_copilot %} extension**. See [Install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}](https://learn.microsoft.com/visualstudio/ide/visual-studio-github-copilot-install-and-states) in the {% data variables.product.prodname_vs %} documentation.
176
-
***{% data variables.product.prodname_copilot_chat %} extension**. See [Install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}](https://learn.microsoft.com/visualstudio/ide/visual-studio-github-copilot-install-and-states) in the {% data variables.product.prodname_vs %} documentation.
175
+
*_For {% data variables.product.prodname_vs %} 17.8 and 17.9:_
176
+
***{% data variables.product.prodname_copilot %} extension**. See [Install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}](https://learn.microsoft.com/visualstudio/ide/visual-studio-github-copilot-install-and-states) in the {% data variables.product.prodname_vs %} documentation.
177
+
***{% data variables.product.prodname_copilot_chat %} extension**. See [Install {% data variables.product.prodname_copilot %} in {% data variables.product.prodname_vs %}](https://learn.microsoft.com/visualstudio/ide/visual-studio-github-copilot-install-and-states) in the {% data variables.product.prodname_vs %} documentation.
178
+
179
+
_{% data variables.product.prodname_vs %} 17.10 and later have the {% data variables.product.prodname_copilot %} and {% data variables.product.prodname_copilot_chat %} extensions built in. You don't need to install them separately._
177
180
***Sign in to {% data variables.product.company_short %} in {% data variables.product.prodname_vs %}**. If you experience authentication issues, see [AUTOTITLE](/copilot/troubleshooting-github-copilot/troubleshooting-issues-with-github-copilot-chat#troubleshooting-authentication-issues-in-your-editor).
0 commit comments