Skip to main content
COPILOT:S:0001 mechanical high structure copilot

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.md intended for Python files but not adding applyTo: "**/*.py". Copilot applies the instructions to all files, including JavaScript and YAML.
  • Using globs or paths instead of applyTo. These keys work for Claude Code and Cursor respectively, but Copilot only recognizes applyTo.
  • applyTo in the wrong file. Adding applyTo to 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.