Verified against GitHub Copilot Chat · 2026-07-20
Write a .github/copilot-instructions.md file Copilot actually follows
A repository-wide custom-instructions file that Copilot loads automatically into every Chat request, code-review pass, coding-agent session, and commit or PR-description generation in this repo, written so each rule holds up standing alone instead of only in the context it was written in.
The prompt
Ready to copy — highlighted parts are example details you can swap.
# Repository custom instructions for GitHub Copilot # Save as .github/copilot-instructions.md at the repo root. Copilot loads this automatically into # every Copilot Chat request, every automated code-review pass, every coding-agent session, and # every commit-message and pull-request-description generation in this repository — you never # retype any of it per conversation. ## What this project is tools.scult.in — Next.js 15 App Router, TypeScript strict mode, Tailwind CSS, Biome for lint and format ## Conventions Copilot must apply by default, unprompted - Prefer named exports over default exports. - Co-locate component tests next to the component, not in a separate __tests__ tree. - Use the existing cn() helper for conditional class names, never template-literal concatenation. ## Patterns to reject outright, not just discourage - Never use the any type without a comment justifying it. - Never add a new npm dependency without flagging it in the PR description first. ## What matters most when Copilot is reviewing a change here Accessibility of any new UI component, and whether new API routes validate input with a schema before touching the database. ## Generated or vendored paths these rules do not govern .next/, coverage/, and any *.generated.ts file — build output and generated code, not hand-written source. Copilot has no built-in way to scope this particular file to a subdirectory, so say explicitly which paths sit outside these rules rather than letting a convention written for hand-authored source code get silently applied to a generated lockfile, a vendored dependency, or a build output directory where enforcing it would be actively wrong rather than merely unhelpful. ## Interaction with path-scoped instructions If a more specific .github/instructions/*.instructions.md file elsewhere in this repo also applies to the code Copilot is currently touching, both files are added to context together — this file's rules and the path-scoped file's rules combine, they do not override each other. Do not repeat a rule here that a path-scoped file already states more precisely for its own directory; repeating the general version at the repo-wide level only means it wins the reader's attention first, which defeats the reason the narrower file exists at all. ## How to write every rule above Each line here gets re-checked and re-applied on every single request Copilot handles in this repository, with no surrounding conversation available to disambiguate it — write every rule so it holds standing alone, never only in combination with a sentence written three lines above it. Prefer one short declarative sentence over a paragraph of context: 'Never use the any type without a comment justifying it' is a rule Copilot can check itself against; 'we try to keep things reasonably well typed' is not, because there is no failing case it actually rules out. If a convention only makes sense with an example, give the example in the same bullet, not as a separate note two sections away that a single-request read might never reach in combination. ## Maintenance The first time Copilot suggests something that directly contradicts a rule in this file, treat that as a signal the rule is unclear or missing a case, not a one-off mistake to wave off — add the missing case immediately, in the same session, rather than filing it away to fix later. A rule that has quietly stopped being true and is never removed is worse than no rule at all, because every future session trusts it by default without re-verifying it against the current code.
Customize
Optional — swap in your own details for the highlighted parts above.
Why this works
A .github/copilot-instructions.md file is loaded automatically into context for every Copilot Chat request, every automated code-review pass, every coding-agent session, and every commit-message and pull-request-description generation in that repository — unlike a rule typed into one chat, which is scoped to that single conversation and gone the moment it ends. This is also the file the coding agent reads before it starts working on an assigned issue, so a constraint written here bounds its autonomous behavior on a PR you never watched it write, not just its behavior in an interactive chat you are present for. GitHub's own guidance for this file is explicit that short, specific, self-contained statements apply more consistently than long prose, because Copilot has to re-derive the applicable rule from the instructions file plus the current task on every single request — a rule that only makes sense in combination with another sentence three lines up gets dropped more often than one that stands alone. The maintenance discipline matters for a related reason: because this file is trusted by default on every future session without re-verification, a stale claim does not just mislead one conversation, it silently misleads every session for as long as it stays uncorrected, which is why treating a contradicted rule as a signal to fix immediately — rather than a one-off mistake — is the only way the file stays worth trusting months later. Finally, understanding that path-scoped instructions combine with this file rather than override it changes how you should actually write repo-wide rules: a rule repeated at both levels does not get resolved by precedence, it just adds noise, so the repo-wide file should state what is true everywhere and leave the narrower exception to the file whose whole job is stating it precisely.
Verified against
GitHub Copilot Chat Copilot Chat 1.269 (VS Code) · 2026-07-20
GitHub Copilot coding agent GA release, 2026-06 · 2026-07-21
Changelog
- 2026-07-21 — Initial publish, verified against Copilot Chat 1.269 (VS Code) and the Copilot coding agent.
Need this built into your business?
If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.
EXPLORE CUSTOM SOFTWARE
