Path-specific Copilot custom instructions: how to scope rules to files in a repo

Teams often put every Copilot rule into one repository file, so unrelated guidance applies everywhere and the output gets noisy. The article proposes splitting rules into small files under .github/instructions/, each scoped to matching files via glob patterns like applyTo. It explains the three kinds of repository instructions: repository-wide, path-specific, and agent files such as AGENTS.md. Support differs by environment, since path-specific files are not read by every Copilot surface, such as VS Code code review or the JetBrains chat. The author demonstrates a setup for a fictional TypeScript bike-rental repo and includes a script that detects broken glob patterns.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in