|
1 | 1 | --- |
2 | 2 | title: 'Customize chat responses' |
3 | 3 | description: Use custom instructions and prompt files to customize responses and use slash commands to set quick context for common tasks. |
4 | | -ms.date: 7/31/2025 |
| 4 | +ms.date: 9/29/2025 |
5 | 5 | ms.update-cycle: 180-days |
6 | 6 | ms.topic: how-to |
7 | 7 | author: anandmeg |
@@ -47,10 +47,32 @@ The custom instructions feature enables you to automatically add pre-specified c |
47 | 47 |
|
48 | 48 | To configure custom instructions: |
49 | 49 | 1. [Create/add](https://docs.github.com/en/enterprise-cloud@latest/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot) a custom instructions file `.github/copilot-instructions.md` in the root of your repository. |
50 | | -1. Enable the feature in Visual Studio via **Tools** > **Options** > **GitHub** > **Copilot** > select **(Preview) Enable custom instructions to be loaded from .github/copilot-instructions.md files and added to requests.**. |
| 50 | +1. Enable the feature in Visual Studio via **Tools** > **Options** > **GitHub** > **Copilot** > **Copilot Chat** > **Enable custom instructions to be loaded from .github/copilot-instructions.md files and added to requests**. |
51 | 51 |
|
52 | 52 | Custom instructions are not visible in the Chat view or inline chat. However, when used by Copilot, the`.github/copilot-instructions.md` file is listed in the References list of a response. |
53 | 53 |
|
| 54 | +### Example |
| 55 | + |
| 56 | +Here's an example C# custom instruction: |
| 57 | + |
| 58 | +```markdown |
| 59 | +# Custom Instructions |
| 60 | + |
| 61 | +## C# Instructions |
| 62 | +Applies to: `**/*.cs` |
| 63 | + |
| 64 | +- Write clear and concise comments for each function. |
| 65 | +- Use PascalCase for component names, method names, and public members. |
| 66 | +- Use camelCase for private fields and local variables. |
| 67 | +- Add a newline before the opening curly brace of any code block |
| 68 | + (such as after `if`, `for`, `while`, `foreach`, `using`, `try`, etc.). |
| 69 | +- Ensure that the final `return` statement of a method is on its own line. |
| 70 | +``` |
| 71 | + |
| 72 | +Copy these instructions into your `.github/copilot-instructions.md` file to use and automatically apply to Copilot behavior. |
| 73 | + |
| 74 | +For more examples of custom instructions, see the list of [instruction samples on GitHub](https://github.com/github/awesome-copilot/blob/main/README.instructions.md). |
| 75 | + |
54 | 76 | ## Use prompt files |
55 | 77 |
|
56 | 78 | You can now create reusable prompt files in your repository to run or share your frequently used prompts. |
|
0 commit comments