These free GitHub Copilot prompts are ready to copy and paste. Copilot works from comments and chat in your editor, so these show how to ask for code, tests and fixes. Grab the full guide for more.
Get our complete GitHub Copilot prompt guide (PDF) free: many more prompts, organised by task, with step-by-step examples and pro tips. Pick your level and we will email it over.
Let the comment lead.
// Write a function that takes [inputs] and returns [output], handling [edge case]. Then start typing the function name and let Copilot complete it.
Understand unfamiliar code.
In Copilot Chat: Explain what this code does, step by step, and point out anything risky: [paste code]
Cover your code.
In Copilot Chat: Write unit tests for this function, including normal cases and edge cases, using [your test framework]: [paste function]
Debug faster.
In Copilot Chat: This code throws [error]. Find the bug, explain it, and give me the corrected version: [paste code]
Tidy it up.
In Copilot Chat: Refactor this to be cleaner and easier to read, without changing what it does. Explain the main changes: [paste code]
Document as you go.
In Copilot Chat: Add clear comments and a docstring to this function explaining the parameters and return value: [paste function]
Port code quickly.
In Copilot Chat: Convert this [Python] code to [JavaScript], keeping the same behaviour: [paste code]
Ready to try these yourself?
Try GitHub Copilot →We use cookies to improve your experience and understand how the site is used. You can accept these, or stick to necessary cookies only. See our cookie & privacy policy.