GitHub Copilot instructions
.github/copilot-instructions.md gives GitHub Copilot repo-wide context — your stack, conventions, commands and don't-dos — applied automatically so you stop re-pasting setup. Add path-specific .instructions.md files (with applyTo globs) for rules that should only hit certain files.
What is the Copilot instructions file?
A Markdown file at .github/copilot-instructions.md in your repo root. Copilot reads it automatically in Chat and the coding agent for that repository and applies it as standing context. Same idea as AGENTS.md and CLAUDE.md — just the filename and location GitHub Copilot expects.
What goes in it?
- Overview + stack — what the project is, the framework, database, key libraries.
- Conventions — the decisions Copilot should follow.
- Commands — build, test, lint.
- Don't — explicit anti-patterns and off-limits areas.
Example: .github/copilot-instructions.md
# Acme Web Senior full-stack engineer. Small, reviewable diffs. ## Stack Next.js 15 (App Router), TypeScript, Tailwind, Drizzle ORM, Postgres. ## Conventions - Server components by default; "use client" only when needed. - All DB access through src/db/ (Drizzle); never raw SQL in routes. ## Commands - Build: pnpm build · Test: pnpm test · Lint: pnpm lint && pnpm typecheck ## Don't - Don't add dependencies without asking. - Don't commit secrets.
Path-specific instructions (applyTo)
For rules that should apply only to certain files, add files under .github/instructions/ with a YAML applyTo glob. The repo-wide file stays the default; these layer on top — the Copilot equivalent of Cursor's glob-scoped rules.
// .github/instructions/tests.instructions.md --- applyTo: "**/*.test.ts" --- - Use Vitest; one behaviour per test. - No snapshot tests for business logic.
How to enable
- github.com — repository custom instructions are used automatically.
- VS Code —
github.copilot.chat.codeGeneration.useInstructionFilesenables instruction files (on by default in recent versions).
Best practices
- Keep it lean + specific. Vague or contradictory instructions hurt more than help; research found bloated context files lowered task success ~3% and raised cost 20%+.
- Repo-wide vs path-specific. Put universal rules in
copilot-instructions.md; scope the rest withapplyTo. - Instructions ≠ prompt files. Instructions are always-on context;
.prompt.mdfiles are reusable prompts you invoke on demand. - One source of truth. Keep the same guidance in AGENTS.md / CLAUDE.md — generate them together so they don't drift.
Copilot instructions and the other files
Same guidance, different filenames per tool — see AGENTS.md vs CLAUDE.md for the full picture:
| File | Tool |
|---|---|
| .github/copilot-instructions.md | GitHub Copilot (repo-wide) |
| .github/instructions/*.instructions.md | GitHub Copilot (path-specific, applyTo) |
| AGENTS.md | Codex, Cursor, Aider, Cline… (28+) |
| CLAUDE.md | Claude Code |
| .cursor/rules/*.mdc | Cursor |
| GEMINI.md | Gemini CLI |
Generate Copilot instructions (and AGENTS.md, CLAUDE.md, Cursor, Gemini) — free
Fill in your project's rules once and get every file, correctly formatted, with a token-budget warning so they stay lean. No signup.
Open the Agent Memory Compiler →Keep it in sync with your work
Generated files drift the moment your project changes. In TaskPrio your rules live in one place and your agents pull them over MCP with get_next_task — the memory and the task queue become one source of truth. Edit once; every agent stays current. See the MCP queue →
FAQ
What is the GitHub Copilot instructions file?
.github/copilot-instructions.md — repo-wide context Copilot applies automatically (stack, conventions, commands, don't-dos).
How do I write path-specific instructions?
Add .github/instructions/<name>.instructions.md with applyTo: a glob in YAML frontmatter — rules apply only to matching files.
Instructions vs prompt files?
Instructions = always-on context; .prompt.md files = reusable prompts you invoke for a task.
Generate your Copilot instructions → AGENTS.md vs CLAUDE.md →