Path: blob/main/extensions/copilot/assets/prompts/skills/agent-customization/references/instructions.md
13405 views
File-Specific Instructions (.instructions.md)
Guidelines loaded on-demand when relevant to the current task, or explicitly when files match a pattern.
Locations
| Path | Scope |
|---|---|
.github/instructions/*.instructions.md | Workspace |
<profile>/instructions/*.instructions.md | User profile |
Frontmatter
Discovery Modes
| Mode | Trigger | Use Case |
|---|---|---|
On-demand (description) | Agent detects task relevance | Task-based: migrations, refactoring, API work |
Explicit (applyTo) | Files matching glob in context | File-based: language standards, framework rules |
| Manual | Add Context → Instructions | Ad-hoc attachment |
Template
Note the "Use when..." pattern in the description—this helps on-demand discovery.
Explicit File Matching (optional)
Use applyTo when the instruction applies to specific file types or folders:
Applied when creating or modifying matching files, not for read-only operations.
Core Principles
Keyword-rich descriptions: Include trigger words for on-demand discovery
One concern per file: Separate files for testing, styling, documentation
Concise and actionable: Share context window—keep focused
Show, don't tell: Brief code examples over lengthy explanations
Anti-patterns
Vague descriptions: "Helpful coding tips" doesn't enable discovery
Overly broad applyTo:
"**"with content only relevant to specific filesDuplicating docs: Copy README instead of linking
Mixing concerns: Testing + API design + styling in one file