Course contents

GitHub Copilot custom instructions and skills: setup guide

beginner3 min readUpdated
  • GitHub Copilot
On this page

The three kinds of repository instructions

GitHub Copilot supports three types of repository instructions (GitHub docs):

TypeFileApplies to
Repository-wide.github/copilot-instructions.mdEvery request in the repo
Path-specific.github/instructions/NAME.instructions.mdRequests involving files that match applyTo
Agent instructionsAGENTS.md, anywhere in the repoAgents; the nearest AGENTS.md in the tree takes precedence

Instead of AGENTS.md, Copilot also accepts a single CLAUDE.md or GEMINI.md at the repository root.

When a path-specific file matches and a repository-wide file exists, Copilot uses both. Personal instructions have the highest priority, then repository, then organization, but all relevant sets are sent.

Repository-wide instructions

.github/copilot-instructions.md
# Repository guide

## Build and test
- Install with `pnpm install`.
- Run `pnpm test` and `pnpm lint` before you open a pull request.

## Layout
- HTTP handlers live in `src/api/routes/`.
- Database access goes through `src/repositories/` only.

## Don't
- Don't add production dependencies without saying why in the PR description.

No frontmatter is needed. Copilot reads it as soon as you save.

Path-specific instructions with applyTo

Create files that end in .instructions.md inside .github/instructions/ (subfolders are fine). Start each with an applyTo glob. Separate multiple patterns with commas:

.github/instructions/tests.instructions.md
---
applyTo: "**/*.test.ts,**/*.test.tsx"
---

- Use Vitest (`describe`, `it`, `expect`). Don't import from Jest.
- Mock network calls with the helpers in `test/msw/`.
- One behavior per `it` block.

Glob notes from GitHub's docs: *.py matches only the current directory, **/*.py matches recursively, and src/**/*.py matches everything under src.

To keep a file away from one Copilot agent, add excludeAgent with "code-review" or "cloud-agent":

---
applyTo: "**"
excludeAgent: "code-review"
---

In VS Code, instruction files can also carry name (a display name) and description (used for on-demand loading in some session types) (VS Code reference).

Agent skills

Copilot supports the open Agent Skills format (GitHub docs):

ScopeLocation
Project.github/skills/, .claude/skills/ or .agents/skills/
Personal~/.copilot/skills/ or ~/.agents/skills/
.github/skills/fix-failing-ci/SKILL.md
---
name: fix-failing-ci
description: "Diagnose and fix a failing GitHub Actions run on the current pull request. Use when the user says CI is red, a check failed, or a workflow broke."
---

1. List recent workflow runs for this branch and find the failed job.
2. Read only the failing step's log.
3. Reproduce the failure locally with the same command.
4. Fix it, rerun the command, and report the before and after output.

name is required (lowercase, hyphens) and should match the folder; description is required. Files next to SKILL.md, such as scripts, are made available when the skill is used.

In VS Code you can run a skill as a slash command by typing / and picking it. VS Code also supports argument-hint, user-invocable and disable-model-invocation in skill frontmatter. You can install skills from GitHub repositories with gh skill in GitHub CLI.

Install a preset

npx presets-dev add nextjs --tool copilot
created .github/instructions/nextjs.instructions.md
created .github/skills/nextjs-code-review/SKILL.md
2 file action(s), 0 skipped. https://presets.dev

The instructions file uses applyTo for the App Router files, and it leaves your existing .github/copilot-instructions.md untouched. If .agents/skills/nextjs-code-review/ already exists, the CLI skips the .github/skills copy because Copilot reads .agents/skills/ too.

Preview: Next.js instructions for Copilot and Next.js code review skill for Copilot.

Check that it loaded

  • In VS Code, run Chat: Open Customizations and open the Instructions tab to confirm discovery.
  • Ask a question in a new chat and expand the response's References to see which instruction files were used.
  • On GitHub.com, the reference to .github/copilot-instructions.md appears in the response's references list.

Common mistakes

  • Wrong file name. Path-specific files must end in .instructions.md and live under .github/instructions/.
  • Missing applyTo. Without it, a path-specific file has no files to match.
  • Conflicting instruction sets. Personal, repo and org instructions are all sent. Keep them consistent.
  • The same skill in .github/skills/ and .claude/skills/. Copilot reads both, so you get duplicates.

Recap

  • .github/copilot-instructions.md for repo-wide facts; .github/instructions/*.instructions.md with applyTo for scoped guidance.
  • AGENTS.md works anywhere in the repo, and the nearest one wins.
  • Skills go in .github/skills/, .claude/skills/ or .agents/skills/.
  • Check discovery in Open Customizations and inclusion in References.

Next step

Claude Code setup, or learn how AGENTS.md works across tools.