When Copilot writes code that looks right but fails review, the usual reaction is to write better prompts. That doesn't scale across a team, because every developer prompts differently. What does scale is a harness: repo-level context that Copilot applies every time, plus a reviewer that checks its work. Here's the structure.
1. Repository-wide instructions
.github/copilot-instructions.md holds the things every change must respect: logging format, error handling, test expectations, and the libraries you do and don't use. Keep it short and concrete. "Use structured JSON logs with a correlation ID on every request" works. "Write clean code" does nothing.
2. Path-specific instructions
Rules that only apply to part of the repo go in .github/instructions/*.instructions.md, scoped with an applyTo glob. Infrastructure, API handlers and tests usually need different rules, and putting them all in one file dilutes every one of them.
3. Prompt files for repeated tasks
If people keep asking for the same thing ("add an endpoint with tests and logging"), turn it into a reusable prompt file in .github/prompts/. Everyone then gets the same structure.
4. A reviewer agent before anything ships
A custom agent with one job: review Copilot's output the way your SRE would. Does it log enough to debug at 3 a.m.? Does it have timeouts on external calls? Are memory-heavy paths bounded? It catches the "works locally, fails in prod" class of problems before they leave the branch.
5. Start from a spec
Agent mode does much better with a short written spec (behaviour, edge cases, what to log, what to test) than with a one-line ask. The spec also becomes the reviewer's checklist.
The payoff: reviewers stop rewriting Copilot's output by hand, and new team members get the same standards without reading a wiki.
What's in your copilot-instructions.md that made the biggest difference?
(Disclosure: I work with Build with AI by Packt, which runs a hands-on workshop on this with Microsoft architect Albert Tanure. Details in the comments.)