📊 We use cookies & analytics to improve your experience. Learn more
Latest

GitHub Copilot Mastery — AI Pair Programming That Ships Module 3 · Lesson 9 of 15

0% Exit to course

Module 3 · Files, tools and your own data Lesson 9 of 15

Pull-request review, inline chat and the test-first loop — GitHub Copilot's own feature

Learning objective

Copilot is not only an autocomplete. It reviews a pull request and leaves comments, it answers a question inside the code you have selected, and it writes the test you were about to skip — which together cover the parts of the job a junior developer is actually paid for.

The concept

Because the slowest part of a junior developer's week is not typing — it is waiting for review, and re-reading your own change with fresh eyes. A reviewer that never gets tired is the highest-value use of this tool, and it is the one that survives code review policies at most companies.

Write the code, then ask for a review before you ask a person. Read every comment and either fix it or decide why it is wrong. Then write the test it asked for. Never merge on the strength of a green check from a tool — a passing test you did not read is not evidence.

Here is the shape of it, in the form you will actually use:

Plain text
// A function with three problems. Ask Copilot to review it, not to fix it.
function averageScore(scores) {
  let total = 0;
  for (let i = 0; i <= scores.length; i++) {
    total += scores[i];
  }
  return total / scores.length;
}

// Ask for: (1) a review comment on each line that is wrong,
//           (2) the input that produces NaN,
//           (3) a rewritten version with the reason for each change.

Common mistakes

The mistake is accepting a suggestion that compiles, passes the build and is wrong. Generated code is easiest to accept exactly where checking it matters most: the loop boundary, the null case, the off-by-one.

Worked example

A pull request you opened ten minutes ago already has three review comments on it, one of which is about an edge case you missed.

Your practice task

Open a real pull request of your own, run the review on it, and fix everything it finds before a human looks. Then note which comments were useful and which were noise.

Do this before moving on. Reading a solution teaches the shape of it; typing it teaches you.

Key takeaway

Because the slowest part of a junior developer's week is not typing — it is waiting for review, and re-reading your own change with fresh eyes.

Create free account or sign in

Almost there

15 lessons left of 15

Finish every lesson to unlock the certificate. Each one ends in a practice task — do them and the final project brief writes itself.