How to Use GitHub Copilot to Write Your First 50 Lines of Code
How to Use GitHub Copilot to Write Your First 50 Lines of Code
If you’re a beginner coder, staring at a blank editor can be daunting. You might wonder, "Where do I even start?" That's where GitHub Copilot comes in. This AI-powered coding assistant can help you generate code snippets, suggest functions, and even complete entire files. In this guide, I'll walk you through using GitHub Copilot to write your first 50 lines of code, so you can get started without feeling overwhelmed.
Prerequisites
Before you dive in, make sure you have the following:
- GitHub Account: You'll need an account to access Copilot.
- Visual Studio Code (VS Code): This is where you'll be writing your code. Download it here.
- GitHub Copilot Subscription: As of 2026, it costs $10/month or $100/year. There’s a free trial for 30 days, which is great for testing it out.
Step-by-Step Guide to Write Your First 50 Lines of Code
Step 1: Install GitHub Copilot
- Open VS Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side.
- Search for "GitHub Copilot" and click "Install."
- Follow the prompts to log in to your GitHub account and activate your subscription.
Step 2: Start a New Project
- Create a new folder for your project.
- Open the folder in VS Code.
- Create a new file named
app.js(or any other language file you prefer).
Step 3: Write Your First Line of Code
Type a simple comment in your file to describe what you want to do. For example:
// Function to add two numbers
Hit Enter, and GitHub Copilot will suggest a function. Accept the suggestion by hitting Tab.
Step 4: Expand Your Code
Continue writing comments or function headers asking Copilot for help. For example:
// Function to subtract two numbers
Again, accept the suggestion. Repeat this for other basic operations—multiplication, division, etc.
Step 5: Test Your Code
- Add some console logs to see the output:
console.log(add(5, 3)); // Should output 8
console.log(subtract(5, 3)); // Should output 2
- Run your code by opening a terminal in VS Code and typing:
node app.js
Expected Outputs
If everything goes well, you should see the outputs in your terminal. This will give you a sense of accomplishment as you see the results of your first 50 lines of code.
Troubleshooting Common Issues
- Copilot Not Suggesting Code: Make sure you’re connected to the internet and that your GitHub Copilot subscription is active.
- Error Messages: If your code doesn’t run, double-check for syntax errors or typos. Copilot can’t always generate perfect code, so you might need to tweak things.
What's Next?
Now that you’ve written your first lines of code, consider exploring more complex projects. Perhaps try building a simple web app or a command-line tool. GitHub Copilot can assist you along the way, but remember, it’s important to understand the code you’re writing.
Conclusion: Start Here
Using GitHub Copilot can significantly reduce the initial hurdles of coding. Start by installing it, writing simple functions, and gradually building your skills. Remember, it’s okay to rely on Copilot for suggestions, but make sure to learn the underlying concepts as you go.
What we actually use: GitHub Copilot is now an essential part of our coding workflow, especially for rapid prototyping and learning new languages. However, it’s not perfect—always double-check the code it generates for accuracy and best practices.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.