← Back to LetsDoItAi
LetsDoItAiPrompts › GitHub Copilot

Free GitHub Copilot Prompts

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.

Want the full GitHub Copilot prompt pack?

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.

Copy-paste GitHub Copilot prompts

1. Write a function from a comment

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.

2. Explain this code

Understand unfamiliar code.

In Copilot Chat: Explain what this code does, step by step, and point out anything risky:

[paste code]

3. Write tests

Cover your code.

In Copilot Chat: Write unit tests for this function, including normal cases and edge cases, using [your test framework]:

[paste function]

4. Find and fix a bug

Debug faster.

In Copilot Chat: This code throws [error]. Find the bug, explain it, and give me the corrected version:

[paste code]

5. Refactor for readability

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]

6. Add comments / docstrings

Document as you go.

In Copilot Chat: Add clear comments and a docstring to this function explaining the parameters and return value:

[paste function]

7. Convert between languages

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 →
← Back to LetsDoItAi
Cookie settings