GitHub Copilot

GitHub Copilot custom instructions

How do I give GitHub Copilot persistent instructions for my repository, my files, and myself?

Put repository-wide guidance in .github/copilot-instructions.md and file-specific guidance in .github/instructions/NAME.instructions.md files with an applyTo glob in the frontmatter. Copilot also reads AGENTS.md files for agent work, and you can add personal instructions on github.com or organization instructions in org settings. Reusable task prompts live in .github/prompts as .prompt.md files in VS Code.

Repository-wide and path-specific files

Create a file named copilot-instructions.md inside the .github directory of your repository. Write plain natural language guidance in Markdown, such as build commands, coding conventions, and project layout.

For guidance that only applies to some files, add one or more NAME.instructions.md files within or below the .github/instructions directory. The applyTo frontmatter takes a glob pattern, and you can list several patterns separated by commas.

.github/instructions/typescript.instructions.md

---
applyTo: "**/*.ts,**/*.tsx"
---
Use strict TypeScript types and avoid the any type.
Prefer named exports.
  • * matches files in the current directory.
  • **/*.py matches all Python files recursively.
  • src/**/*.py matches Python files under src recursively.
  • Add excludeAgent: "code-review" to the frontmatter to keep a file away from Copilot code review, or use it to exclude Copilot cloud agent instead.

In VS Code, an .instructions.md file can also carry name and description fields in its frontmatter, and the Chat: New Instructions File command creates one for you.

AGENTS.md and other agent instruction files

Copilot accepts one or more AGENTS.md files stored anywhere in the repository. When Copilot is working, the nearest AGENTS.md file in the directory tree takes precedence. A single CLAUDE.md or GEMINI.md file at the repository root is also accepted as agent instructions.

  • In VS Code, the chat.useAgentsMdFile setting turns AGENTS.md support on or off.
  • The chat.useNestedAgentsMdFiles setting enables AGENTS.md files in subfolders and is marked experimental.
  • The chat.useClaudeMdFile setting controls whether VS Code picks up CLAUDE.md files.

Personal and organization instructions

Personal instructions are set in Copilot Chat at github.com/copilot: click your profile picture, choose Personal instructions, enter your text, and click Save. They apply to every conversation you have in Copilot Chat on GitHub.

Organization owners on Copilot Business or Copilot Enterprise can add organization instructions under the organization Settings, then Copilot, then Custom instructions. On GitHub.com these currently apply to Copilot Chat, Copilot code review, and Copilot cloud agent. In VS Code the github.copilot.chat.organizationInstructions.enabled setting controls whether they are included.

When several sets apply, Copilot receives all of them, but personal instructions win over repository instructions, which win over organization instructions.

Which surface reads which file, plus prompt files

  • Repository-wide .github/copilot-instructions.md is supported across GitHub.com, VS Code, Visual Studio, JetBrains, Eclipse, Xcode, and Copilot CLI.
  • On GitHub.com, path-specific .instructions.md files are only supported for Copilot cloud agent and Copilot code review, not GitHub.com Chat.
  • Personal instructions on GitHub.com apply only to Copilot Chat on the website.
  • Custom instructions are enabled for Copilot code review by default and can be switched off in the repository Settings under Copilot, then Code review.

VS Code also supports prompt files, which are reusable prompts with the .prompt.md extension. Workspace prompt files go in the .github/prompts folder, user prompt files live in your VS Code profile, and you run one by typing a slash followed by its name in chat. Create one with the Chat: New Prompt File command.

.github/prompts/security-review.prompt.md

---
agent: 'ask'
description: 'Perform a REST API security review'
---
Perform a REST API security review and provide a TODO list of security issues to address.

Sources

More on GitHub Copilot

Other guides

Get the weekly agent stack update

New official MCP servers, spec changes and harness releases, checked against the source. One email a week, no fluff.

Reviewed Oct 6, 2026. Settings change often; the linked vendor docs are the source of truth.