GitHub Copilot 101Beginner12 min

Setup and Your First Suggestions

Get GitHub Copilot working in VS Code, then learn the habit that makes it safe: treat every inline suggestion as a draft you accept, edit, or reject against explicit acceptance criteria.


What you'll learn

  • Confirm your Python runtime works before you blame Copilot
  • Connect Copilot to VS Code without chasing release-specific menu labels
  • Judge an inline suggestion against acceptance criteria, not appearances
  • Reject, edit, and retest a completion until it satisfies the contract
On this page

You install the extension, the Copilot icon appears, and a gray suggestion arrives while you type. It's easy to press Tab and keep moving. Pause there. The icon tells you the extension connected. It says nothing about whether the suggestion is correct.

First, rule out a simpler problem. If the program won't run, find out whether Python is working before you start troubleshooting Copilot. The two problems have different fixes.

Check the runtime before Copilot

Open a terminal and run python --version. If that command isn't found, try python3 --version. You're ready when either one prints a Python 3 version. Write down which command worked, because you'll use it for the rest of this module. If neither works, install Python 3 through your operating system's normal software channel, reopen the terminal, and check again.

Now prove the runtime works end to end. Create runtime-check.py with one line that prints a message, then run it with the command that worked. Seeing the message confirms that Python can execute your file. If the later exercise fails, you can investigate the code, prompt, or Copilot setup without wondering whether the runtime was broken from the start.

You don't need a paid plan to start

As of mid-2026, Copilot Free costs $0 and includes up to 2,000 code completions per month, more than enough for this lesson. If your organization supplies Copilot, sign in with the account it granted access to. A successful sign-in with a different account does not mean that account has a Copilot entitlement.

Connect Copilot to VS Code

Button names, extension packaging, and menu positions move between releases. A screenshot can become stale quickly. Follow the onboarding path shown by the VS Code version in front of you.

Open VS Code, open its extension or Copilot-onboarding interface, and find the GitHub-published Copilot integration. Install or enable it, follow the authentication flow it shows you, and sign in with the same GitHub account you verified has access. If your editor doesn't present a clear setup entry, use the current GitHub Copilot quickstart instead of a command name copied from an old blog post.

The Copilot icon only means the extension loaded. It does not mean inline suggestions appear, or that they're any good. The next step tests that directly: write a function.

A typed comment is a contract· github-copilot
Bad example

# Write a greeting function for a name. def greet(name: str) -> str:

Good example

# Return exactly: "Hello, <name>!" # Preserve the supplied name and include the exclamation mark. def greet(name: str) -> str:

Why this works: A one-line body that returns a string, uses the name parameter, starts with "Hello, ", and ends with "!". Anything that hardcodes a name or drops the exclamation mark fails the contract. Reject it.

An inline suggestion is a draft

The comment and signature give Copilot a goal, an exact output format, and a constraint. They also give you a contract for review. That contract matters only if you check the suggestion against it.

Copilot's suggestion can differ every time you type, so "success" can never mean "Copilot produced the same code as the lesson." Success means the resulting program satisfies your requirements. A completion can be perfectly valid Python and still fail the task. Syntax answers one question: can Python run this? Your acceptance criteria answer the one that matters: does this solve the problem?

Write the acceptance criteria before you inspect the suggestion. For the greeting function, the result must be a string, use name, begin with Hello, , and end with !. Then review in a fixed order. Compare the proposal with each criterion, accept, edit, or reject it, and run the code with representative inputs. Start with an ordinary name. Follow with one that contains punctuation, since a completion that only happened to fit the first example often fails there.

How much validation is enough depends on what the code does. For a small, self-contained function like this one, validation means reading the proposed body and then executing it against a couple of inputs. The same "looks fine" suggestion for code that touches authentication, money, or shared data needs more: automated tests, a security review, and a look from someone who understands the system it plugs into. You'll build those heavier checks later in this module. Practice the habit now, on cheap examples, so it's automatic once the stakes are real: plausible is not the same as proven, and the only thing that closes that gap is running the code and reading the result.

Force the function to use every input· github-copilot
Bad example

# Return a sentence describing the club meeting. def club_summary(club_name: str, meeting_day: str, meeting_time: str) -> str:

Good example

# Return exactly: # "<club_name> meets every <meeting_day> at <meeting_time>." # Use all three parameters. Do not invent a room or location. def club_summary(club_name: str, meeting_day: str, meeting_time: str) -> str:

