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: docs/copilot/copilot-customization.md
+39-27Lines changed: 39 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -148,73 +148,85 @@ Common use cases include:
148
148
149
149
-`react-form.prompt.md` - documents a reusable task for generating a form:
150
150
151
-
```markdown
152
-
Your goal is to generate a new React form component.
151
+
```markdown
152
+
Your goal is to generate a new React form component.
153
153
154
-
Ask for the form name and fields if not provided.
154
+
Ask for the form name and fields if not provided.
155
155
156
-
Requirements for the form:
157
-
- Use form design system components: [design-system/Form.md](../docs/design-system/Form.md)
158
-
- Use `react-hook-form` for form state management:
156
+
Requirements for the form:
157
+
- Use form design system components: [design-system/Form.md](../docs/design-system/Form.md)
158
+
- Use `react-hook-form` for form state management:
159
159
- Always define TypeScript types for your form data
160
160
- Prefer *uncontrolled* components using register
161
161
- Use `defaultValues` to prevent unnecessary rerenders
162
-
- Use `yup` for validation:
162
+
- Use `yup` for validation:
163
163
- Create reusable validation schemas in separate files
164
164
- Use TypeScript types to ensure type safety
165
165
- Customize UX-friendly validation rules
166
-
```
166
+
```
167
167
168
168
- `security-api.prompt.md` - documents reusable security practices for REST APIs, which can be used to do security reviews of REST APIs:
169
169
170
-
```markdown
171
-
Secure REST API review:
172
-
- Ensure all endpoints are protected by authentication and authorization
173
-
- Validate all user inputs and sanitize data
174
-
- Implement rate limiting and throttling
175
-
- Implement logging and monitoring for security events
176
-
…
177
-
```
170
+
```markdown
171
+
Secure REST API review:
172
+
- Ensure all endpoints are protected by authentication and authorization
173
+
- Validate all user inputs and sanitize data
174
+
- Implement rate limiting and throttling
175
+
- Implement logging and monitoring for security events
176
+
…
177
+
```
178
178
179
179
### Usage
180
180
181
-
To enable prompt files, configure the `setting(chat.promptFiles)` VS Code 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 paths provided.
181
+
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.
182
182
183
-
To use prompt files, follow these steps:
183
+
#### Create a prompt file
184
184
185
185
1. Create a `.prompt.md` file in the `.github/prompts` directory of your workspace.
186
186
187
-
2. Write prompt instructions by using Markdown formatting.
187
+
1. Write prompt instructions by using Markdown formatting.
188
188
189
-
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.
189
+
Within a prompt file, reference additional workspace files as Markdown links (`[index](../index.ts)`), or as `#file:../index.ts` references within the prompt file.
190
190
191
-
1. Select the Attach <iclass="codicon codicon-attach"></i> icon, then select **Prompt...** and choose the prompt file to attach it in Copilot Chat or Edits.
191
+
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.
192
+
193
+
#### Attach a prompt file to a chat request
194
+
195
+
1. Select the **Attach Context** <i class="codicon codicon-attach"></i> icon (`kb(workbench.action.chat.attachContext)`), and then select **Prompt...**.
196
+
197
+
1. Choose a prompt file from the Quick Pick to attach it to your chat request.
198
+
199
+
You can use prompt files in both Copilot Chat and Copilot Edits.
192
200
193
201
1. Optionally, attach additional context files required for the task.
194
202
195
-
1. Send the chat prompt
203
+
For reusable tasks, send the prompt without any additional instructions.
196
204
197
-
- For reusable tasks, send the prompt without any additional instructions.
198
-
199
-
- Include additional instructions to provide more context for the task at hand.
205
+
To further refine a reusable prompt, include additional instructions to provide more context for the task at hand.
200
206
201
207
> [!TIP]
202
208
> Reference additional context files like API specs or documentation by using Markdown links to provide Copilot with more complete information.
203
209
204
210
## Settings
205
211
206
-
### Custom instructions
212
+
### Custom instructions settings
207
213
208
214
* `setting(github.copilot.chat.codeGeneration.instructions)` _(Experimental)_: A set of instructions that will be added to Copilot requests that generate code.
209
215
* `setting(github.copilot.chat.codeGeneration.useInstructionFiles)` _(Preview)_: Controls whether code instructions from `.github/copilot-instructions.md` are added to Copilot requests.
210
216
* `setting(github.copilot.chat.testGeneration.instructions)` _(Experimental)_: A set of instructions that will be added to Copilot requests that generate tests.
211
217
* `setting(github.copilot.chat.reviewSelection.instructions)` _(Preview)_: A set of instructions that will be added to Copilot requests for reviewing the current editor selection.
212
218
* `setting(github.copilot.chat.commitMessageGeneration.instructions)` _(Experimental)_: A set of instructions that will be added to Copilot requests that generate commit messages.
213
219
214
-
### Prompt files (experimental)
220
+
### Prompt files (experimental) settings
215
221
216
222
* `setting(chat.promptFiles)` _(Experimental)_: enable prompt files and specify prompt file folder(s). Set to `true` to use the default location (`.github/prompts`), 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.
217
223
224
+
| Setting value | Description |
225
+
|---------------|-------------|
226
+
| `false` (default) | Disable prompt files. |
227
+
| `true` | Enable prompt files. Use the default prompt file location (`.github/prompts`). |
228
+
| `{ "/path/to/folder": boolean }` | Enable prompt files. Specify one or more folders where prompt files are located. Relative paths are resolved from the root folder(s) of your workspace. |
229
+
218
230
## Related content
219
231
220
232
* Start AI chat conversations with [Copilot Chat](/docs/copilot/copilot-chat.md).
0 commit comments