Tutorial

GitHub Copilot Advanced Guide

Move beyond autocomplete and unlock Copilot's full potential

Invalid Date
min read

Advanced GitHub Copilot

Most developers use GitHub Copilot simply as a glorified autocomplete. But with the introduction of Copilot Chat and advanced context gathering, it is much more.

Context is King

Copilot looks at your open tabs. If you want Copilot to write a test for utils.js, you must have utils.js open in an adjacent tab. Pro Tip: Always keep the files relevant to your current task open in your editor, and close the ones that aren't.

Using Comments to Drive Architecture

Don't just write code. Write out the logic in plain English comments first.

// 1. Fetch user data from the /api/users endpoint
// 2. Filter out users who are inactive
// 3. Sort the remaining users alphabetically
// 4. Return the top 10 users

Press enter after writing these comments, and Copilot will generate the exact code needed, step-by-step.

Copilot Chat Commands

Use slash commands in the Copilot Chat panel to speed up your workflow:

  • /explain: Explain how the highlighted code works.
  • /fix: Propose a fix for the bugs in the highlighted code.
  • /tests: Generate unit tests for the selected code block.