Writing a python program with only GitHub Copilot prompts

tjtharrison
7 min readAug 17

In this article I’m going to cover how I use GitHub’s Copilot offering while coding to (mostly) automate away small or repetitive tasks.

What is Copilot?

Copilot is GitHub’s AI coding companion, assisting development with autocomplete suggestions and a (soon to be made generally available) chat client. It has plugins for most major IDEs so you have AI assistance while working on your coding projects.

Photo by Franz Harvin Aceituna on Unsplash

I have been using Copilot now for just under a year and it’s completely changed the way I code. I can spend less time writing small or repeatable functions and more time thinking about more intricate problems that require solving.

How does Copilot work?

This is a great blog post from GitHub that explains how Copilot uses various sources to decide how best to suggest code when you hit Return to start a new line and a new prompt.

Lets (not) do some coding!

We’re going to write a completely random project here to demonstrate the power of prompt engineering with Copilot and how important it is to give it all of the required information as early as possible.

With no prior knowledge of any of the packages involved, we are going to be using almost entirely Copilot prompts to write a tool to download a random comic from XKCD and display this in a window on your machine.

As usual, you can find the code and prompts used for this project on the below Github repository: