SklyDocs

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.

copilot-instructions.md

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:

---
description: "Standards for React frontend components"
name: "React Guidelines"
applyTo: "src/components/**/*.tsx"
---

# React Component Standards

- One component per file
- Use named exports
- Co-locate styles and tests
- Use functional components with hooks

Frontmatter Fields

FieldPurpose
descriptionBrief explanation of what the instructions cover
nameDisplay name in the UI (defaults to filename if omitted)
applyToGlob 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:

TaskSetting
Code reviewgithub.copilot.chat.reviewSelection.instructions
Commit messagesgithub.copilot.chat.commitMessageGeneration.instructions
PR descriptionsgithub.copilot.chat.pullRequestDescriptionGeneration.instructions

These can either reference external files or include inline text:

{
  "github.copilot.chat.reviewSelection.instructions": [
    { "file": "guidance/review-guidelines.md" }
  ],
  "github.copilot.chat.commitMessageGeneration.instructions": [
    { "text": "Use conventional commits format. Keep subject under 72 chars." }
  ]
}

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:

PatternTargets
**/*.ts,**/*.tsxAll 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.md format since it is the most flexible, supporting targeting through applyTo patterns.
  • Include clear applyTo patterns 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.md version for buyers wanting the simplest setup.

Comparison with Cursor Rules

FeatureVS Code / CopilotCursor
File location.github/instructions/.cursor/rules/
Workspace file.github/copilot-instructions.mdAGENTS.md or project rules
ScopingapplyTo glob in frontmatterglobs array in frontmatter
Intelligent matchingNot natively supportedalwaysApply: false enables AI matching
Inline suggestionsNot supportedSupported
Organization sharingGitHub org-level instructionsTeam rules via dashboard
AGENTS.mdSupported (experimental nesting)Supported

Both formats use Markdown, so rules sold on Skly can often support both tools with minimal changes.

Learn More