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 Mistakes New Developers Make When Using AI Tools

10 Mistakes New Developers Make When Using AI Tools As we dive into 2026, AI tools have transformed the coding landscape. But with all the excitement, new developers often stumble

Mar 16, 20264 min read
Ai Coding Tools

How to Use Cursor.ai for Rapid Prototyping in Under 60 Minutes

How to Use Cursor.ai for Rapid Prototyping in Under 60 Minutes In the fastpaced world of building side projects, getting an idea from concept to prototype can feel overwhelming. Ma

Mar 16, 20263 min read
Ai Coding Tools

Why GitHub Copilot is Overrated: Contrarian Perspectives on AI Coding Assistants

Why GitHub Copilot is Overrated: Contrarian Perspectives on AI Coding Assistants As a solo founder or indie hacker, you’re always on the lookout for tools that genuinely boost your

Mar 16, 20264 min read
Ai Coding Tools

How to Build Your First App Using AI Tools in Under 3 Hours

How to Build Your First App Using AI Tools in Under 3 Hours If you're a solo founder or an indie hacker, the thought of building an app might seem daunting. But what if I told you

Mar 16, 20265 min read
Ai Coding Tools

Top 5 AI Tools for Beginners in 2026: Your Launchpad

Top 5 AI Tools for Beginners in 2026: Your Launchpad As a beginner diving into the world of coding in 2026, the landscape is flooded with AI tools promising to make your journey sm

Mar 16, 20264 min read
Ai Coding Tools

Supabase vs Firebase for AI-Driven Projects: A 2026 Comparison

Supabase vs Firebase for AIDriven Projects: A 2026 Comparison As we dive into 2026, the landscape for building AIdriven applications has evolved significantly. If you're an indie h

Mar 16, 20264 min read