Practical Examples
Three tasks, easy to harder, covering this course: comment-driven complete, Chat on an unfamiliar repo, and Issue → agent PR on GitHub. Paste the prompts into Copilot; adjust commands for your repo. Do not run these on production with review turned off.
Example 1: Comment-to-code, then you verify
Goal: Ghost-text a pure function with edge behavior—not “it looks runnable.”
Setup: an empty folder is enough.
Windows:
macOS:
Create slug.js. Type only the comment and header; wait for gray text:
Tab to accept or Esc to dismiss and tighten the comment. Then create slug.test.js (or your usual test file) and ask for assertions in a comment:
If complete tries to add a test library you did not install, Esc and write Do not add Jest in the comment. On Windows and macOS run node --test slug.test.js; if --test is missing, use a few console.assert lines.
Done when:
Chapters: Quick Start, Completions.
Example 2: Chat onboards a strange repo; you merge one change
Goal: In two hours, name the entry points and test command, and merge one small change you understand.
Clone a small-to-medium open-source repo you do not know. Open the repo root in VS Code:
Ctrl+Alt+I (Windows) or Control+Command+I (macOS), then:
Run what it quoted (example only—prefer the files):
Pick a change with no auth and no migrations (copy, README typo, missing JSDoc). Use Chat Ask or Edit, not a full-repo Agent sweep:
Review the diff, rerun the same tests, commit only that hunk.
Done when:
See Chat. If you would rather do this in Cursor, use Cursor practical examples—do not let two agents write at once.
Example 3: Assign an Issue to Copilot; you review the PR
Goal: Run the official cloud-agent loop—not “it felt done” in the IDE.
You need:
- A practice repo you can push to (not production)
- Plan and repo policy that allow Copilot cloud agent (see Coding Agent)
- A specific Issue
Issue body example:
On GitHub: Assignees → Copilot. Optionally repeat “do not touch auth” in the optional prompt. When the PR appears:
- Ask
Summarize this pull requestin the Copilot panel (GitHub Integration). - Open Files changed yourself; reject drive-by refactors.
- Check out the PR branch locally and run tests (same on Windows / macOS):
Then run the test command from example 2.
- If you need changes, comment on the PR, not only on the already-assigned Issue.
- Merge only when tests are green and the diff matches the Issue.
If the org disabled the agent: implement the same /health with the CLI and open the PR yourself—still human-reviewed.
Done when:
After the labs
Put norms in .github/copilot-instructions.md. Whether to run Cursor in parallel: Copilot vs Cursor.