GitHub Copilot Code Review (CCR) is a powerful tool for automating code quality checks and enforcing team standards. To make it review code consistently and effectively, you need to guide it with well-crafted custom instruction files.
GitHub now supports both a centralized repository-wide file and path-specific instruction files, giving you granular control over Copilot’s behavior. This guide shows you exactly how to write instructions that actually work — and how to avoid the most common pitfalls.
1. The Strategy: Centralized vs. Path-Specific Files
| Instruction File | Location & Purpose | Best Use Case |
|---|---|---|
| copilot-instructions.md | Placed in the .github directory.Contains general, repository-wide rules. | General standards: flag deprecated libraries, overall code organization, team-wide policies. |
| NAME.instructions.md | Placed in the .github/instructions directory.Uses applyTo frontmatter to target specific paths. | Specific rules: language conventions (**/*.ts), framework guidelines, security policies for certain directories. |
Tip: Split different topics (security, testing, style) into separate *.instructions.md files — it’s much easier to maintain and iterate.
2. General Best Practices for Effective Prompts
| Do This (Best Practices) | Avoid This (Common Pitfalls) |
|---|---|
| Be concise — short, focused rules Start small and iterate | Vague directives (“be more accurate”, “find all bugs”) |
| Use clear headings (##) and bullet/number lists | Trying to change comment formatting (font, headers, etc.) |
| Be direct and imperative (“Prefer X over Y”) | External links — Copilot can’t follow them |
| Include code examples (correct vs incorrect) | Asking Copilot to block merges or modify PR overview |
3. Recommended Instructions File Structure
Copy-paste this template into any *.instructions.md file:
# [Your Project/Topic Title Here]
# Example: Python Code Style for Backend Services
## Purpose & Scope
Briefly describe what this file covers and which code it applies to.
---
## Naming Conventions
- Use snake_case for functions and variables
- Use PascalCase for classes
## Code Style
- Indent with 4 spaces
- Maximum line length: 100 characters
## Error Handling
- Always catch specific exceptions, never bare `except:`
## Testing
- Every new feature must have corresponding unit tests
- Test files must be named `test_*.py`
---
## Code Examples
```python
# Correct
def calculate_total(items):
return sum(item.price for item in items)
# Incorrect
def CalculateTotal(Items):
return sum(Items)
### Get Started
The fastest way to begin:
* Create `.github/copilot-instructions.md` for repo-wide rules, or
* Create files inside `.github/instructions/` for path-specific rules.
* Pro tip: Ask the **Copilot Coding Agent** on the GitHub Agents page to generate or refine these files for you — it already knows the best practices!
Master these instruction files and you’ll turn Copilot Code Review from a generic AI helper into a disciplined, specialized teammate that enforces _your_ exact standards — every single time.Explore the Latest World of Technology.
Android
cross-device
file-explorer
phone-link
photos-tab
tech-news
windows-android
automation
bash-scripting
command-line
cron-jobs
file-permissions
linux-skills
terminal
vim
android-2026
android-security
apk-install
developer-verification
experienced-user
foss
google-play
open-source
sideloading
appimage