How to Customise GitHub Copilot: Instructions, Prompt Files, MCP, and Agents

GitHub Copilot is customised through repository instructions, such as a copilot-instructions file describing your conventions, path-specific instruction files, reusable prompt files for common tasks, MCP servers that connect external tools and knowledge, and custom agents with their own instructions and tools. Newer extension points such as skills and hooks appear in some versions. Start with concise repository instructions.

Repository instructions

A custom instructions file in the repository, commonly .github/copilot-instructions.md, tells Copilot how your project works: languages and frameworks, build and test commands, conventions, and rules such as which libraries to prefer or avoid. It is included automatically, which makes it powerful and also a cost: every line rides along with every request.

Write only what Copilot cannot infer from the code. Commands, conventions, and hard constraints belong; long architecture explanations do not, and are better retrieved when needed.

Path-specific instructions

Large repositories have areas with different rules: frontend and backend, generated code, infrastructure definitions. Instruction files that apply only to matching paths keep those rules targeted, so frontend conventions do not clutter backend work and vice versa. Check your Copilot version's documentation for the file naming and pattern syntax.

Prompt files

Reusable prompt files capture tasks you run repeatedly: writing tests for a module in your house style, generating a migration, reviewing a change against a checklist, or drafting release notes. Stored in the repository, they give the whole team the same well-tuned prompts and turn tribal knowledge about how to ask into shared assets.

MCP servers

In agent mode, Copilot can use tools from MCP servers: issue trackers, databases, cloud consoles, documentation, and knowledge bases. Each server's tools add context to requests and choices for the agent, so add servers that you use often and that return small, relevant results. A retrieval server over your documentation and codebase lets the agent fetch relevant passages instead of reading many files.

Custom agents, skills, and hooks

Custom agents define a persona with its own instructions and allowed tools, such as a reviewer that only reads, or a planner that produces specifications before code. They live in .github/agents/NAME.agent.md, with frontmatter for the name, description, and an optional tool allowlist.

Skills package instructions and resources as a directory holding a SKILL.md file, read from .github/skills/. Copilot uses the same convention Claude Code introduced, and also reads .claude/skills/, so a skill written for one agent generally works in the other.

Hooks run shell commands at lifecycle points, configured in .github/hooks/*.json for a repository or under your home directory for personal use. The documented points include session start and end, prompt submission, before and after a tool call, and agent stop; the before-tool hook can approve or deny the call, which is what makes hooks a policy mechanism rather than just logging.

Availability still differs between the cloud agent, the CLI, and the IDE, so check what your surface supports before designing around a feature.

Writing instructions that work

Effective instructions are specific and checkable: use the existing logger rather than print statements; tests live next to source files and use the project's test helpers; never edit files in the generated folder. Vague guidance such as write clean code adds tokens without changing behaviour. Include the exact commands for building, testing, and linting, since agents use them to check their own work. Review instructions when the codebase changes, because outdated rules are worse than none.

Security considerations

Copilot's agent mode can run commands and use tools from MCP servers. Treat each server as code with access: install from trusted sources, review what tools it exposes, and avoid servers that hold broad credentials. Be cautious with content Copilot reads from outside the repository, such as issues and web pages, which can contain instructions designed to steer an agent. Keep approval required for commands that change systems outside the workspace.

An adoption order

  1. Write concise repository instructions and commit them.
  2. Add path-specific instructions where rules genuinely differ.
  3. Turn your most repeated prompts into prompt files.
  4. Add one or two MCP servers, starting with knowledge you currently paste into chat.
  5. Define custom agents for recurring roles.
  6. Review the setup quarterly: remove stale instructions, unused prompts, and idle servers.

Teams that run several coding agents, such as Copilot and Claude Code, should keep one canonical instruction source and point each tool at it, so rules do not drift between files.

Frequently asked questions

Where do GitHub Copilot custom instructions go?
Repository-wide instructions commonly live in a file under the .github directory, such as copilot-instructions.md, and are included automatically in requests. Path-specific instruction files apply only to matching parts of the codebase. Check the current Copilot documentation for exact file names and supported locations in your editor.
Can GitHub Copilot use MCP servers?
Yes. Copilot's agent mode in supported editors can use tools from MCP servers, which connect it to external systems such as issue trackers, databases, and documentation. Configure servers in your editor's MCP settings, and add only the ones you use regularly, since each adds tool definitions to the agent's context.
How do I share Copilot customisations with my team?
Commit them to the repository: the repository instructions file, path-specific instructions, prompt files, and shared MCP configuration where your setup supports it. Personal preferences belong in user-level settings. Review changes to shared customisations through pull requests like any other code.
Do Copilot and Claude Code use the same instruction files?
Not by default. Each tool reads its own files, although support for shared conventions is growing. To avoid drift, keep one canonical instruction file and have each tool's file import or point to it, then verify each tool actually loads the content after upgrades.
What are Copilot prompt files?
Prompt files are reusable prompts stored in the repository and invoked when needed, such as a standard request for writing tests, reviewing changes, or generating documentation in your format. They let a team share well-tuned prompts instead of each person retyping their own version, and they evolve through normal code review.
How long should Copilot custom instructions be?
As short as possible while covering what Copilot cannot infer: commands, conventions, and hard constraints. Every line is included in requests, so long files cost context and dilute the rules that matter. If instructions grow beyond a page, move background material into documentation the agent can retrieve when needed.