From a5d8ecce7f45d15e630a7f505be65cc9796f4dfc Mon Sep 17 00:00:00 2001 From: Larissa Fortuna <56982181+lkfortuna@users.noreply.github.com> Date: Wed, 9 Apr 2025 11:19:19 -0700 Subject: [PATCH 1/3] 96 core runner launch (#55116) --- .../using-larger-runners/about-larger-runners.md | 1 + .../about-billing-for-github-actions.md | 2 ++ 2 files changed, 3 insertions(+) diff --git a/content/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners.md b/content/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners.md index 7a40bf7f7c98..6cd12536ace3 100644 --- a/content/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners.md +++ b/content/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners.md @@ -86,6 +86,7 @@ You can choose from several specifications for {% data variables.actions.hosted_ | 32 | 128 GB | 1200 GB | x64, arm64 | Ubuntu, Windows | | 64 | 208 GB | 2040 GB | arm64 | Ubuntu, Windows | | 64 | 256 GB | 2040 GB | x64 | Ubuntu, Windows | +| 96 | 384 GB | 2040 GB | x64 | Ubuntu, Windows | >[!NOTE] The 4-vCPU Windows runner only works with the Windows Server 2025 or Windows 11 Desktop image. diff --git a/content/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions.md b/content/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions.md index 9c3aa6585674..782f23c51fe5 100644 --- a/content/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions.md +++ b/content/billing/managing-billing-for-your-products/managing-billing-for-github-actions/about-billing-for-github-actions.md @@ -81,11 +81,13 @@ Jobs that run on Windows and macOS runners that {% data variables.product.prodna | Linux 16-core | $0.064 | | Linux 32-core | $0.128 | | Linux 64-core | $0.256 | +| Linux 96-core | $0.384 | | Windows 4-core | $0.032 | | Windows 8-core | $0.064 | | Windows 16-core | $0.128 | | Windows 32-core | $0.256 | | Windows 64-core | $0.512 | +| Windows 96-core | $0.786 | | macOS 12-core | $0.12 | #### Per-minute rates for arm64-powered {% data variables.actions.hosted_runners %} From 4a9a1399021b0f5203ff808e1678252f8c73bb72 Mon Sep 17 00:00:00 2001 From: Sarita Iyer <66540150+saritai@users.noreply.github.com> Date: Wed, 9 Apr 2025 15:40:01 -0400 Subject: [PATCH 2/3] [2025-04-09] Organization custom instructions doc + new conceptual article on customizing Chat responses (#55149) Co-authored-by: Kevin Heis --- .../github-copilot-features.md | 4 + ...stomizing-github-copilot-chat-responses.md | 190 ++++++++++++++++++ ...-custom-instructions-for-github-copilot.md | 37 ++++ ...-custom-instructions-for-github-copilot.md | 14 +- ...-custom-instructions-for-github-copilot.md | 158 +++++++-------- content/copilot/customizing-copilot/index.md | 4 +- data/features/copilot-org-instructions.yml | 2 + .../custom-instructions-interactions-note.md | 3 + .../copilot/differences-cfi-cfb-table.md | 3 +- .../copilot/organization-instructions-note.md | 4 + .../copilot/personal-instructions-note.md | 3 +- .../repository-custom-instructions-example.md | 9 + .../repository-custom-instructions-note.md | 1 + 13 files changed, 340 insertions(+), 92 deletions(-) create mode 100644 content/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses.md create mode 100644 content/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot.md create mode 100644 data/features/copilot-org-instructions.yml create mode 100644 data/reusables/copilot/custom-instructions-interactions-note.md create mode 100644 data/reusables/copilot/organization-instructions-note.md create mode 100644 data/reusables/copilot/repository-custom-instructions-example.md create mode 100644 data/reusables/copilot/repository-custom-instructions-note.md diff --git a/content/copilot/about-github-copilot/github-copilot-features.md b/content/copilot/about-github-copilot/github-copilot-features.md index 797deee4ea77..2de828c8bc8e 100644 --- a/content/copilot/about-github-copilot/github-copilot-features.md +++ b/content/copilot/about-github-copilot/github-copilot-features.md @@ -58,6 +58,10 @@ Bringing the power of industry leading large and small language models to users 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. +### {% data variables.product.prodname_copilot_short %} custom instructions + +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). + ### {% data variables.product.prodname_copilot_short %} knowledge bases _({% data variables.product.prodname_copilot_enterprise_short %} only)_ 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). diff --git a/content/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses.md b/content/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses.md new file mode 100644 index 000000000000..7c385aefc68e --- /dev/null +++ b/content/copilot/customizing-copilot/about-customizing-github-copilot-chat-responses.md @@ -0,0 +1,190 @@ +--- +title: About customizing GitHub Copilot Chat responses +shortTitle: About customizing Copilot responses +intro: 'Learn about customizing {% data variables.product.prodname_copilot_chat %} responses to fit with your preferences and requirements.' +versions: + feature: copilot +topics: + - Copilot +--- + +{% webui %} + +> [!NOTE] This version of this article is about custom instructions on the {% data variables.product.github %} website. Click the tabs above for other environments. + +{% endwebui %} + +{% vscode %} + +> [!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. + +{% endvscode %} + +{% visualstudio %} + +> [!NOTE] This version of this article is about custom instructions in {% data variables.product.prodname_vs %}. Click the tabs above for other environments. + +{% endvisualstudio %} + +## About customizing {% data variables.product.prodname_copilot_chat %} responses + +{% webui %} + +{% 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. + +### Types of custom instructions + +* **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. +* **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. +* **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. + +{% endwebui %} + +{% vscode %} + +{% 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. + +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 %}: + +* **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. +* **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 %}. + +While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction. + +{% endvscode %} + +{% visualstudio %} + +{% 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. + +{% endvisualstudio %} + +{% webui %} + +## Using custom instructions + +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. + +{% data reusables.copilot.custom-instructions-interactions-note %} + +Here are some common use cases and examples for each type of custom instructions: +* **Personal custom instructions:** + * Preferred individual language: `Always respond in Portuguese.` + * Individual response preferences: `Explain a single concept per line. Be clear and concise.` +* **Repository custom instructions:** + * Coding standards: `Use early returns whenever possible.` + * Frameworks: `Use Vue with the PrimeVue library.` or `Use Typescript rather than Javascript.` + * Code style preferences: `Use camel case for variable names.` +* **Organization custom instructions:** + * 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.` + * Preferred language for a company which exclusively speaks a single language: `Always respond in Portuguese.` + * Organization-wide preferences: `Do not generate code blocks in responses.` + +{% endwebui %} + +{% vscode %} + +## About repository custom instructions + +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. + +Common use cases include: + +* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework. +* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code. +* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +## About prompt files + +> [!NOTE] Prompt files are {% data variables.release-phases.public_preview %} and subject to change. + +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. + +Common use cases include: + +* **Code generation**. Create reusable prompts for components, tests, or migrations (for example, React forms, or API mocks). +* **Domain expertise**. Share specialized knowledge through prompts, such as security practices, or compliance checks. +* **Team collaboration**. Document patterns and guidelines with references to specs and documentation. +* **Onboarding**. Create step-by-step guides for complex processes or project-specific patterns. + +You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose. + +### Examples + +The following examples demonstrate how to use prompt files. + +* `New React form.prompt.md` - contains instructions for a reusable task to generate a form using React. + + ```markdown + Your goal is to generate a new React form component. + + Ask for the form name and fields if not provided. + + Requirements for the form: + - Use form design system components: [design-system/Form.md](../docs/design-system/Form.md) + - Use `react-hook-form` for form state management: + - Always define TypeScript types for your form data + - Prefer *uncontrolled* components using register + - Use `defaultValues` to prevent unnecessary rerenders + - Use `yup` for validation: + - Create reusable validation schemas in separate files + - Use TypeScript types to ensure type safety + - Customize UX-friendly validation rules + ``` + +* `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. + + ```markdown + Secure REST API review: + - Ensure all endpoints are protected by authentication and authorization + - Validate all user inputs and sanitize data + - Implement rate limiting and throttling + - Implement logging and monitoring for security events + … + ``` + +{% endvscode %} + +{% visualstudio %} + +## About repository custom instructions + +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. + +Common use cases include: + +* **Test generation.** Create instructions for test generation, such as specifying the use of a certain test framework. +* **Code review.** Specify instructions for reviewing code, such as telling a reviewer to look for a specific error in the code. +* **Commit message generation.** Write instructions for generating commit messages, such as format or the type of information to include. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + +{% endvisualstudio %} + +## Next steps + +{% webui %} + +* [AUTOTITLE](/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot) +* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) +* [AUTOTITLE](/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot){% ifversion fpt %} in the {% data variables.product.prodname_ghe_cloud %} documentation{% endif %} + +{% endwebui %} + +{% vscode %} + +* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) + +{% endvscode %} + +{% visualstudio %} + +* [AUTOTITLE](/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot) + +{% endvisualstudio %} diff --git a/content/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot.md b/content/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot.md new file mode 100644 index 000000000000..2ed800eda971 --- /dev/null +++ b/content/copilot/customizing-copilot/adding-organization-custom-instructions-for-github-copilot.md @@ -0,0 +1,37 @@ +--- +title: Adding organization custom instructions for GitHub Copilot +shortTitle: Organization custom instructions +intro: 'Customize {% data variables.product.prodname_copilot_chat %} responses for members of your organization.' +permissions: Organization owners +product: '{% data reusables.copilot.ce-product-callout %}' +versions: + feature: copilot-org-instructions +topics: + - Copilot +--- + +{% data reusables.copilot.organization-instructions-note %} + +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). + +## About organization custom instructions for {% data variables.product.prodname_copilot_chat %} + +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: +* `Always respond in Spanish.` +* `Do not generate code blocks in responses.` +* `For questions related to security, use the Security Docs Knowledge Base.` + +{% data reusables.copilot.custom-instructions-interactions-note %} + +## Adding organization custom instructions + +You can add organization custom instructions via your organization settings. + +{% data reusables.profile.access_org %} +{% data reusables.profile.org_settings %} + +1. In the left sidebar, click **{% octicon "copilot" aria-hidden="true" %} {% data variables.product.prodname_copilot_short %}** then click **Custom instructions**. +1. Under "Preferences and instructions", add natural language instructions to the text box. + + 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. +1. Click **Save changes**. Your instructions are now active, and will stay active until you change or remove them. diff --git a/content/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot.md b/content/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot.md index 88acb4c19a1b..d2f7e29c7bd0 100644 --- a/content/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot.md +++ b/content/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot.md @@ -1,7 +1,7 @@ --- title: Adding personal custom instructions for GitHub Copilot shortTitle: Personal custom instructions -intro: 'You can add personal instructions for {% data variables.product.prodname_copilot_chat %} to customize chat responses for your conversations.' +intro: 'Customize {% data variables.product.prodname_copilot_chat %} responses to match your personal preferences.' versions: feature: copilot topics: @@ -10,18 +10,16 @@ topics: {% data reusables.copilot.personal-instructions-note %} -## About personal custom instructions for {% data variables.product.prodname_copilot_chat %} +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). -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. +## About personal custom instructions for {% data variables.product.prodname_copilot_chat %} -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: +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: * `Always respond in Spanish.` * `Your style is a helpful colleague, minimize explanations but provide enough context to understand the code.` * `Always provide examples in TypeScript.` -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). - -{% 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). +{% data reusables.copilot.custom-instructions-interactions-note %} ## Adding personal custom instructions @@ -34,5 +32,5 @@ You can add personal custom instructions either in the Chat panel or in immersiv 1. Add natural language instructions to the text box. 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. - +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. 1. Click **Save**. Your instructions are now active, and will stay active until you change or remove them. diff --git a/content/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot.md b/content/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot.md index 2b3a1bf71ff8..d9dcb4c4f614 100644 --- a/content/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot.md +++ b/content/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot.md @@ -1,7 +1,7 @@ --- title: Adding repository custom instructions for GitHub Copilot shortTitle: Repository custom instructions -intro: 'You can create a file in a repository that automatically adds information to all questions you ask {% data variables.product.prodname_copilot_chat_short %}.' +intro: 'Create a file in a repository that automatically adds information to questions you ask {% data variables.product.prodname_copilot_chat_short %}.' redirect_from: - /copilot/customizing-copilot/adding-custom-instructions-for-github-copilot versions: @@ -15,47 +15,102 @@ topics: > This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. > -{% data reusables.copilot.custom-instructions-note %} +{% data reusables.copilot.repository-custom-instructions-note %} > > This version of this article is for using repository custom instructions on the {% data variables.product.github %} website. Click the tabs above for information on using custom instructions in other environments. +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). + +## About repository custom instructions for {% data variables.product.prodname_copilot_chat %} + +{% 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 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. + +### Example + +{% data reusables.copilot.repository-custom-instructions-example %} + {% endwebui %} {% vscode %} -{% data reusables.copilot.custom-instructions-note %} +{% data reusables.copilot.repository-custom-instructions-note %} > > This version of this article is for using repository custom instructions in {% data variables.product.prodname_vscode_shortname %}. Click the tabs above for instructions on using custom instructions in other environments. +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=vscode). + +## About repository custom instructions and prompt files for {% data variables.product.prodname_copilot_chat %} + +{% 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. + +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 %}: + +* **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. +* **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 %}. + +While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction. + +### Repository custom instructions example + +{% data reusables.copilot.repository-custom-instructions-example %} + +### Prompt file examples + +The following examples demonstrate how to use prompt files. + +* `New React form.prompt.md` - contains instructions for a reusable task to generate a form using React. + + ```markdown + Your goal is to generate a new React form component. + + Ask for the form name and fields if not provided. + + Requirements for the form: + - Use form design system components: [design-system/Form.md](../docs/design-system/Form.md) + - Use `react-hook-form` for form state management: + - Always define TypeScript types for your form data + - Prefer *uncontrolled* components using register + - Use `defaultValues` to prevent unnecessary rerenders + - Use `yup` for validation: + - Create reusable validation schemas in separate files + - Use TypeScript types to ensure type safety + - Customize UX-friendly validation rules + ``` + +* `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. + + ```markdown + Secure REST API review: + - Ensure all endpoints are protected by authentication and authorization + - Validate all user inputs and sanitize data + - Implement rate limiting and throttling + - Implement logging and monitoring for security events + … + ``` + {% endvscode %} {% visualstudio %} > This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. > -{% data reusables.copilot.custom-instructions-note %} +{% data reusables.copilot.repository-custom-instructions-note %} > > This version of this article is for using repository custom instructions in {% data variables.product.prodname_vs %}. Click the tabs above for instructions on using custom instructions in other environments. -{% endvisualstudio %} +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=visualstudio). ## About repository custom instructions for {% data variables.product.prodname_copilot_chat %} {% 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 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. -{% vscode %} +### Example -Additionally, you can create prompt files. With prompt files, you can specify common prompt instructions and relevant context in a Markdown file (`*.prompt.md`), that you can then reuse in your chat prompts. Prompt files are only available in {% data variables.product.prodname_vscode_shortname %}. +{% data reusables.copilot.repository-custom-instructions-example %} -{% endvscode %} - -{% webui %} - -You can also create personal custom instructions, which apply to conversations you, as a user, have with {% data variables.product.prodname_copilot_chat_short %} across {% data variables.product.github %}. This differs from repository custom instructions, which apply to conversations in the context of a single repository. For more information on personal instructions, see [AUTOTITLE](/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot). - -{% endwebui %} +{% endvisualstudio %} -## Prerequisites +## Prerequisites for repository custom instructions * A custom instructions file (see the instructions below). @@ -88,29 +143,17 @@ You can also create personal custom instructions, which apply to conversations y Whitespace between instructions is ignored, so the instructions can be written as a single paragraph, each on a new line, or separated by blank lines for legibility. -## Sample instructions - -This example of a `.github/copilot-instructions.md` file contains three instructions that will be added to all chat questions. - -```markdown -We use Bazel for managing our Java dependencies, not Maven, so when talking about Java packages, always give me instructions and code samples that use Bazel. - -We always write JavaScript with double quotes and tabs for indentation, so when your responses include JavaScript code, please follow those conventions. - -Our team uses Jira for tracking items of work. -``` - ## Writing effective repository custom instructions The instructions you add to the `.github/copilot-instructions.md` file should be short, self-contained statements that add context or relevant information to supplement users' chat questions. -The following types of instructions are unlikely to work as desired and may cause problems with other areas of {% data variables.product.prodname_copilot_short %}: +You should also consider the size and complexity of your repository. The following types of instructions may work for a small repository with only a few contributors, but for a large and diverse repository, they may cause problems with other areas of {% data variables.product.prodname_copilot_short %}: * Requests to refer to external resources when formulating a response * Instructions to answer in a particular style * Requests to always respond with a certain level of detail -The following instructions are therefore unlikely to have the intended result: +For example, the following instructions may not have the intended results: ```markdown Always conform to the coding styles defined in styleguide.md in repo my-org/my-repo when generating code. @@ -128,15 +171,15 @@ Answer all questions in less than 1000 characters, and words of no more than 12 The instructions in the `.github/copilot-instructions.md` file are available for use by {% data variables.product.prodname_copilot_chat_short %} as soon as you save the file. The complete set of instructions will be automatically added to chat prompts that relate to the repository containing the instructions file. -In {% data variables.product.prodname_copilot_chat_short %}'s immersive view ([github.com/copilot](https://github.com/copilot)), you can start a conversation that uses custom instructions by adding, as an attachment, the repository that contains the instructions file. +In {% data variables.product.prodname_copilot_chat_short %}'s immersive view ([github.com/copilot](https://github.com/copilot)), you can start a conversation that uses repository custom instructions by adding, as an attachment, the repository that contains the instructions file. -Whenever custom instructions are used by {% data variables.product.prodname_copilot_chat_short %}, the instructions file is added as a reference for the response that's generated. To find out whether custom instructions were used, expand the list of references at the top of a chat response in the Chat panel and check whether the `.github/copilot-instructions.md` file is listed. +Whenever repository custom instructions are used by {% data variables.product.prodname_copilot_chat_short %}, the instructions file is added as a reference for the response that's generated. To find out whether repository custom instructions were used, expand the list of references at the top of a chat response in the Chat panel and check whether the `.github/copilot-instructions.md` file is listed. -![Screenshot of an expanded References list, showing the 'copilot-instructions.md' file highlighted with a dark organge outline.](/assets/images/help/copilot/custom-instructions-ref-in-github.png) +![Screenshot of an expanded References list, showing the 'copilot-instructions.md' file highlighted with a dark orange outline.](/assets/images/help/copilot/custom-instructions-ref-in-github.png) You can click the reference to open the file. -{% data reusables.copilot.repository-vs-personal-instructions-note %} See [AUTOTITLE](/copilot/customizing-copilot/adding-personal-custom-instructions-for-github-copilot). +{% data reusables.copilot.custom-instructions-interactions-note %} {% endwebui %} @@ -193,56 +236,11 @@ Your choice persists until you change it. {% vscode %} -## About prompt files +## Enabling and using prompt files > [!NOTE] Prompt files are {% data variables.release-phases.public_preview %} and subject to change. -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. - -While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction. - -Common use cases include: - -* **Code generation**. Create reusable prompts for components, tests, or migrations (for example, React forms, or API mocks). -* **Domain expertise**. Share specialized knowledge through prompts, such as security practices, or compliance checks. -* **Team collaboration**. Document patterns and guidelines with references to specs and documentation. -* **Onboarding**. Create step-by-step guides for complex processes or project-specific patterns. - -You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose. - -### Prompt file examples - -The following examples demonstrate how to use prompt files. - -* `New React form.prompt.md` - contains instructions for a reusable task to generate a form using React. - - ```markdown - Your goal is to generate a new React form component. - - Ask for the form name and fields if not provided. - - Requirements for the form: - - Use form design system components: [design-system/Form.md](../docs/design-system/Form.md) - - Use `react-hook-form` for form state management: - - Always define TypeScript types for your form data - - Prefer *uncontrolled* components using register - - Use `defaultValues` to prevent unnecessary rerenders - - Use `yup` for validation: - - Create reusable validation schemas in separate files - - Use TypeScript types to ensure type safety - - Customize UX-friendly validation rules - ``` - -* `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. - - ```markdown - Secure REST API review: - - Ensure all endpoints are protected by authentication and authorization - - Validate all user inputs and sanitize data - - Implement rate limiting and throttling - - Implement logging and monitoring for security events - … - ``` +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`). You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose. ### Enabling prompt files diff --git a/content/copilot/customizing-copilot/index.md b/content/copilot/customizing-copilot/index.md index 2933e0413a91..9b768adaefd6 100644 --- a/content/copilot/customizing-copilot/index.md +++ b/content/copilot/customizing-copilot/index.md @@ -8,8 +8,10 @@ topics: - Copilot children: - /extending-the-capabilities-of-github-copilot-in-your-organization - - /adding-repository-custom-instructions-for-github-copilot + - /about-customizing-github-copilot-chat-responses - /adding-personal-custom-instructions-for-github-copilot + - /adding-repository-custom-instructions-for-github-copilot + - /adding-organization-custom-instructions-for-github-copilot - /extending-copilot-chat-with-mcp - /managing-copilot-knowledge-bases - /creating-a-custom-model-for-github-copilot diff --git a/data/features/copilot-org-instructions.yml b/data/features/copilot-org-instructions.yml new file mode 100644 index 000000000000..1a45eecc8073 --- /dev/null +++ b/data/features/copilot-org-instructions.yml @@ -0,0 +1,2 @@ +versions: + ghec: '*' diff --git a/data/reusables/copilot/custom-instructions-interactions-note.md b/data/reusables/copilot/custom-instructions-interactions-note.md new file mode 100644 index 000000000000..ae3037171fab --- /dev/null +++ b/data/reusables/copilot/custom-instructions-interactions-note.md @@ -0,0 +1,3 @@ +> [!NOTE] +> * It is possible for multiple types of custom instructions to apply to a conversation. Personal instructions take the highest priority, followed by repository instructions, with organization instructions prioritized last. However, all sets of relevant instructions are still combined and provided to {% data variables.product.prodname_copilot_chat_short %}. +> * Whenever possible, you should avoid providing conflicting sets of instructions. 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). diff --git a/data/reusables/copilot/differences-cfi-cfb-table.md b/data/reusables/copilot/differences-cfi-cfb-table.md index b7b4750b41b3..3c71e06ee6a3 100644 --- a/data/reusables/copilot/differences-cfi-cfb-table.md +++ b/data/reusables/copilot/differences-cfi-cfb-table.md @@ -71,7 +71,8 @@ | Customization | {% data variables.product.prodname_copilot_free_short %} | {% data variables.product.prodname_copilot_pro_short %} | {% data variables.product.prodname_copilot_pro_plus_short %} | {% data variables.product.prodname_copilot_business_short %} | {% data variables.product.prodname_copilot_enterprise_short %} | | --- | --- | --- | --- | --- | --- | -| Custom instructions | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | +| Repository and personal custom instructions | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | +| Organization custom instructions ({% data variables.release-phases.public_preview %}) | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "check" aria-label="Included" %} | | Prompt files | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | | Private extensions | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | {% octicon "check" aria-label="Included" %} | | Coding guidelines for code review | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "x" aria-label="Not included" %} | {% octicon "check" aria-label="Included" %} | diff --git a/data/reusables/copilot/organization-instructions-note.md b/data/reusables/copilot/organization-instructions-note.md new file mode 100644 index 000000000000..49caecf8814d --- /dev/null +++ b/data/reusables/copilot/organization-instructions-note.md @@ -0,0 +1,4 @@ +> [!NOTE] +> This feature is currently in {% data variables.release-phases.public_preview %} and is subject to change. +> +> Organization custom instructions are currently only supported for {% data variables.product.prodname_copilot_chat_dotcom %}. diff --git a/data/reusables/copilot/personal-instructions-note.md b/data/reusables/copilot/personal-instructions-note.md index e1508d82381e..f93d67112e9d 100644 --- a/data/reusables/copilot/personal-instructions-note.md +++ b/data/reusables/copilot/personal-instructions-note.md @@ -1,2 +1 @@ -> [!NOTE] -> Personal custom instructions are currently only supported for {% data variables.product.prodname_copilot_chat_dotcom %}. +> [!NOTE] Personal custom instructions are currently only supported for {% data variables.product.prodname_copilot_chat_dotcom %}. diff --git a/data/reusables/copilot/repository-custom-instructions-example.md b/data/reusables/copilot/repository-custom-instructions-example.md new file mode 100644 index 000000000000..b6ed12efe81e --- /dev/null +++ b/data/reusables/copilot/repository-custom-instructions-example.md @@ -0,0 +1,9 @@ +This example of a `.github/copilot-instructions.md` file contains three instructions that will be added to all chat questions. + +```markdown +We use Bazel for managing our Java dependencies, not Maven, so when talking about Java packages, always give me instructions and code samples that use Bazel. + +We always write JavaScript with double quotes and tabs for indentation, so when your responses include JavaScript code, please follow those conventions. + +Our team uses Jira for tracking items of work. +``` diff --git a/data/reusables/copilot/repository-custom-instructions-note.md b/data/reusables/copilot/repository-custom-instructions-note.md new file mode 100644 index 000000000000..7a2bcc3fe239 --- /dev/null +++ b/data/reusables/copilot/repository-custom-instructions-note.md @@ -0,0 +1 @@ +> [!NOTE] Repository custom instructions are currently supported for {% data variables.product.prodname_copilot_chat_short %} in {% data variables.product.prodname_vs %}, {% data variables.product.prodname_vscode_shortname %} and on the {% data variables.product.github %} website. From 5e9303658024bd75ab0558e24c093de993bfce42 Mon Sep 17 00:00:00 2001 From: Evan Bonsignori Date: Wed, 9 Apr 2025 12:51:48 -0700 Subject: [PATCH 3/3] keep track of isStaff in state (#55227) --- .../experiments/useShouldShowExperiment.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/events/components/experiments/useShouldShowExperiment.ts b/src/events/components/experiments/useShouldShowExperiment.ts index 1988fb3ecdcc..5eaa2c094aee 100644 --- a/src/events/components/experiments/useShouldShowExperiment.ts +++ b/src/events/components/experiments/useShouldShowExperiment.ts @@ -13,6 +13,20 @@ export function useShouldShowExperiment(experimentKey: ExperimentNames | { key: const [showExperiment, setShowExperiment] = useState(false) const router = useRouter() const mainContext = useMainContext() + const [isStaff, setIsStaff] = useState(false) + + // Fetch `isStaff` one time on mount so we can know if the other useEffect needs to be re-run + useEffect(() => { + let cancelled = false + async function checkStaff() { + const staffValue = await getIsStaff() + if (!cancelled) setIsStaff(staffValue) + } + checkStaff() + return () => { + cancelled = true + } + }, []) useEffect(() => { const updateShouldShow = async () => { @@ -36,7 +50,7 @@ export function useShouldShowExperiment(experimentKey: ExperimentNames | { key: return () => { window.removeEventListener('controlGroupOverrideChanged', updateShouldShow) } - }, [experimentKey, router.locale, mainContext.currentVersion, router.query]) + }, [experimentKey, router.locale, mainContext.currentVersion, router.query, isStaff]) return showExperiment }