Skip to content

Commit 0a52a4d

Browse files
authored
Merge pull request #8309 from microsoft/customize-copilot
Update intro and prompt files content
2 parents 357c25c + f4c2c15 commit 0a52a4d

File tree

1 file changed

+40
-33
lines changed

1 file changed

+40
-33
lines changed

docs/copilot/copilot-customization.md

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@ DateApproved: 04/03/2025
44
MetaDescription: Learn how to customize GitHub Copilot Chat with custom instructions and reusable prompt files to align AI responses with your coding practices and project requirements.
55
MetaSocialImage: images/shared/github-copilot-social.png
66
---
7-
# Customize chat with instructions and prompt files
7+
# Customize chat responses in VS Code
88

9-
Customize chat responses to align with your coding practices and project requirements. This article explains two powerful customization approaches: custom instructions that apply guidelines to all your chat interactions, and prompt files that let you create, store, and share reusable AI prompts for specific tasks like generating components, reviewing code, or creating documentation.
10-
11-
[*Custom instructions*](#custom-instructions) enable you to describe common guidelines or rules to get responses that match your specific coding practices and tech stack. Instead of manually including this context in every chat query, custom instructions automatically incorporate this information with every chat request. VS Code supports custom instructions for different scenarios, such as code generation, commit-message generation, code reviewing, and more.
12-
13-
[*Prompt files*](#reusable-prompt-files-experimental) allow you to craft complete prompts in Markdown files, which you can then reference in chat. Unlike custom instructions that supplement your existing prompts, prompt files are standalone prompts that you can store within your workspace and share with others. With prompt files, you can create reusable templates for common tasks, store domain expertise in your codebase, and standardize AI interactions across your team.
9+
Copilot can provide you with responses that match your coding practices and project requirements if you give it the right context. Custom instructions enable you to define and automatically apply the guidelines and rules for tasks like generating code, or performing code reviews. Prompt files let you craft complete chat prompts in Markdown files, which you can then reference in chat or share with others. In this article, you will learn how to use custom instructions and prompt files to customize your chat responses in Visual Studio Code.
1410

1511
## Custom instructions
1612

13+
Custom instructions enable you to describe common guidelines or rules to get responses that match your specific coding practices and tech stack. Instead of manually including this context in every chat query, custom instructions automatically incorporate this information with every chat request.
14+
1715
VS Code supports several types of custom instructions, targeted at different scenarios: code generation, test generation, code review, commit message generation, and pull request title and description generation instructions.
1816

1917
You can define custom instructions in two ways:
@@ -123,9 +121,17 @@ The following code snippet shows how to define a set of instructions in the `set
123121

124122
## Reusable prompt files (experimental)
125123

126-
Prompt files (_prompts_) let you build and share reusable prompt instructions with extra context. A prompt file is a Markdown file that mimics the existing format of writing prompts in Copilot Chat (for example, `Rewrite #file:x.ts`). This allows blending natural language instructions, additional context, and even linking to other prompt files as dependencies.
124+
Prompt files allow you to craft complete prompts in Markdown files, which you can then reference in chat. Unlike custom instructions that supplement your existing prompts, prompt files are standalone prompts that you can store within your workspace and share with others. With prompt files, you can create reusable templates for common tasks, store domain expertise in your codebase, and standardize AI interactions across your team.
127125

128-
While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction.
126+
A prompt file is a Markdown file that mimics the existing format of writing prompts in chat (for example, `Rewrite #file:x.ts`). This allows blending natural language instructions, additional context, and even linking to other prompt files as dependencies.
127+
128+
> [!TIP]
129+
> Reference additional context files like API specs or documentation by using Markdown links to provide Copilot with more complete information.
130+
131+
VS Code supports two types of prompts:
132+
133+
* **Workspace prompt files**: stored in a Markdown file within your workspace and only available in that workspace.
134+
* **User prompt files**: stored in a Markdown file in your profile folder and available for use across multiple workspaces.
129135

130136
Common use cases include:
131137

@@ -136,7 +142,7 @@ Common use cases include:
136142

137143
### Prompt file examples
138144

139-
* `react-form.prompt.md` - documents a reusable task for generating a form:
145+
* Document a reusable task for generating a form:
140146

141147
```markdown
142148
Your goal is to generate a new React form component.
@@ -155,7 +161,7 @@ Common use cases include:
155161
* Customize UX-friendly validation rules
156162
```
157163

158-
* `security-api.prompt.md` - documents reusable security practices for REST APIs, which can be used to do security reviews of REST APIs:
164+
* Document reusable security practices for REST APIs, which can be used to do security reviews of REST APIs:
159165

160166
```markdown
161167
Secure REST API review:
@@ -166,58 +172,60 @@ Common use cases include:
166172
167173
```
168174

169-
### Usage
175+
### Create a workspace prompt file
170176

171-
To enable prompt files, configure the `setting(chat.promptFiles)` VS Code setting. By default, prompt files are located in the `.github/prompts` directory of your workspace. You can also [specify additional folders](#prompt-files-experimental-settings) where prompt files are located.
177+
Workspace prompt files are stored in your workspace and are only available in that workspace. Workspace prompt files are stored in the `.github/prompts` directory of your workspace.
172178

173-
#### Create a prompt file
179+
To create a workspace prompt file:
174180

175181
1. Set the `setting(chat.promptFiles)` setting to `true` for the `.github/prompts` directory.
176182

177183
1. Create a `.prompt.md` file in the `.github/prompts` directory of your workspace.
178184

179-
Alternatively, use the **Create Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`).
185+
By default, prompt files are located in the `.github/prompts` directory of your workspace. You can specify additional prompt file locations with the `setting(chat.promptFilesLocations)` setting.
186+
187+
Alternatively, use the **Chat: Create Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`) to create a prompt.
180188

181-
1. Write prompt instructions by using Markdown formatting.
189+
1. Author the chat prompt by using Markdown formatting.
182190

183191
Within a prompt file, reference additional workspace files as Markdown links (`[index](../index.ts)`), or as `#file:../index.ts` references within the prompt file.
184192

185193
You can also reference other `.prompt.md` files to create a hierarchy of prompts, with reusable prompts that can be shared across multiple prompt files.
186194

187-
#### Create a user prompt file
195+
### Create a user prompt file
188196

189197
User prompt files are stored in your [user profile](/docs/configure/profiles.md). With user prompt files, you can share reusable prompts across multiple workspaces.
190198

191-
You can add a user prompt file to a chat prompt in the same way as a workspace prompt file.
192-
193199
To create a user prompt file:
194200

195-
1. Select the **Create User Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`).
201+
1. Select the **Chat: Create User Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`).
196202

197203
1. Enter a name for your prompt file.
198204

199-
1. Write prompt instructions by using Markdown formatting.
205+
1. Author the chat prompt by using Markdown formatting.
200206

201-
User prompt files can now be synced across multiple devices with [Settings Sync](/docs/configure/settings-sync.md). Make sure to enable support for prompt files in your Settings Sync configuration. Select **Settings Sync: Configure** from the Command Palette, and make sure **Prompts** is selected.
207+
You can also reference other `.prompt.md` user prompt files to create a hierarchy of prompts, with reusable prompts that can be shared across multiple prompt files.
202208

203-
#### Attach a prompt file to a chat request
209+
> [!TIP]
210+
> User prompt files can be synced across multiple devices with [Settings Sync](/docs/configure/settings-sync.md). Make sure to enable support for prompt files in your Settings Sync configuration. Select **Settings Sync: Configure** from the Command Palette, and make sure **Prompts** is selected.
204211

205-
1. Select the **Attach Context** <i class="codicon codicon-attach"></i> icon (`kb(workbench.action.chat.attachContext)`), and then select **Prompt...**.
212+
### Use a prompt file in chat
206213

207-
Alternatively, use the **Chat: Use Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`).
214+
To use a prompt file as a chat prompt, attach it to your chat request as context:
208215

209-
1. Choose a prompt file from the Quick Pick to attach it to your chat request.
216+
1. Open the Chat view in VS Code (`kb(workbench.action.chat.open)`).
210217

211-
You can use prompt files in both Copilot Chat and Copilot Edits.
218+
1. Select **Attach Context** in the chat input field, and then select **Prompt...**.
212219

213-
1. Optionally, attach additional context files required for the task.
220+
Alternatively, use the **Chat: Use Prompt** command from the Command Palette (`kb(workbench.action.showCommands)`).
214221

215-
For reusable tasks, send the prompt without any additional instructions.
222+
1. Choose a prompt file from the Quick Pick to attach it to your chat request.
216223

217-
To further refine a reusable prompt, include additional instructions to provide more context for the task at hand.
224+
You can use prompt files in any of the chat modes (ask, edit, or agent mode).
218225

219-
> [!TIP]
220-
> Reference additional context files like API specs or documentation by using Markdown links to provide Copilot with more complete information.
226+
1. Optionally, attach additional context files required for the task or include more instructions in the chat prompt.
227+
228+
To use the prompt file as-is, send the chat prompt without any additional instructions.
221229

222230
## Settings
223231

@@ -242,5 +250,4 @@ User prompt files can now be synced across multiple devices with [Settings Sync]
242250

243251
## Related content
244252

245-
* Start AI chat conversations with [Copilot Chat](/docs/copilot/chat/copilot-chat.md).
246-
* Start an AI-powered editing session with [Copilot Edits](/docs/copilot/chat/copilot-edits.md).
253+
* [Get started with chat in VS Code](/docs/copilot/chat/copilot-chat.md)

0 commit comments

Comments
 (0)