Sign in with Google

How to Use GitHub Copilot Without Losing the Plot

Turn it on, learn four keys, and build the habit that keeps its suggestions honest.

intermediate10 min read
ai-toolsgithub-copilotvs-codeai-codingdeveloper-tools

Copilot is the first AI tool most developers install and the first one most people misuse. The problem is not that it writes bad code — it writes plausible code very fast, which is worse, because plausible code you accepted without reading is a bug you own and cannot explain. This guide covers turning it on, the keys that make it useful, the one habit that improves its output most, and the discipline that keeps it from stalling your learning.
iWhat you need
A recent build of VS Code (Copilot supports several other IDEs — see GitHub's docs for the current list), a GitHub account, and about 30 minutes. Copilot Free gives you a monthly allowance of inline suggestions and AI credits with no card attached — enough for everything here. Paid tier names and limits change often, so check GitHub's plans page rather than a number you read somewhere.
Two products share one name. The first is inline suggestion: an autocomplete trained on an enormous amount of public code, proposing the next few lines in grey ghost text as you type. A companion feature, next edit suggestions, predicts where your next edit belongs rather than only what follows the cursor. The second is Copilot Chat — a sidebar you ask questions in — plus an agent mode that edits across files and runs commands on its own.
What it is not: a compiler, a reviewer, or a source of truth. It has no idea whether your program works. It predicts text that looks like code somebody would plausibly write next here, and "looks right" and "is right" come apart constantly. The useful mental model is a fast, confident, slightly out-of-date colleague who never says "I'm not sure."
Copilot's AI features are built into current VS Code releases — there is no marketplace hunt anymore. If you are on an older build you will see older UI and older extension names, so update before anything else.

Getting signed in

  1. 1Update VS Code to the latest release. Copilot's surface changes monthly and stale builds show stale menus.
  2. 2Hover the Copilot icon in the Status Bar along the bottom of the window and choose Use AI Features.
  3. 3Pick a sign-in method and follow the prompts in your browser. If your employer uses GitHub Enterprise, choose Continue with GHE.com instead.
  4. 4With no paid plan you land on Copilot Free, which uses automatic model selection and a fixed monthly allowance.
  5. 5Open any code file and type. Grey text ahead of your cursor means it is working.
!The Status Bar icon is the ground truth
A slash through the Copilot icon means suggestions are off for this file or language. That happens deliberately in some repositories through content exclusions, and accidentally whenever you toggle it and forget. Check the icon before concluding Copilot is broken.
Four keys carry almost all of the day-to-day work. Learn them properly, because the difference between a good and a bad Copilot habit is mostly which key you reach for.

The keys worth memorizing

  1. 1Tab accepts the whole suggestion. It also jumps to and accepts a next edit suggestion elsewhere in the file, which is why an arrow sometimes appears in the gutter.
  2. 2Escape dismisses the suggestion and leaves your code untouched.
  3. 3Cmd+Right Arrow on macOS, or Ctrl+Right Arrow on Windows and Linux, accepts one word or line at a time. The underrated one.
  4. 4Hover the ghost text to see Copilot's alternative suggestions and step between them.
  5. 5Cmd+Ctrl+I on macOS or Ctrl+Alt+I on Windows opens the Chat view; Cmd+I or Ctrl+I opens inline chat right at your cursor.
  6. 6Shift+Cmd+I on macOS or Ctrl+Shift+I on Windows switches to agents, which edit across multiple files at once.
Partial accept deserves the emphasis. An all-or-nothing Tab habit trains you to take things you only half agree with, because rejecting means retyping the good part by hand. Accepting word by word keeps you steering, and — not incidentally — keeps you reading.
This is the highest-leverage habit available and almost nobody does it. Suggestion quality is a function of the context Copilot can see: your surrounding code, your open tabs, and above all the few lines immediately before the cursor. Type a bare function name and wait, and you get a generic guess. State the contract first and you get something close to usable.
python
# weak — Copilot guesses at everything
def parse_date(s):
    

# strong — the contract is stated
def parse_date(s: str) -> datetime | None:
    """Parse an ISO-8601 date string, assuming UTC when no zone is given.

    Returns None for empty or unparseable input.
    Never raises — callers check for None.
    """

The same function, two amounts of context

Every clause in that docstring is a constraint Copilot will honor: the return type, the None-on-failure convention, the promise not to raise. Writing it takes fifteen seconds and it is work you owed the codebase anyway. The principle runs in reverse too — when suggestions are consistently poor in one file, the fix is rarely a better chat prompt. It is opening the file that defines your types so it lands in context.
Copilot Chat earns its keep on tasks where being wrong is cheap and verification is immediate. Four of those come up constantly.
  1. 1Explaining unfamiliar code. Select a block, open inline chat, ask what it does and why, then check the explanation against the code — the fastest way to orient in a codebase you did not write.
  2. 2Explaining an error message, stack trace pasted in raw. Often right, and when wrong you find out in seconds by trying the fix.
  3. 3Naming and small refactors, which are low-risk because you review the diff regardless.
  4. 4Writing tests for code you already understand. Read each test and ask whether it would fail if the code were broken. A surprising number assert things that cannot fail.
Never ask it to test code you do not understand
That is the one combination that reliably produces confident nonsense you have no way to detect. If you cannot state what the function should do, you cannot tell a real test from a tautology — and you end up with a green suite that proves nothing at all.

What actually goes wrong

  1. 1Plausible-but-wrong code: off-by-one errors, inverted conditions, the wrong variable of the right type. GitHub's own docs say suggestions may appear valid without being semantically or syntactically correct.
  2. 2Invented API methods. It will confidently call a method that does not exist on that library, because one by that name exists on a similar library. The most common wasted hour.
  3. 3Silently outdated patterns. It learned from a great deal of old code, so deprecated APIs and abandoned libraries arrive looking current.
  4. 4Insecure defaults: string-concatenated SQL, missing input validation, credentials pasted into source. Nothing in the loop checks for that.
  5. 5Suggestions matching public code verbatim. A duplicate-detection filter can block or annotate those, depending on your plan and organization settings.
  6. 6The learning trap, which is the expensive one.
The learning trap deserves its own paragraph because it does not feel like a failure. Accepting suggestions you cannot explain produces working software for weeks, and it feels exactly like getting better. Then something breaks in code you nominally wrote and you find you have no model of it — no idea which part to suspect. The productivity was real; the skill was not.
None of this argues for switching Copilot off permanently. It argues for four rules that trade a little speed now against the trap later.
  1. 1Read every suggestion before pressing Tab. Every one. If that feels slow, the slowness is the real cost of the tool — still cheaper than debugging code nobody understands.
  2. 2Delete anything you cannot explain out loud. Not "I think it sorts the list" — what it sorts, in what order, and what it does with an empty list.
  3. 3Write your own tests by hand for the first few months. The test is where you state what you meant; outsourcing it outsources the only part that was yours.
  4. 4Once a week, switch Copilot off and do one small task from scratch. If that feels impossible you have learned less than you think, and a practice task is a cheap place to find out.
For inline suggestions, the code around your cursor is combined with contextual information — including snippets from your other open tabs — and sent to a model as a prompt. Read that carefully: "open tabs" is broader than people assume, and a config file with live credentials in a background tab is inside the blast radius.
  1. 1Close tabs holding secrets, customer data, or anything under NDA before working with Copilot enabled.
  2. 2Use content exclusions if you administer the repo or organization — they stop specific paths being used as context at all.
  3. 3Check whether your plan uses prompts and suggestions for model training. Individual and business terms differ; the toggle is in your Copilot settings.
  4. 4Switch it off for cryptography and authentication, where a plausible-looking mistake is expensive rather than annoying.
  5. 5Switch it off while learning a new language's fundamentals. Ghost text finishing your sentences is what stops the syntax sticking.

Symptom, cause, fix

  1. 1No ghost text at all. Copilot is disabled for this language or file. Click the Status Bar icon, check the per-language toggle, then look for a repository content exclusion.
  2. 2Suggestions are generic and useless. Not enough context. Open the relevant type definitions in tabs and write a signature or contract comment before the cursor.
  3. 3It calls a method that does not exist. It pattern-matched a similar library. Open that library's real docs and check the method list — faster than arguing with chat.
  4. 4Tab inserts a literal tab. Another extension or snippet is claiming the key. Open Keyboard Shortcuts and search for conflicts on Tab.
  5. 5You hit a limit mid-task. Copilot Free has a fixed monthly allowance. Wait for the reset or review the current tiers; the editor keeps working either way.
  6. 6Chat ignores your project's conventions. It cannot see conventions you never wrote down. Add a custom instructions file so your standards ride along with every request.
  7. 7Agent mode changed more files than expected. You accepted a diff you did not read. Commit before every agent run so one Git command puts you back.
Copilot is the conservative end of AI-assisted coding: it suggests, you accept. The aggressive end hands the AI your whole repository, a different skill with different risks — How to Use Cursor, the AI Code Editor and How to Use Claude Code cover that shift, and both assume the review discipline from this guide. Since most of Copilot's value comes from the context you hand it, How to Write Better AI Prompts transfers directly, and How to Fact-Check AI Answers generalizes the invented-method problem to every claim a model makes. For the whole progression, the Leveraging AI roadmap sequences these tools alongside the judgment to use them well.