Free starter lessonGitHub Copilot14 min

Draft functions from a comment with Copilot

By the end you will have written one working function in your own repo from a single-line comment, and codified your own rule for when to accept or reject a Copilot suggestion.

You already ship code every day, so the point is not to watch autocomplete work. The point is to build the reflex that decides in a second whether a suggestion is worth taking, because that judgment is what separates an engineer who moves faster with an agent from one who quietly merges bugs.

This module is the smallest honest rep of that skill before you hand agents multi-file work later in the path.

This is the free first module of urfired.ai's Engineering & Dev path. No signup, no card. The steps note what GitHub Copilot access you need.

The workflow

8 steps, start to finish

Install and sign in to Copilot Free in VS Code

In VS Code, hover the Copilot icon in the bottom status bar and choose Use AI Features, or click the sign-in prompt and select Sign up for Copilot Free. Sign in with a personal GitHub account.

If you have no paid Copilot plan, you are put on Copilot Free, which includes a monthly allowance of code completions at no cost. A solid (not slashed) Copilot icon in the status bar means it is active for the current file.

Confirm inline suggestions are actually live

Open a real source file in a language you work in and start typing a function signature, then pause. You should see grey ghost text proposing a body.

If nothing appears, check the status bar icon is not slashed for this file type, and confirm you are signed in via the Command Palette (Cmd+Shift+P) Copilot commands. Do not move on until ghost text appears reliably.

Pick one small function you genuinely need

Do not invent a demo. Choose a real, self-contained utility from work already on your plate: a date formatter, a slug generator, an input validator, a retry wrapper.

Keep it to something you could describe in one sentence and verify in one run. This keeps the rep honest and the output useful.

Write the one-line comment as a precise spec

Above an empty function, write a single comment that names the inputs, the return value, and at least one edge case. For example: // parse an ISO date string, return a Unix timestamp in seconds, throw on invalid input.

Vague comments produce vague code, so specify behavior, not vibes. Then drop to the next line and let ghost text appear.

Read the ghost text before your hand touches Tab

Treat the suggestion as a junior engineer's draft, not a merge-ready answer. Read every line: the logic, the edge-case handling, the library calls it assumes.

If the first suggestion is off, cycle alternatives with Alt+] and Alt+[, or press Ctrl+Enter to open the completions panel and compare several at once.

Accept, or take only the good part

Press Tab to accept the whole suggestion once you understand it. If only the first part is right, accept incrementally with Cmd+Right (Ctrl+Right on Windows/Linux) to take the next word or line, then type the rest yourself.

Press Esc to dismiss anything you would not have written by hand.

Run it on a real input before you trust it

Copilot suggestions compile-looking is not the same as correct. Call the function with one real value and one edge case (empty, null, or malformed) and confirm the output.

Fix or reject anything that fails. This run is the difference between using the tool and being used by it.

Write your own accept/reject rule

In three to five lines, in a scratch note or a comment, write the rule you will actually follow: for example, reject anything I cannot read line by line, reject anything that pulls in a dependency I did not choose, accept only after one real-input run. This written rule is half the deliverable and the thing you carry into every later module.

Do this now

In a repo you are already working in, pick one small utility function you actually need this week. Write a single comment above an empty function that states its inputs, its return value, and one edge case (for example: // return the number of business days between two Date objects, exclude weekends).

Let Copilot draft the body, cycle at least one alternative with Alt+] before you decide, read every line, then accept with Tab. Run it once on a normal input and once on an edge case to confirm it works.

Finally, write a three-to-five line accept/reject rule capturing what made you take or kill that suggestion.

What you keep

One working function in your own repo, written from a single-line comment and verified on a real input, plus a written three-to-five line rule for when you accept or reject a Copilot suggestion.

What good looks like
  • The function runs and returns the correct result on both a normal input and one edge case you tried
  • You read every accepted line and can explain what each one does and why it is there
  • You have a written accept/reject rule of three to five concrete lines, not a vague intention
  • You looked at more than one option (cycled with Alt+] or the completions panel) before committing to the code you kept
Common traps
Hitting Tab on the first ghost text without reading it, then discovering the bug at review time
Read every line first and cycle alternatives with Alt+] or the Ctrl+Enter panel; treat the suggestion as a draft to verify, not a PR to merge
Writing a vague comment like // handle the date and getting generic, wrong code
Name the inputs, the return value, and at least one edge case in the comment so the spec is unambiguous
Assuming it works because it looks plausible and compiles
Call the function on one real value and one edge case before you commit, and reject anything that fails
Saved on this device
Next in this path

Module 02: Refactor and explain code in Cursor's chat (Cursor, 18 min)

Free gets you this starter lesson today. Pro unlocks the full 13-module path when checkout opens, no card and no charge until then.

New here? The free 2-minute assessment reads your role and gaps, then matches you to the right path. Get your score