GitHub Copilot Labs’ Prompt Engineering


GitHub Copilot Labs is hidden behind invitation as of writing.

Took some pain to reverse engineer almost all prompts from GitHub Copilot Labs to peek into their prompt engineering. However their plugin seems to ignore global proxy settings: the author dived into codebase to extract the following information.


The author believed that those new features were implemented within the same codex model used for code completion.

${e} is the piece of code to be analyzed. The prompt looks like:

{the piece of code to be analyzed}




Make this code easier to read, including by adding comments, renaming variables, and/or reorganizing the code.

Add Types

Add types to this code:

Fix Bug

There's a bug in this code. Here is how it looks with the bug fixed:


This code could be debugged more easily and we can add some log statements, which would look like:


Remove unnecessary code, like log statements and unused variables. Leave the rest of the code the same.

List Steps

Add more detailed comments to this code to describe each step:


Make this code more robust, covering more edge cases and handling errors:


This code could be chunked into smaller functions, which would look like:


Write a comment describing what this code does, as well as any other information you think is relevant. Include any function names, variable names, or other identifiers that you think are important. You can also include any other information that you think is relevant, such as the purpose of the code, the context in which it is used, or any other information that you think is relevant.

(Why so long?)

Translate (into another coding language)

  • ${t}: Source language
  • ${n}: Target language
  • ${a}: Source code
  • ${i}: Prompt, randomly selected from the following 4 possiblities:
    • Translate the following code from ${t} to ${n}.
    • Convert the following multi-line code from ${t} to ${n}.
    • Translate the following multi-line code from ${t} to ${n}.
    • Transform the following multi-line code from ${t} to ${n}.

The author is not sure what ${s} stands for.

${s} ${i}
${s} Language: ${t}
${s} Language: ${n}

Hidden Prompts

The author also found some prompts not visible from UI:


Make this code more generalizable:


Make this code more robust:

(This seems to be the older version of "Robust" prompt)


Prompt format is different for this one:

{source code}

Refactor this code


This code could be styled more elegantly, which would look like:


There's a security vulnerability in this code. How would you fix it?


More concisely, this code would look like:

Improve Perf

This code could be more performant, which would look like:


Leave a Reply

Your email address will not be published. Required fields are marked *