GitHub Copilot is a great AI coding assistant, but you can make it even better by adding custom instructions. These let you guide Copilot to follow your project’s standards, best practices, and preferences automatically. I use Visual Studio Code mostly and have seen these files help myself and my team.
How It Works
- Create a file: .github/copilot-instructions.md in your repository root for project-wide guidance.
- For more targeted rules: Add .instructions.md files in .github/instructions/ with YAML frontmatter (e.g., applyTo: “**/*.ts”) to apply to specific files or paths.
- Copilot uses these in chat, completions, code reviews, and agents—no need to repeat instructions.
---
applyTo: ".github/workflows/*.yml"
description: Best practices for GitHub Actions workflows in this project
---
Community Resource: Awesome Copilot
Check out the official community repo for ready-made examples: https://github.com/github/awesome-copilot/tree/main/instructions
It includes instructions for many languages (Python, Java, TypeScript, etc.), frameworks (React, Next.js, Spring Boot), DevOps tools (Terraform, GitHub Actions), best practices (security, performance), and more. Copy, adapt, or contribute your own!