VS Code & Copilot
How custom instructions work in VS Code and GitHub Copilot. Instruction files, copilot-instructions.md, AGENTS.md, scoping with glob patterns, prompt files, and organization-level sharing.
For the official documentation, see Custom Instructions on VS Code's docs.
Custom instructions only affect chat interactions. They do not apply to inline code suggestions as you type.
How Custom Instructions Work
Custom instructions are Markdown files that get added to Copilot's context at the start of each chat. VS Code finds them automatically based on where they are stored and how they are named.
When multiple instruction files are applicable, VS Code combines them. However, the order is not guaranteed. Each instruction file should stand alone and not depend on another to load first.
Instruction File Types
VS Code recognizes four types of instruction files:
A single workspace-level file at .github/copilot-instructions.md. The easiest way to add instructions; one file applies to every chat request in your project.
This format is also recognized by Visual Studio and GitHub.com, making it the most portable option. You need to enable the github.copilot.chat.codeGeneration.useInstructionFiles setting.
Instruction File Format
Instruction files use Markdown with optional YAML frontmatter:
Frontmatter Fields
| Field | Purpose |
|---|---|
| description | Brief explanation of what the instructions cover |
| name | Display name in the UI (defaults to filename if omitted) |
| applyTo | Glob pattern that determines when instructions activate automatically |
If you exclude the frontmatter entirely, the file acts as plain Markdown instructions that apply based on file location.
Settings-Based Instructions
For specific tasks like code review or commit messages, VS Code supports instructions through settings.json:
| Task | Setting |
|---|---|
| Code review | github.copilot.chat.reviewSelection.instructions |
| Commit messages | github.copilot.chat.commitMessageGeneration.instructions |
| PR descriptions | github.copilot.chat.pullRequestDescriptionGeneration.instructions |
These can either reference external files or include inline text:
Creating Instruction Files
Open Chat Instructions
Open the Chat view, click the gear icon, and select Chat Instructions.
Create new file
Click New instruction file.
Choose storage location
Select Workspace for project-specific or User profile for personal instructions.
Write your instructions
Write your guidelines in Markdown format.
Scoping with Glob Patterns
The applyTo field lets you target instructions to specific file types or directories:
| Pattern | Targets |
|---|---|
**/*.ts,**/*.tsx | All TypeScript files |
src/components/** | Everything in the components folder |
**/*.test.* | All test files |
** | All files (always apply) |
This is useful for large codebases where different sections have different conventions, such as frontend React patterns versus backend API patterns.
Syncing and Sharing
Enable Settings Sync in VS Code and include "Prompts and Instructions" to synchronize your personal instruction files across all devices.
Writing Effective Instructions
Selling VS Code Instructions on Skly
- List "VS Code" and/or "GitHub Copilot" as supported tools so buyers can find compatible instructions.
- Use the
.instructions.mdformat since it is the most flexible, supporting targeting throughapplyTopatterns. - Include clear
applyTopatterns so buyers know which files the instructions focus on. - Keep instructions portable — plain Markdown works across multiple AI tools, not just Copilot.
- Provide a
copilot-instructions.mdversion for buyers wanting the simplest setup.
Comparison with Cursor Rules
| Feature | VS Code / Copilot | Cursor |
|---|---|---|
| File location | .github/instructions/ | .cursor/rules/ |
| Workspace file | .github/copilot-instructions.md | AGENTS.md or project rules |
| Scoping | applyTo glob in frontmatter | globs array in frontmatter |
| Intelligent matching | Not natively supported | alwaysApply: false enables AI matching |
| Inline suggestions | Not supported | Supported |
| Organization sharing | GitHub org-level instructions | Team rules via dashboard |
| AGENTS.md | Supported (experimental nesting) | Supported |
Both formats use Markdown, so rules sold on Skly can often support both tools with minimal changes.