Learn about customizing the behavior of GitHub Copilot to fit with your preferences and requirements.
Note
This version of this article is about custom instructions on the GitHub website. Click the tabs above for other environments.
GitHub Copilot can provide 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 prompts, you can create custom instructions that automatically add this information for you. The additional information is not displayed, but is available to Copilot to allow it to generate higher quality responses.
Due to the non-deterministic nature of AI, Copilot may not always follow your custom instructions in exactly the same way every time they are used.
There are three main types of custom instructions that you can use to customize Copilot responses on the GitHub website:
Personal custom instructions are currently only supported for GitHub Copilot Chat in GitHub.
You can customize how Copilot Chat responds to you on GitHub.com by adding personal instructions, which Copilot will only apply to you. You do this in a popup on the Copilot Chat page on GitHub.com. See Adding personal custom instructions for GitHub Copilot.
You can use three types of repository custom instructions in Copilot on GitHub.com:
Repository-wide custom instructions, which apply to all requests made in the context of a repository.
These are specified in a copilot-instructions.md file in the .github directory of the repository.
copilot-instructions.md
.github
Path-specific custom instructions, which apply to requests made in the context of files that match a specified path.
These are specified in one or more NAME.instructions.md files within the .github/instructions directory in the repository.
NAME.instructions.md
.github/instructions
By using path-specific instructions you can avoid overloading your repository-wide instructions with information that only applies to files of certain types, or in certain directories.
Agent instructions, which are similar to repository-wide custom instructions, but are currently not supported by all Copilot features.
These are specified in files called AGENTS.md, CLAUDE.md, or GEMINI.md.
AGENTS.md
CLAUDE.md
GEMINI.md
See the table below for details of support for each of these types of repository custom instructions across different Copilot features.
For a curated collection of examples, see Custom instructions.
The following table shows which Copilot features support custom instructions in various environments.
Types of custom instructions supported
1: Repository-wide instructions (using the .github/copilot-instructions.md file). 2: Repository-wide instructions and path-specific instructions (using .github/instructions/**/NAME.instructions.md files). 3: Repository-wide instructions, path-specific instructions, and agent instructions (using AGENTS.md files). 4: Repository-wide instructions, path-specific instructions, and agent instructions (using AGENTS.md, CLAUDE.md or GEMINI.md files). X: Custom instructions are not supported. N/A: Feature not available on this platform.
.github/copilot-instructions.md
.github/instructions/**/NAME.instructions.md
Copilot code review only reads the first 4,000 characters of any custom instruction file. Any instructions beyond this limit will not affect the reviews generated by Copilot code review. This limit does not apply to Copilot Chat or Copilot coding agent.
This feature is currently in public preview and is subject to change.
Support: Organization custom instructions are currently only supported for Copilot Chat on GitHub.com, Copilot code review on GitHub.com and Copilot coding agent on GitHub.com.
Organization owners can add instructions for Copilot, to tailor responses to the needs and preferences of your organization. For example, you can choose to always have Copilot respond in your company's language of choice or with a particular style.
Custom instructions defined in an organization's Copilot settings are used for all members of the organization, irrespective of whether they receive their Copilot subscription from that organization.
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.
Multiple types of custom instructions can apply to a request sent to Copilot. 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 Copilot.
The following list shows the complete order of precedence, with instructions higher in this list taking precedence over those lower in the list:
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 Adding repository custom instructions for GitHub Copilot.
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 organization level.
Here are some common use cases and examples for each type of custom instructions:
Always respond in Portuguese.
Explain a single concept per line. Be clear and concise.
Use early returns whenever possible.
Use Vue with the PrimeVue library.
Use Typescript rather than Javascript.
Use camel case for variable names.
For questions related to security, use the Security Docs Knowledge Base or advise people to consult with #security on Slack.
The instructions you add to your custom instruction file(s) should be short, self-contained statements that provide Copilot with relevant information to help it work in this repository. Because the instructions are sent with every chat message, they should be broadly applicable to most requests you will make in the context of the repository.
The exact structure you utilize for your instructions file(s) will vary by project and need, but the following guidelines provide a good starting point:
The following instructions file is an example of these practices in action:
# Project Overview This project is a web application that allows users to manage their tasks and to-do lists. It is built using React and Node.js, and uses MongoDB for data storage. ## Folder Structure - `/src`: Contains the source code for the frontend. - `/server`: Contains the source code for the Node.js backend. - `/docs`: Contains documentation for the project, including API specifications and user guides. ## Libraries and Frameworks - React and Tailwind CSS for the frontend. - Node.js and Express for the backend. - MongoDB for data storage. ## Coding Standards - Use semicolons at the end of each statement. - Use single quotes for strings. - Use function based components in React. - Use arrow functions for callbacks. ## UI guidelines - A toggle is provided to switch between light and dark mode. - Application should have a modern and clean design.
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, these may cause problems:
For example, the following instructions may not have the intended results:
Always conform to the coding styles defined in styleguide.md in repo my-org/my-repo when generating code. Use @terminal when answering questions about Git. Answer all questions in the style of a friendly colleague, using informal language. Answer all questions in less than 1000 characters, and words of no more than 12 characters.
This version of this article is about custom instructions and prompt files in VS Code. Click the tabs above for other environments.
GitHub Copilot can provide 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 prompts, 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 Copilot in VS Code:
*.prompt.md
While custom instructions help to add codebase-wide context to each AI workflow, prompt files let you add instructions to a specific chat interaction.
You can use three types of repository custom instructions in VS Code:
Prompt files are 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 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.
Rewrite #file:x.ts
Common use cases include:
You can have multiple prompt files in your workspace, each of which defines a prompt for a different purpose.
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.
New React form.prompt.md
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.
API security review.prompt.md
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 …
For information on how to enable, create, and use prompt files, see Adding repository custom instructions for GitHub Copilot.
This version of this article is about custom instructions and prompt files in Visual Studio. Click the tabs above for other environments.
There are two types of files you can use to provide context and instructions to Copilot in Visual Studio:
You can use two types of repository custom instructions in Visual Studio:
For information on how to create and use prompt files, see Adding repository custom instructions for GitHub Copilot.
This version of this article is about custom instructions and prompt files in JetBrains IDEs. Click the tabs above for other environments.
GitHub Copilot can provide 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 prompts, you can create a custom instructions file in your repository that automatically adds this information for you.
There are two types of files you can use to provide context and instructions to Copilot in JetBrains IDEs:
In JetBrains IDEs, 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 a Copilot prompt.
Common use cases for custom instructions include:
This example of a .github/copilot-instructions.md file contains three instructions for Copilot.
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.
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 Copilot Chat (for example, Rewrite #file:x.ts). This allows blending natural language instructions and additional context.
For a curated collection of examples, see Prompt files.
This version of this article is about custom instructions in Xcode. Click the tabs above for other environments.
GitHub Copilot can provide 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 prompts, 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 input box, but is available to Copilot to allow it to generate higher quality responses.
In Xcode, 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 a Copilot prompt.
Common use cases for repository custom instructions include:
This version of this article is about custom instructions in Eclipse. Click the tabs above for other environments.
There are two types of repository custom instructions you can use to provide context and instructions to Copilot in Eclipse:
Workspace custom instructions apply to all projects in a workspace, and allow you to specify workspace-wide instructions and preferences. You can use workspace custom instructions to provide context and instructions to Copilot in Eclipse.
Project custom instructions consist of a single file, .github/copilot-instructions.md, that you create in a project. The instructions you add to the file should be short, self-contained statements that add context or relevant information to supplement a Copilot prompt.