Getting Started With GitHub Copilot

AI, specifically chat-based AI with LLMs, is everywhere. It's both a good thing and a bad thing. The bad part of it is there are people trying to use AI to do just about everything they need to do, which results in outcomes that are not what they were hoping for.
The good part about AI is that if you use it right and truly understand the work that you're doing, it can help you progress within a project you're working on in a much more efficient fashion.
Prerequisites
To follow along with this blog post from a hands-on perspective, you'll want to have the following:
- VS Code installed. If you don't have it, you can find it here.
- Permission: If you're using this blog post to walk through how to do something for work, ensure that you have permission to use AI. In my consulting practice, I'm seeing several clients put a ban on AI, so please ensure to get permission.
What Is GitHub Copilot
Copilot is a chat and agent-based LLM tool, much like if you were to use ChatGPT, Claude, Cursor, etc. (although tools like Cursor are separate IDEs, but they're also doing the LLM bit, it's just built in). The goal with any of these tools is to have access to pre-trained Models, which in this case, are Large Language Models (LLM). Behind the scenes, these organizations (Microsoft, Anthropic, OpenAI, etc.) are running hardware that costs millions of dollars to train these LLMs based on data that exists on the internet (which is why some results are better than others).
As consumers, the goal of these tools are to not, I repeat, NOT to do everything for you (if you try, you will have a rough time), but instead give you something like automation 2.0. They're there to help you be more efficient in what you're doing. For example, if you need to write a Kubernetes Manifest or a CICD YAML pipeline, chances are the last thing you really need to do is write your umpteenth YAML configuration. Instead, you can say "hey, GitHub Coilot, write a pipeline for GitHub Actions that does XYZ for me".
The biggest thing, at least right now, to keep in mind is the difference between "ask" features and "agent" features. "ask" is very much like if you open up ChatGPT and ask a question, which hopefully gets you a solid answer. The "agent" piece is what you may see a lot about on social media when it comes to developers talking about how AI is helping them write code. It'll do everything from give you answers for solving problems to literally building out an entire project.
Now that you know a bit about Copilot and why you may be interested in LLMs at the agent level, let's see two use cases - one for DevOps and one for programming.
Using Copilot For DevOps
To start off, you'll want to make sure that you have the GitHub Copilot extension in VS Code.

Once you have GitHub Copilot, you'll see the Copilot button on the top right of VS Code.

- Click the Copilot button and you'll see the chat pop up.

- You'll notice a few different options in terms of which LLM to use and whether to use Ask, Agent, or Edit.


For the purposes of this blog post, use Claude 3.5 and the Agent option.
- Now it's time to start prompting. Take the following prompt and copy/paste it into Copilot like in the screenshot below.
Write a GitHub Action CICD pipeline that allows you to deploy a Terraform module. The Terraform module will consist of an Azure Kubernetes Service (AKS) cluster, so the pipeline will need a way to authenticate to Azure.

- Hit enter and you'll see that Copilot starts to work.

- The first thing you may see is a prompt to create the directory where the CICD pipeline is going to live. You can click the Continue button.

After that, Copilot now has a place to store the code and it'll begin to create the configurations.
As you can use, GitHub Copilot created the CICD pipeline. However, you can also see that it got a little extra excited and started to create Terraform configuration. Now, this could've been because of the prompt, but it's also known that the Claude models get a bit overzealous and start creating things that you don't ask for.

Luckily, you can just click the "stop" button or type stop
and hit enter so it stops creating the configurations. Remember - you don't have to save or run any of this, so no harm no foul.
Next, let's build something a bit bigger from a development perspective.
Using Copilot For Programming
Let's kick things up a notch. For this section, change the LLM used for Claude 3.5 to Claude 3.7. Claude 3.7 tends to hallucinate a bit more, but people have found that it appears to be a bit better when creating a project from scratch.
- The prompt to input for testing how good the programming piece of Copilot is will be a prompt to build a basic game that farms crops.
You are an experienced video game developer. The game that you're about to be asked to create should be in C++. I, the person asking you this, am not a game developer by any means, so the goal of this is for you to follow the best practices of creating a video game that runs on the computer (PC) as you're writing the code to do this.
The video game is a farming simulator. It should be really basic. Nothing more than a farmer that can pick crops from a field.
Sidenote: here's the thing about the prompt above - it's very basic. As you research around for prompting, what you'll find is people say to prompt as well as possible with as much information as possible. However, something that I've found is if I give an incredible amount of detail and specific instruction, the Agent tends to forget what it's doing as it's going and completely hallucinates. It's like it forgets what it's doing, which could very well be something as simple as running out of Tokens. Because of that, we'll keep things basic and see what Copilot comes with up.
- Run the Prompt.

- You'll see Copilot begin to work.

- You should see a prompt like this if you're working in an empty directory, so just create a new working directory (you may have to reopen Copilot and re-run the prompt).

- You'll see a lot of different prompts for things like creating directories and files.

- After about 5-7 minutes, you should see an output similar to the one below.

A few files are created:
- The
.h
files, which in C++ are where classes/functions/etc. are stored (the actual logic/actions in the code). - A few
.cpp
files, which are what run each part of the game calling upon the functionality in the.h
files.
Altogether, Copilot was successful with building some basic functionality for a video game that runs on your PC! And, you can now say that you've built a video game, which is always neat.

Summary
There is a lot of talk about AI taking jobs and many other things that sales and marketing folks will push on LinkedIn. However, in the real engineering world, that's not the case. Will AI change the way we work? Absolutely, just like PowerShell changed the way Sysadmins worked and cloud changed the way datacenter engineers worked. Tech is all about adoption and with Agents, we have the ability to move faster than we could before (just remember to check the output).