Repository-level Copilot instructions
Repository-level Copilot instructions live at.github/copilot-instructions.md. Adding this file lets you define project-specific coding standards (style, naming, import order, docstrings, etc.) that GitHub Copilot will consult when generating completions and Chat responses.
Place the file at
.github/copilot-instructions.md in your repository root so GitHub Copilot can find it automatically..github/copilot-instructions.md. A practical sample that instructs Copilot to follow PEP 8 and common Python best practices:
Example: PEP 8–compliant function
An example function that follows the guidelines above:How Copilot uses repository instructions
- Copilot consults
.github/copilot-instructions.mdto shape generated code, including docstrings, naming, formatting, and import order. - The instructions are most effective for Chat completions and for full-file or multi-line completions. Inline suggestions may still deviate.
- If a completion doesn’t meet your standards, use Copilot Chat or the Completions panel to get more controlled outputs.
Testing with Copilot Chat
Open Copilot Chat in your editor and prompt it to generate a function or module. Chat often respects docstrings, typing, and other rules from the repository instructions. Example produced by Copilot Chat (adhering to the instructions):
Common Copilot commands and IDs
Use the table below to quickly map common Copilot UI commands to their command palette IDs (useful for customizing keybindings or automation):Model selection and editor context

- Copilot can run on different underlying models. If available, you can change the model from the Copilot pane — model choice affects style, reasoning, and cost.
- Try a few models to determine which produces the most useful, concise, or explainable output for your workflow.
- Always ensure the file you want help with (for example,
main.py) is active — Copilot uses open files and editor context to form suggestions.
- The Copilot context window is finite. Opening many files or working in very large repositories increases the visible context and may dilute suggestion quality.
- Best practice: close unrelated files and open only the files relevant to your current task. This keeps the editor context focused and helps Copilot produce more relevant suggestions.
Best practices summary
- Add
.github/copilot-instructions.mdto define project-specific rules. - Keep your editor focused on the current file(s) to reduce noisy context.
- Use Copilot Chat and the Completions Panel when you need more structured, multi-line, or documented outputs.
- Customize keybindings for faster acceptance and navigation of suggestions.
Do not store secrets or sensitive data in
.github/copilot-instructions.md. This file is a repository asset and will be visible to collaborators — treat it like other repository configuration files.Next steps
With repository-level instructions and a focused editor context, you can:- Use comment-driven development to generate functions, docstrings, and tests.
- Ask Copilot Chat to scaffold modules or sample data generators.
- Iterate on the repository instructions over time to tune the style and constraints Copilot follows.