Skip to content

Commit 4a9a139

Browse files
saritaiheiskr
andauthored
[2025-04-09] Organization custom instructions doc + new conceptual article on customizing Chat responses (#55149)
Co-authored-by: Kevin Heis <[email protected]>
1 parent a5d8ecc commit 4a9a139

13 files changed

+340
-92
lines changed

content/copilot/about-github-copilot/github-copilot-features.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Bringing the power of industry leading large and small language models to users
5858

5959
For more information about {% data variables.product.prodname_copilot_edits_short %} in {% data variables.product.prodname_vscode %}, see [{% data variables.product.prodname_copilot_edits_short %}](https://code.visualstudio.com/docs/copilot/copilot-edits) in the {% data variables.product.prodname_vscode %} documentation.
6060

61+
### {% data variables.product.prodname_copilot_short %} custom instructions
62+
63+
Enhance {% data variables.product.prodname_copilot_chat_short %} responses by providing contextual details on your preferences, tools, and requirements. For more information, see [AUTOTITLE](/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses).
64+
6165
### {% data variables.product.prodname_copilot_short %} knowledge bases _({% data variables.product.prodname_copilot_enterprise_short %} only)_
6266

6367
Create and manage collections of documentation to use as context for chatting with {% data variables.product.prodname_copilot_short %}. When you ask a question in {% data variables.product.prodname_copilot_chat_dotcom_short %} or in {% data variables.product.prodname_vscode_shortname %}, you can specify a knowledge base as the context for your question. For more information, see [AUTOTITLE](/copilot/customizing-copilot/managing-copilot-knowledge-bases).
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
---
2+
title: About customizing GitHub Copilot Chat responses
3+
shortTitle: About customizing Copilot responses
4+
intro: 'Learn about customizing {% data variables.product.prodname_copilot_chat %} responses to fit with your preferences and requirements.'
5+
versions:
6+
feature: copilot
7+
topics:
8+
- Copilot
9+
---
10+
11+
{% webui %}
12+
13+
> [!NOTE] This version of this article is about custom instructions on the {% data variables.product.github %} website. Click the tabs above for other environments. <!-- markdownlint-disable-line MD027 -->
14+
15+
{% endwebui %}
16+
17+
{% vscode %}
18+
19+
> [!NOTE] This version of this article is about custom instructions and prompt files in {% data variables.product.prodname_vscode_shortname %}. Click the tabs above for other environments. <!-- markdownlint-disable-line MD027 -->
20+
21+
{% endvscode %}
22+
23+
{% visualstudio %}
24+
25+
> [!NOTE] This version of this article is about custom instructions in {% data variables.product.prodname_vs %}. Click the tabs above for other environments. <!-- markdownlint-disable-line MD027 -->
26+
27+
{% endvisualstudio %}
28+
29+
## About customizing {% data variables.product.prodname_copilot_chat %} responses
30+
31+
{% webui %}
32+
33+
{% data variables.product.prodname_copilot %} can provide chat responses that are tailored to your personal preferences, 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 custom instructions that automatically add 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.
34+
35+
### Types of custom instructions
36+
37+
* **Personal custom instructions** apply to all conversations you have with {% data variables.product.prodname_copilot_chat_short %} across the {% data variables.product.github %} website. They allow you to specify your individual preferences, such as preferred language or response style, ensuring that the responses are tailored to your personal needs.
38+
* **Repository custom instructions** apply to conversations within the context of a specific repository. They are useful for defining project-specific coding standards, frameworks, or tools. For example, you can specify that a repository uses TypeScript and a particular library, ensuring consistent responses for all contributors.
39+
* **Organization custom instructions (public preview)** apply to conversations within the context of an organization on the {% data variables.product.github %} website. They are ideal for enforcing organization-wide preferences, such as a common language or security guidelines. Organization custom instructions can only be set by organization owners for organizations with a {% data variables.product.prodname_copilot_enterprise_short %} subscription.
40+
41+
{% endwebui %}
42+
43+
{% vscode %}
44+
45+
{% 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 files in your repository that automatically add this information for you.
46+
47+
There are two types of files you can use to provide context and instructions to {% data variables.product.prodname_copilot_chat %} in {% data variables.product.prodname_vscode_shortname %}:
48+
49+
* **Repository custom instructions** allow you to specify repository-wide instructions and preferences, in a single file, that apply to any conversation held in the context of the repository.
50+
* **Prompt files** (public preview) allow you to save common prompt instructions and relevant context in Markdown files (`*.prompt.md`) that you can then reuse in your chat prompts. Prompt files are only available in {% data variables.product.prodname_vscode_shortname %}.
51+
52+
While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction.
53+
54+
{% endvscode %}
55+
56+
{% visualstudio %}
57+
58+
{% 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 custom instructions file in your repository 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.
59+
60+
{% endvisualstudio %}
61+
62+
{% webui %}
63+
64+
## Using custom instructions
65+
66+
Custom instructions consist of natural language instructions and are most effective when they are short, self-contained statements. Consider the scope over which you want the instruction to apply when choosing whether to add an instruction on the personal, repository, or (if available) organization level.
67+
68+
{% data reusables.copilot.custom-instructions-interactions-note %}
69+
70+
Here are some common use cases and examples for each type of custom instructions:
71+
* **Personal custom instructions:**
72+
* Preferred individual language: `Always respond in Portuguese.`
73+
* Individual response preferences: `Explain a single concept per line. Be clear and concise.`
74+
* **Repository custom instructions:**
75+
* Coding standards: `Use early returns whenever possible.`
76+
* Frameworks: `Use Vue with the PrimeVue library.` or `Use Typescript rather than Javascript.`
77+
* Code style preferences: `Use camel case for variable names.`
78+
* **Organization custom instructions:**
79+
* Describe how to answer certain questions: `For questions related to security, use the Security Docs Knowledge Base or advise people to consult with #security on Slack.`
80+
* Preferred language for a company which exclusively speaks a single language: `Always respond in Portuguese.`
81+
* Organization-wide preferences: `Do not generate code blocks in responses.`
82+
83+
{% endwebui %}
84+
85+
{% vscode %}
86+
87+
## About repository custom instructions
88+
89+
Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions.
90+
91+
Common use cases include:
92+
93+
* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework.
94+
* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code.
95+
* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include.
96+
97+
### Example
98+
99+
{% data reusables.copilot.repository-custom-instructions-example %}
100+
101+
## About prompt files
102+
103+
> [!NOTE] Prompt files are {% data variables.release-phases.public_preview %} and subject to change.
104+
105+
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.
106+
107+
Common use cases include:
108+
109+
* **Code generation**. Create reusable prompts for components, tests, or migrations (for example, React forms, or API mocks).
110+
* **Domain expertise**. Share specialized knowledge through prompts, such as security practices, or compliance checks.
111+
* **Team collaboration**. Document patterns and guidelines with references to specs and documentation.
112+
* **Onboarding**. Create step-by-step guides for complex processes or project-specific patterns.
113+
114+
You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose.
115+
116+
### Examples
117+
118+
The following examples demonstrate how to use prompt files.
119+
120+
* `New React form.prompt.md` - contains instructions for a reusable task to generate a form using React.
121+
122+
```markdown
123+
Your goal is to generate a new React form component.
124+
125+
Ask for the form name and fields if not provided.
126+
127+
Requirements for the form:
128+
- Use form design system components: [design-system/Form.md](../docs/design-system/Form.md)
129+
- Use `react-hook-form` for form state management:
130+
- Always define TypeScript types for your form data
131+
- Prefer *uncontrolled* components using register
132+
- Use `defaultValues` to prevent unnecessary rerenders
133+
- Use `yup` for validation:
134+
- Create reusable validation schemas in separate files
135+
- Use TypeScript types to ensure type safety
136+
- Customize UX-friendly validation rules
137+
```
138+
139+
* `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.
140+
141+
```markdown
142+
Secure REST API review:
143+
- Ensure all endpoints are protected by authentication and authorization
144+
- Validate all user inputs and sanitize data
145+
- Implement rate limiting and throttling
146+
- Implement logging and monitoring for security events
147+
148+
```
149+
150+
{% endvscode %}
151+
152+
{% visualstudio %}
153+
154+
## About repository custom instructions
155+
156+
Repository custom instructions consist of a single file, `.github/copilot-instructions.md`, that you create in a repository. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement chat questions.
157+
158+
Common use cases include:
159+
160+
* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework.
161+
* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code.
162+
* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include.
163+
164+
### Example
165+
166+
{% data reusables.copilot.repository-custom-instructions-example %}
167+
168+
{% endvisualstudio %}
169+
170+
## Next steps
171+
172+
{% webui %}
173+
174+
* [AUTOTITLE](/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot)
175+
* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
176+
* [AUTOTITLE](/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot){% ifversion fpt %} in the {% data variables.product.prodname_ghe_cloud %} documentation{% endif %}
177+
178+
{% endwebui %}
179+
180+
{% vscode %}
181+
182+
* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
183+
184+
{% endvscode %}
185+
186+
{% visualstudio %}
187+
188+
* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot)
189+
190+
{% endvisualstudio %}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Adding organization custom instructions for GitHub Copilot
3+
shortTitle: Organization custom instructions
4+
intro: 'Customize {% data variables.product.prodname_copilot_chat %} responses for members of your organization.'
5+
permissions: Organization owners
6+
product: '{% data reusables.copilot.ce-product-callout %}'
7+
versions:
8+
feature: copilot-org-instructions
9+
topics:
10+
- Copilot
11+
---
12+
13+
{% data reusables.copilot.organization-instructions-note %}
14+
15+
For an overview of the methods you can use to customize {% data variables.product.prodname_copilot_chat %} responses, see [AUTOTITLE](/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses?tool=webui).
16+
17+
## About organization custom instructions for {% data variables.product.prodname_copilot_chat %}
18+
19+
Organization owners can add instructions for {% data variables.product.prodname_copilot_chat %} in order to tailor chat responses to the needs and preferences of your organization. For example, you can choose to always have {% data variables.product.prodname_copilot_chat_short %} respond in your company's language of choice or with a particular style. Some examples of instructions you could add are:
20+
* `Always respond in Spanish.`
21+
* `Do not generate code blocks in responses.`
22+
* `For questions related to security, use the Security Docs Knowledge Base.`
23+
24+
{% data reusables.copilot.custom-instructions-interactions-note %}
25+
26+
## Adding organization custom instructions
27+
28+
You can add organization custom instructions via your organization settings.
29+
30+
{% data reusables.profile.access_org %}
31+
{% data reusables.profile.org_settings %}
32+
33+
1. In the left sidebar, click **{% octicon "copilot" aria-hidden="true" %} {% data variables.product.prodname_copilot_short %}** then click **Custom instructions**.
34+
1. Under "Preferences and instructions", add natural language instructions to the text box.
35+
36+
You can write your instructions in any format you prefer. For example, you can write them as a single block of text, each on a new line, or separated by blank lines.
37+
1. Click **Save changes**. Your instructions are now active, and will stay active until you change or remove them.
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Adding personal custom instructions for GitHub Copilot
33
shortTitle: Personal custom instructions
4-
intro: 'You can add personal instructions for {% data variables.product.prodname_copilot_chat %} to customize chat responses for your conversations.'
4+
intro: 'Customize {% data variables.product.prodname_copilot_chat %} responses to match your personal preferences.'
55
versions:
66
feature: copilot
77
topics:
@@ -10,18 +10,16 @@ topics:
1010

1111
{% data reusables.copilot.personal-instructions-note %}
1212

13-
## About personal custom instructions for {% data variables.product.prodname_copilot_chat %}
13+
For an overview of the methods you can use to customize {% data variables.product.prodname_copilot_chat %} responses, see [AUTOTITLE](/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses?tool=webui).
1414

15-
You can add instructions for {% data variables.product.prodname_copilot_chat %} in order to receive chat responses that are customized to your personal preferences, across your conversations on the {% data variables.product.github %} website. Your saved instructions will not be displayed in the chat, but they are automatically provided to {% data variables.product.prodname_copilot_short %} so that it can provide responses aligned with your personal preferences.
15+
## About personal custom instructions for {% data variables.product.prodname_copilot_chat %}
1616

17-
For example, you can choose to always have {% data variables.product.prodname_copilot_chat_short %} respond in a preferred language or with a particular style. Some examples of instructions you could add are:
17+
You can add custom instructions for {% data variables.product.prodname_copilot_chat %} in order to receive chat responses that are customized to your personal preferences, across your conversations on the {% data variables.product.github %} website. For example, you can choose to always have {% data variables.product.prodname_copilot_chat_short %} respond in a preferred language or with a particular style. Some examples of instructions you could add are:
1818
* `Always respond in Spanish.`
1919
* `Your style is a helpful colleague, minimize explanations but provide enough context to understand the code.`
2020
* `Always provide examples in TypeScript.`
2121

22-
Personal custom instructions apply to conversations that you, as a user, have with {% data variables.product.prodname_copilot_chat_short %} across {% data variables.product.github %}, and are different from repository custom instructions, which apply to conversations in the context of a single repository. For more information on repository instructions, see [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot).
23-
24-
{% data reusables.copilot.repository-vs-personal-instructions-note %} If you are concerned about response quality, you can also choose to temporarily disable repository instructions. See [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot?tool=webui#enabling-or-disabling-repository-custom-instructions).
22+
{% data reusables.copilot.custom-instructions-interactions-note %}
2523

2624
## Adding personal custom instructions
2725

@@ -34,5 +32,5 @@ You can add personal custom instructions either in the Chat panel or in immersiv
3432
1. Add natural language instructions to the text box.
3533

3634
You can write your instructions in any format you prefer. For example, you can write them as a single block of text, each on a new line, or separated by blank lines.
37-
35+
1. Optionally, click {% octicon "light-bulb" aria-label="The light-bulb icon" %} to view templates you can use for common instructions. If you click on one of the boxes, such as "Communication", instructions will be added to the text box with placeholders, such as `{format}` that you can replace with your preferences.
3836
1. Click **Save**. Your instructions are now active, and will stay active until you change or remove them.

0 commit comments

Comments
 (0)