Why this works: A body that inserts all three parameters in the exact sentence format. If the suggestion fixes the day as "Tuesday" or adds "in Room 204", it invented facts you never supplied. Reject and edit it.

Search the body for every parameter name

Before you accept a completion, look for each parameter inside the function body, then run a second input that changes every value. A completion that hardcodes "Tuesday" or reuses one sample name is easy to miss on a single happy-path test and obvious the moment the inputs move.

Reject, edit, retest: the fastest way to a correct function

When a suggestion is wrong, you have three moves, and picking the right one is a skill worth building early. Reject when the proposal violates a requirement or invents information: a fixed name, a made-up room, the wrong format. Edit when the intended correction is small and obvious. Accept only after all parameters and constraints survive execution on both a normal and a boundary input.

A common reaction is to request another completion. If Copilot returns return "Hello, Amina!", the code passes one sample while ignoring name. Don't wait for a luckier answer. Change it to return f"Hello, {name}!" and rerun the checks. A small, obvious edit is faster to review than a fresh suggestion and leaves you in control of the final behavior.

This is also why "more text" is not a better answer. When a task specifies an exact format, a suggestion that adds an unrequested room, date, or person adds something you now have to notice and remove. Reject the extras. The prompting discipline from The Anatomy of a Great Prompt carries over here, one function at a time: state the goal, the constraints, and what "done" looks like.

The same decision scales up from club_summary: a fixed day such as "Tuesday" and the added phrase "in Room 204" are still inventions to reject. Check all three parameters, edit the clear errors, and retest. As functions get bigger, only the number of constraints you check grows. Keep the acceptance criteria beside the code, because larger functions make omissions easier to miss.

Reject a suggestion that ignores its inputs· github-copilot
Bad example

Fix this greeting function and check that it works.

Good example

# This completion passes one example but ignores the parameter: # return "Hello, Amina!" # Replace it with a version that uses `name` for any input, then test # greet("Amina") and greet("Ari-Lee") and confirm both are correct.

Why this works: A parameterized implementation whose output changes with the input, plus two runs whose printed results match your expected strings exactly.

Try it yourself

Build a function you can grade

Practice the accept/edit/reject loop on a fresh function so the habit sticks before the stakes rise. Budget about seven minutes.

  1. 01

    In your practice folder, create club.py and type a comment plus signature for a function that returns exactly "<student_name> registered for <club_name> on <meeting_day>." using all three parameters and inventing no room.

  2. 02

    Pause for the completion and read the whole body before touching anything. Check it against each requirement.

    Hint: Look for all three parameter names inside the body.

  3. 03

    Reject or edit any version that omits a parameter, substitutes a fixed value, or adds a location. Fix it directly rather than re-rolling.

  4. 04

    Add a normal call and a boundary call (a name with a hyphen, a club with an ampersand), save, and run the file with your verified Python command.

  5. 05

    Compare both printed lines against the exact expected sentences.

A function that passes a normal and a punctuation-heavy boundary test, and a repeatable habit: criteria first, then accept, edit, or reject.

Key takeaways

  • Prove your Python runtime works first, so you can tell a Copilot problem from a plain code problem.
  • Copilot Free ($0, up to 2,000 completions/month as of mid-2026) is enough for your first session.
  • Editor labels and packaging change per release. Follow the onboarding your VS Code presents.
  • An inline suggestion is a draft. The icon proves connection. Correctness is a separate check.
  • Judge completions against acceptance criteria and a boundary test, and edit a near-correct one instead of re-rolling.

Check your understanding

  1. 1. Copilot proposes a completion different from the one shown in this lesson. When has your first suggestion "succeeded"?

  2. 2. A completion for `greet(name)` returns the literal string "Hello, Amina!". What should you do?

  3. 3. You're starting your first personal Copilot session. Which plan is sufficient?

  4. 4. Your first program won't run. What tells you whether it's a Copilot problem or a Python problem?

  5. 5. A suggestion looks clean and well-formatted. What actually proves it solves the task?

Frequently asked questions

Terms used in this lesson

inline suggestion
Code Copilot proposes at your cursor inside the editor, which you can inspect, accept, edit, or reject before it becomes part of your program.
acceptance criteria
The observable conditions a completion must meet to be usable, for example, "returns a string, uses every parameter, matches the exact format."
boundary test
A deliberately awkward input, such as punctuation, spaces, or an edge value, that exposes a completion which only worked on a tidy happy-path example.

Further reading