Rules (custom instructions)
By the end of the modes chapter you had a habit you’d grown tired of. Every time you wanted Copilot’s first draft to already fit a repo — orders-service’s sort idiom, the way each shared-lib file is laid out — you typed it out by hand. “Match the existing style.” “Use the audit helper the way the other events do.” “Sort the way this file already sorts.” It worked, but you were saying the same things on every request, and the moment you forgot, Copilot guessed — and guessed differently than your team would.
That repetition is the signal this chapter answers. The conventions aren’t changing between requests; you are re-typing them between requests. Write them down once, in a file Copilot reads automatically, and they stop being something you remember to say and become something the tool already knows.
What rules fix
Section titled “What rules fix”A rules file is persistent context. Instead of living in your head and getting re-typed into the chat, your conventions live in a file in the repo, and Copilot pulls them into the conversation on its own — every request, no reminder. The payoff isn’t that Copilot gets smarter. It’s that its first draft lands closer to mergeable, because the things it used to guess are now stated. Less back-and-forth, fewer “actually, we do it this way” corrections, more diffs that pass review on the first read.
And because you inherited two repos with two sets of baked-in conventions, you’ll write rules for each — and discover that shared-lib, the library a dozen services depend on, needs stricter, more specific rules than your own squad’s app.
The lessons
Section titled “The lessons”This chapter walks from the simplest rules file to the judgment of what belongs in one:
- Repo-wide instructions with copilot-instructions.md — the single always-on file. Write one for
orders-service. - The bridge — AGENTS.md and CLAUDE.md — Copilot reads the same convention file the Claude Code and Codex courses had you write. No rewrite. This is the chapter’s signature idea.
- Path-specific rules with applyTo — give
shared-lib’s helpers stricter rules than the rest of the repo, scoped by file path. - How rules layer — personal, repo, organization — what wins when rules collide, and one precise thing about org rules that trips people up.
- What earns a place in the file — the judgment: which conventions are worth writing down, and which just bloat the file.
Start with the file every surface supports. Repo-wide instructions with copilot-instructions.md.