Ai Coding Tools

How to Use GitHub Copilot to Write Your First 5 Lines of Code

By BTW Team4 min read

How to Use GitHub Copilot to Write Your First 5 Lines of Code

Getting started with coding can feel daunting, especially if you’re a solo founder or indie hacker trying to ship your first project. You might be wondering, “Can AI really help me write code?” The answer is yes, and GitHub Copilot is a powerful tool that can guide you through your first lines of code. In this guide, I'll show you how to leverage Copilot effectively in 2026.

Time Estimate and Prerequisites

Time to complete: You can finish this in about 30 minutes.

Prerequisites:

  • A GitHub account (free)
  • Visual Studio Code (free)
  • GitHub Copilot subscription ($10/month, free trial available)

Step 1: Install GitHub Copilot

  1. Set up Visual Studio Code: If you don’t have it installed, download it from Visual Studio Code.
  2. Install GitHub Copilot:
    • Open Visual Studio Code.
    • Go to Extensions (Ctrl+Shift+X).
    • Search for “GitHub Copilot” and click on “Install.”
  3. Authenticate Your GitHub Account: After installation, you’ll be prompted to sign in to your GitHub account to activate Copilot.

Step 2: Create a New File

  1. Open a New File: Go to File > New File in Visual Studio Code.
  2. Choose a Language: Start with JavaScript or Python for simplicity. Type // This is a simple calculator for JavaScript or # This is a simple calculator for Python to indicate your intent.

Step 3: Start Coding with Copilot

  1. Write Your First Line: Begin with a comment that describes what you want to do. For example, // Function to add two numbers.
  2. Trigger Copilot Suggestions: After typing your comment, you should see a suggestion pop up from Copilot. Press Tab to accept the suggestion.
  3. Iterate on Functions: Continue writing comments for each function you want to create. For example:
    // Function to subtract two numbers
    // Function to multiply two numbers
    // Function to divide two numbers
    
    Copilot will provide code for each function as you type.

Expected Outputs

By the end of this step, you should have a simple calculator with functions to add, subtract, multiply, and divide. Here’s what it might look like in JavaScript:

// Function to add two numbers
function add(a, b) {
    return a + b;
}

// Function to subtract two numbers
function subtract(a, b) {
    return a - b;
}

// Function to multiply two numbers
function multiply(a, b) {
    return a * b;
}

// Function to divide two numbers
function divide(a, b) {
    return a / b;
}

Troubleshooting Common Issues

  • No Suggestions from Copilot: If you’re not getting suggestions, make sure you’re connected to the internet and check that Copilot is enabled in your settings.
  • Suggestions are Off-Topic: Sometimes, Copilot doesn’t understand your context. Try rephrasing your comments or be more specific about what you want.
  • Errors in Generated Code: Always review the code Copilot generates. It’s not perfect and may require adjustments.

What's Next?

Now that you have your first lines of code, consider expanding your project. You can:

  • Implement a user interface using HTML/CSS.
  • Add error handling to your functions.
  • Explore integrating your calculator into a web app using frameworks like React or Flask.

Conclusion

Using GitHub Copilot can drastically reduce the learning curve for new coders. Start with clear comments, let Copilot do the heavy lifting, and refine the code to fit your needs. This approach not only helps you write your first 5 lines of code but also builds confidence as you see your project come together.

What We Actually Use: For simple projects, we rely heavily on GitHub Copilot for drafting code quickly. However, we always review and refine the output to ensure it meets our standards.

If you’re ready to dive into coding with GitHub Copilot, start today and see how it can help you ship your next project faster.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read