Skip to main content
In this guide, we’ll explore six strategies to configure GitHub Copilot for immediate productivity improvements:
  1. File-Based Configuration
  2. Testing in main.py
  3. Using the Completions Panel
  4. Keyboard Shortcuts
  5. Switching AI Models
  6. Managing Context Windows

1. File-Based Configuration

Store custom instructions at the repository root to steer Copilot’s code generation.
Anything you add to copilot-instructions.md will shape Copilot’s output. For example, to enforce PEP 8 in Python:
The image shows a code editor with a markdown file open, containing instructions for GitHub Copilot to follow PEP8 Python coding standards. The text includes guidelines on indentation, line length, naming conventions, and import statements.
With these guidelines, Copilot will generate clean, compliant code:
Well-defined instructions ensure consistent, high-quality suggestions across your team.

2. Testing in main.py

Validate that Copilot respects your file-based configuration:
Trigger Copilot and you may see:
If the generated code doesn’t match your standards, retry or use Copilot Chat for better fidelity.

3. Using the Completions Panel

The Completions Panel lets you review multiple suggestions side-by-side:
  1. Open with the Copilot icon or run GitHub Copilot: Open Completions Panel.
  2. Enter your prompt, e.g.:
  3. Compare suggestions and pick the one that aligns with your style.

4. Keyboard Shortcuts

Master these keybindings to speed up your workflow:
The image shows a list of keyboard shortcuts for GitHub Copilot in a code editor, with commands, keybindings, and conditions for their use. A cursor is pointing at one of the keybindings.
(On Windows/Linux, replace ⌥ with Alt.)

5. Switching AI Models

Different Copilot models excel at different tasks. Click the model selector in the lower-right corner to choose: For more details, see the GitHub Copilot Models.

6. Managing Context Windows

Copilot’s suggestions depend on the active context. Keep only your current files open to maintain focused and relevant completions.
Closing inactive tabs prevents context dilution and improves suggestion accuracy.

In this lesson, we covered:
  • Defining file-based instructions
  • Verifying behavior in main.py
  • Leveraging the Completions Panel
  • Memorizing keyboard shortcuts
  • Selecting the optimal AI model
  • Managing editor context
Next up: Comment-Driven Development and building a Fake Data Generator.

Watch Video