Using Custom Instructions
Custom instructions enable you to apply team-specific coding standards, best practices, and framework patterns automatically to your GitHub Copilot experience. Instructions are stored as.instructions.md files and apply contextually based on file patterns.
What are Custom Instructions?
Custom instructions are markdown files that provide guidance to GitHub Copilot for specific file types, languages, or project contexts. They help ensure:- Consistency - All team members follow the same coding standards
- Best Practices - Framework-specific patterns are automatically applied
- Quality - Code meets organizational requirements
- Context - Copilot understands your project’s unique conventions
Instructions automatically apply to Copilot’s behavior - no manual activation needed!
Installing Custom Instructions
- One-Click Install
- Manual Installation
Browse the Instructions Catalog and click the install button:
- VS Code: Click the VS Code install badge
- VS Code Insiders: Click the VS Code Insiders install badge
Instruction File Structure
Every instruction file follows this structure:Frontmatter Field Requirements
Frontmatter Field Requirements
- description (required): Wrapped in single quotes, not empty
- applyTo (required): File patterns using glob syntax (e.g.,
'**.js, **.ts') - File naming: Use lowercase with hyphens (e.g.,
csharp-coding.instructions.md)
File Pattern Matching
TheapplyTo field uses glob patterns to determine when instructions activate:
How Instructions Apply
Instructions automatically activate based on context:File Match
When you open or edit a file, Copilot checks the
applyTo pattern for all instructions in your workspace.Context Loading
Matching instructions are loaded into Copilot’s context, influencing completions and chat responses.
Common Instruction Patterns
- Language Standards
- Framework Patterns
- Security & Quality
- Project-Specific
Define coding conventions for specific languages:
Real Examples from the Repository
Here are popular instructions from awesome-copilot:Organizing Multiple Instructions
For projects with many instructions:Single File Approach
Single File Approach
Combine all instructions in Pros: Simple, one file to manage
Cons: Can become large, harder to maintain
.github/copilot-instructions.md:Cons: Can become large, harder to maintain
Multi-File Approach (Recommended)
Multi-File Approach (Recommended)
Create separate files in Pros: Organized, easier to maintain, reusable
Cons: Multiple files to track
.github/instructions/:Cons: Multiple files to track
Best Practices
Keep Instructions Focused
Keep Instructions Focused
- Create separate instruction files for different concerns
- Use specific
applyTopatterns to avoid conflicts - Keep instructions concise and actionable
- Avoid duplicating framework documentation
Make Instructions Actionable
Make Instructions Actionable
Good:Bad:
Version-Specific Guidance
Version-Specific Guidance
When referencing frameworks, specify versions:
Creating Your Own Instructions
To create custom instructions for your team:Identify patterns
Review your codebase and identify common patterns, conventions, and frequently violated rules.
Troubleshooting
Instructions not applying
Instructions not applying
- Verify file is in
.github/instructions/or.github/copilot-instructions.md - Check
applyTopattern matches your files - Ensure frontmatter YAML is valid
- Reload VS Code window
Conflicting instructions
Conflicting instructions
- More specific
applyTopatterns take precedence - Later instructions override earlier ones
- Consider combining related instructions
Related Resources
- Browse All Instructions
- Custom Agents - Specialized AI personas
- Agent Skills - Self-contained capabilities
- Contributing Guide