r/GithubCopilot • • 12h ago

General Making Copilot output consistent across a team: build a harness, not better prompts

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.)

0 Upvotes

9 comments sorted by

4

u/Huge_Lettuce_3794 11h ago

You just described how to automatically inject instructions into prompts. But still they are just prompts.

6

u/AfterICooked 11h ago

What you’re describing isn’t a harness

2

u/bugtank 11h ago

Where do you run the reviewer agent?

2

u/AfterICooked 9h ago

No self-promotion allowed. Nobody cares about your hands-on workshop and if this slop post is any indication of the quality of its content, you’re better off using your tokens to learn how to market yourself in a less offensive way 

2

u/Pixelplanet5 11h ago

what a stupid karma farming bot, all of the content he posts on random subreddits every few minutes is AI generated slop

1

u/Any-Blacksmith-2054 11h ago

Why so complicated? I just put to agents.md