Only your database migration folder needs special rules. What fits?
Why B is the answer
A path-specific NAME.instructions.md file under .github/instructions
Path-specific instructions target matching files, which keeps rules out of the context when they do not apply.
In detail
- A path-specific NAME.instructions.md file applies only to matching paths.
- This keeps irrelevant rules out of the context.
Use case
An illustrative scenario, not a real incident.
Only migrations need a rule about reversible changes. A path-specific instructions file applies it there, so other folders stay free of it.
See it in different ways
flowchart TD
A{"What do you need?"} -->|"Rules for the whole repo"| B[".github/copilot-instructions.md"]
A -->|"Rules for some paths"| C[".github/instructions/NAME.instructions.md"]
A -->|"Rules for agents"| D["AGENTS.md"]
A -->|"A task you start yourself"| E["Prompt file"]mindmap
root((Instructions))
Repository wide
copilot-instructions.md
One path
NAME.instructions.md
Agents
Nearest AGENTS.md
Chosen by hand
Prompt filesflowchart TD
Q{"Where does the rule apply?"}
Q -->|"Everywhere"| A0["copilot-instructions.md"]
Q -->|"One folder"| A1["NAME.instructions.md"]Key point: Path-specific files target matching files.
Why the other options are wrong
- A. A personal instructions file in each developer's home directory
- A personal file is not shared with the team.
- C. A separate repository holding only the migration folder and its rules
- A separate repository is far more than this needs.
- D. A longer repository-wide instructions file covering every folder equally
- That adds irrelevant rules to every other folder.

