Copilot custom instructions are Markdown files that GitHub Copilot adds to your requests automatically. Put repository-wide rules in .github/copilot-instructions.md, scope rules to paths with .github/instructions/**/*.instructions.md files and an applyTo glob, and use AGENTS.md for agent instructions. Which files Copilot reads depends on the feature and editor: as of November 29, 2026 Copilot code review on GitHub.com also reads CLAUDE.md, GEMINI.md and REVIEW.md, and only some surfaces combine files in a defined order.
Applies to: GitHub Copilot on GitHub.com, IDEs and Copilot CLI, GitHub Docs as of November 29, 2026. Last checked: November 29, 2026.
On this page
What does a copilot-instructions.md file look like?
GitHub’s own example from Custom instructions for GitHub Copilot has a project overview, libraries and coding standards:
# 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.
## 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.
GitHub’s guidance is to write short, self-contained statements that apply to most requests, because the instructions are sent with every chat message. The current page suggests three things to cover: an overview of the project, the coding standards and conventions, and the tools, libraries or frameworks with version numbers or configurations. An earlier version of the example also had a “Folder Structure” section; it is no longer in GitHub’s example or its list of suggestions, so it is optional.
Which types of custom instructions are there?
| Type | File or setting | Set by |
|---|---|---|
| Personal | A popup on the Copilot Chat page on GitHub.com; in Copilot CLI, ~/.copilot/copilot-instructions.md and ~/.copilot/instructions/**/*.instructions.md; in JetBrains IDEs, a local global-copilot-instructions.md file | Each user |
| Repository-wide | .github/copilot-instructions.md | The repository |
| Path-specific | .github/instructions/**/NAME.instructions.md with applyTo frontmatter | The repository |
| Agent instructions | AGENTS.md (anywhere in the repository), CLAUDE.md or GEMINI.md; REVIEW.md for code review | The repository |
| Organization | The organization’s Copilot settings | Organization owners on Copilot Business or Copilot Enterprise |
Sources: response customization and adding repository custom instructions. GitHub notes that “due to the non-deterministic nature of AI, Copilot may not always follow your custom instructions in exactly the same way every time”. Organization instructions are, per GitHub, “currently supported for sessions running on the GitHub website (in cloud sandboxes or on GitHub Actions) and for Copilot code review. They are not supported in local client sessions.”
Where does each type apply?
GitHub’s support matrix lists which feature reads which files. A condensed version, checked November 29, 2026:
| Environment and feature | Repository-wide | Path-specific | Agent files | Personal / org |
|---|---|---|---|---|
| GitHub.com, Copilot Chat | Yes | No | No | Both |
| GitHub.com, Copilot cloud agent | Yes | Yes | AGENTS.md, CLAUDE.md, GEMINI.md | Org |
| GitHub.com, Copilot code review | Yes | Yes | AGENTS.md, CLAUDE.md, GEMINI.md, REVIEW.md | Org |
| VS Code, Copilot Chat | Yes | Yes | AGENTS.md | No |
| VS Code, code review | Yes | No | No | No |
| Visual Studio, Copilot Chat | Yes | Yes | No | No |
| Visual Studio, code review | Yes | No | No | No |
| JetBrains IDEs, Copilot Chat | Yes | Yes | No | Personal |
| JetBrains IDEs, code review | Yes | Yes | No | No |
| Eclipse, Copilot Chat | Yes | No | No | No |
| Xcode, Copilot Chat | Yes | Yes | No | No |
| Xcode, code review | Yes | Yes | No | No |
| Copilot CLI | Yes | Yes | AGENTS.md, CLAUDE.md, GEMINI.md | Personal (files in ~/.copilot) |
Copilot cloud agent reads repository-wide, path-specific and agent instructions in every listed IDE as well. Eclipse code review does not support custom instructions.
How do I create .github/copilot-instructions.md?
From GitHub’s how-to:
- In the root of your repository, create
.github/copilot-instructions.md. Create the.githubdirectory if it does not exist. - Add natural language instructions in Markdown. Whitespace between instructions is ignored, so one paragraph, one instruction per line or blank-line-separated blocks all work.
You can also ask Copilot cloud agent to write the file: go to github.com/copilot/agents, pick the repository and paste the onboarding prompt from the how-to page. The agent opens a draft pull request with the instructions and adds you as a reviewer. GitHub’s overview page gives a shorter version of that prompt:
Onboard this repository to Copilot cloud agent by adding a
.github/copilot-instructions.md file. Include information about project
structure, coding conventions, the test framework, and how to build and
run the project.
The first time you create a pull request in a repository with Copilot cloud agent, Copilot leaves a comment with a link to generate the file for you.
How do path-specific instructions work?
Path-specific files apply only when Copilot works on a matching file. If a repository-wide file also exists, both are used (steps):
-
Create
.github/instructions(subdirectories are allowed). -
Name each file
NAME.instructions.md; the name must end with.instructions.md. -
Start it with frontmatter containing
applyToand a glob:--- applyTo: "app/models/**/*.rb" ---Separate several patterns with commas:
--- applyTo: "**/*.ts,**/*.tsx" --- -
Optionally add
excludeAgentwith"code-review"or"cloud-agent"to keep one of them from reading the file. This file is read only by cloud agent:--- applyTo: "**" excludeAgent: "code-review" --- -
Write the instructions in natural language below the frontmatter.
GitHub’s glob examples:
| Pattern | Matches |
|---|---|
* | All files in the current directory |
** or **/* | All files in all directories |
*.py | .py files in the current directory |
**/*.py | .py files in all directories, recursively |
src/*.py | src/foo.py and src/bar.py, but not src/foo/bar.py |
src/**/*.py | src/foo.py, src/foo/bar.py and src/foo/bar/baz.py |
**/subdir/**/*.py | .py files in any subdir directory at any depth, such as subdir/foo.py and parent/subdir/baz.py, but not a foo.py outside a subdir path |
On GitHub.com, path-specific instructions are currently supported only for Copilot cloud agent and Copilot code review. In Copilot CLI, a path-specific file with excludeAgent: "cloud-agent" is also ignored.
How does Copilot use AGENTS.md?
The how-to says you can create “one or more AGENTS.md files, stored anywhere within the repository”, and “the nearest AGENTS.md file in the directory tree will take precedence”. It points to the agentsmd/agents.md repository for the format. Instead of AGENTS.md, you can use a single CLAUDE.md or GEMINI.md in the repository root.
Two limits from the docs:
- Agent instructions “are currently not supported by all Copilot features”. Copilot Chat on GitHub.com reads none of them, and in the IDEs only VS Code Copilot Chat lists
AGENTS.md(notCLAUDE.mdorGEMINI.md). Copilot code review on GitHub.com now listsAGENTS.md,CLAUDE.md,GEMINI.mdandREVIEW.md; our October 2 check listed onlyAGENTS.md. - In VS Code,
AGENTS.mdfiles outside the workspace root are turned off by default; the IDE how-to links to the VS Code docs for the setting.
GitHub also notes that agent instruction files are different from custom agent definition files in .github/agents; see Copilot custom agents for those. The same AGENTS.md file is read by other agents too; see what is Codex for how OpenAI’s agent uses it, CLAUDE.md vs AGENTS.md for the difference and our CLAUDE.md best practices for Claude Code’s file.
Where does Copilot CLI look for instructions?
The CLI page lists these locations. Repository and agent files are found in the repository root, the current working directory, the directories between them, and directories on the path of a file the CLI is working on. For the CLI itself, see GitHub Copilot CLI.
| Location | Scope |
|---|---|
$HOME/.copilot/copilot-instructions.md | User-level, across repositories |
$HOME/.copilot/instructions/**/*.instructions.md | Modular user-level instructions |
.github/copilot-instructions.md | Repository-wide |
.github/instructions/**/*.instructions.md | Modular repository instructions (not in intermediate directories) |
AGENTS.md | Agent instructions |
CLAUDE.md (also .claude/CLAUDE.md) | Agent instructions |
GEMINI.md | Agent instructions |
Directories in COPILOT_CUSTOM_INSTRUCTIONS_DIRS | Extra AGENTS.md and *.instructions.md files, comma-separated |
With COPILOT_HOME set, the CLI uses that directory instead of $HOME/.copilot for both user-level locations. Other CLI details from the same page:
/instructionsshows the files found for the session and lets you turn individual files on or off. A file you turn off is not included.- In
.github/copilot-instructions.md,AGENTS.mdorCLAUDE.md,@followed by a relative path includes another file. The CLI reads the referenced file immediately and supports references inside referenced files. Referenced files must stay inside the repository (or inside the custom instructions directory for local instructions); absolute paths and~/paths are not loaded, and references are not expanded inGEMINI.mdor*.instructions.md. - The CLI combines all applicable files and removes duplicate copies of identical user-level, repository-wide and agent instructions, but “does not define a general precedence order between these files”. Avoid conflicting instructions.
- Path-specific files are included only when their
applyTovalue matches a file the CLI is working with. - Edits are not picked up by a running session. Exit and resume (for example
copilot --continue) or start a new session with/new.
Which instructions win when several apply?
It depends on the client and feature. GitHub’s precedence section now says most surfaces and clients, including Copilot CLI, VS Code and Visual Studio, combine the applicable files without a general precedence order. Only for Copilot Chat on GitHub.com is an order given; all relevant sets are still sent to Copilot:
- Personal instructions
- Repository instructions: path-specific files, then
.github/copilot-instructions.md, then agent instructions such asAGENTS.md - Organization instructions
GitHub’s advice in every case is to avoid conflicting sets of instructions, and to disable repository instructions temporarily if you doubt response quality.
What should the instructions say?
GitHub recommends short, self-contained statements that apply to most requests: a project overview, the coding standards and conventions, and the tools, libraries and frameworks with versions. In large repositories, GitHub warns that requests to consult external resources, to answer in a particular style or to always give a certain level of detail may not work as intended. Its example of instructions that may fail:
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.
For code review, GitHub’s code review tutorial gives a best practice of limiting any single instruction file to a maximum of about 1,000 lines, because beyond that the quality of responses may deteriorate. It also advises using headings and bullet points and copying external standards into the file, since code review does not follow external links. For task-specific prompts you choose per chat rather than rules sent with every request, use prompt files.
How do I check or turn off custom instructions?
- Copilot Chat on GitHub.com and in VS Code: expand the references of a response;
.github/copilot-instructions.mdis listed when it was used. - VS Code: open Settings, search
instruction fileand toggle Code Generation: Use Instruction Files (IDE how-to). - Copilot code review: in the repository go to Settings > Copilot > Code review and toggle “Use custom instructions when reviewing pull requests” (on by default). GitHub’s note now says code review reads repository custom instructions, agent instructions and agent skills from the pull request’s head branch, not the base branch, so changes to them can be tested in the same pull request. See Copilot code review for the rest of the feature.
- Copilot CLI: use
/instructions.
Repository files can also carry hooks for agent runs; see Copilot hooks.





