← Back to Main Page

Guide Your AI with copilot-instructions.md

Posted on Sep 26, 2025

Usage

Consistency is tough on a team, code style, naming rules, or how to handle comments can easily drift.
That’s where the copilot-instructions.md file comes in. By placing this file at the root of your repo, you can guide GitHub Copilot with project specific rules, so it generates suggestions that fit your team’s standards automatically.

ProTip
Set the Ground Rules Once, Then Let GitHub Copilot Follow Them
Instead of reminding GitHub Copilot in every prompt, define your preferences once in copilot-instructions.md.
Copilot reads the file for context when making suggestions.
Try These Approaches

1️⃣ Standardize Naming Conventions
# copilot-instructions.md
Use camelCase for variables, PascalCase for classes, and ALL_CAPS_WITH_UNDERSCORES for constants.

GitHub Copilot will generate names that match the pattern, reducing cleanup later.

2️⃣ Document Style Choices
# copilot-instructions.md
Use JSDoc format for function documentation. Each function must include parameters, return type, and one example.

Copilot will produce docstrings in the right style without you prompting each time.

3️⃣ Add Security or Performance Notes
# copilot-instructions.md
Never log sensitive data such as passwords, API keys, or tokens. Always use async/await for database calls.

Helps prevent risky or outdated patterns from creeping into code.

🔑 Now That You’ve Created Instructions: How to Apply Them
Extra Ideas to Try
Quick Takeaway

The copilot-instructions.md file is like a style guide that GitHub Copilot actually listens to.
Define your rules once, drop the file into your repo, and Copilot will follow them automatically.