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 FileLocation & PurposeBest Use Case
copilot-instructions.mdPlaced in the .github directory.
Contains general, repository-wide rules.
General standards: flag deprecated libraries, overall code organization, team-wide policies.
NAME.instructions.mdPlaced 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 listsTrying 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

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.

Unlocking the Full Power of Copilot Code Review: A Guide to Custom Instructions Files

Author

Junido Ardalli

Publish Date

Nov 17, 2025, 03:31 PM