4/6/2026
GitHub Copilot Instructions: How to Set Up .github/copilot-instructions.md
Set up GitHub Copilot instructions correctly with repository-level guidance, practical examples, and a structure that improves consistency across contributors.
GitHub Copilot follows your repository instructions only when they are specific, actionable, and maintained. A good instruction file can improve consistency across architecture decisions, naming, tests, and security handling.
Where should copilot instructions live?
The primary file is .github/copilot-instructions.md. You can also use additional instruction files for more localized scope when needed. Keep global standards in the root instruction file and add scoped instructions only for high-variance areas.
What should go into copilot-instructions.md?
Include coding standards, architecture boundaries, test expectations, and forbidden patterns. Keep statements direct and verifiable so reviewers can check output quality quickly.
Example copilot-instructions.md structure
# Repository Coding Instructions
## Architecture
- Keep business logic in lib/ and route handlers in app/api/.
- Do not couple UI components to database query logic.
## TypeScript
- Do not use the any type.
- Prefer explicit return types for exported functions.
## Testing
- Add or update tests for behavior changes.
- Keep test names behavior-oriented and deterministic.
## Security
- Never hardcode API keys or secrets.
- Validate and sanitize all user-provided input.
How often should teams update Copilot instructions?
Update instructions whenever architecture conventions, tooling, or team standards change. Treat this file as a versioned policy document reviewed in pull requests, not as static setup.
How does this compare with Cursor and Claude Code?
Copilot instructions are generally simpler and more centralized than Cursor scoped rules and Claude Code skill workflows. If your team uses multiple assistants, maintain one source policy and generate per-tool output to prevent drift.
Related reading: The Complete Guide to AI Coding Assistant Configuration
FAQ
Should I keep instructions short or detailed?
Start concise, then add detail where Copilot repeatedly violates expectations. The best files are concise but concrete.
Can one repo use both Copilot instructions and Cursor rules?
Yes. Many teams run both. The key is to keep policy intent aligned so each assistant enforces the same standards.
Need synchronized instruction files for multiple assistants? Generate them with Promptkit at /generate.