Path Scope Declared
Scoped .github/copilot-instructions.md files MUST include an applyTo field in their YAML frontmatter to declare which file patterns the instructions target. Without applyTo, Copilot applies the instructions globally, which defeats the purpose of scoped instruction files and can cause irrelevant guidance to appear in unrelated contexts. The slug aligns with the path-scope-declared family used by Claude (paths:) and Cursor (globs:); Copilot's frontmatter key is applyTo: per the VS Code Copilot docs.
Antipatterns
- Scoped file without
applyTo. Creating a.github/copilot-instructions.mdintended for Python files but not addingapplyTo: "**/*.py". Copilot applies the instructions to all files, including JavaScript and YAML. - Using
globsorpathsinstead ofapplyTo. These keys work for Claude Code and Cursor respectively, but Copilot only recognizesapplyTo. applyToin the wrong file. AddingapplyToto the root-level instructions file instead of a scoped variant. The root file applies globally by design.
Pass / Fail
Pass
---
applyTo: "**/*.py"
---
Use type hints on all function signatures.
Fail
Use type hints on all function signatures.
Limitations
Does not verify that the applyTo pattern targets the file types the author intended — only that the glob resolves to at least one file. Cannot detect overly broad patterns like applyTo: "**/*" that effectively disable scoping.
