How to Use GitHub Copilot for Writing Efficient Code in 2 Hours
How to Use GitHub Copilot for Writing Efficient Code in 2026
If you're like many indie hackers or side project builders, you know that writing code can often feel like a slog. You want to focus on building features, not wrestling with syntax or remembering the exact function names. Enter GitHub Copilot, an AI-powered coding assistant that claims to help you write code more efficiently. But does it really deliver? In this guide, I’ll walk you through how to set up and use GitHub Copilot effectively within 2 hours, and share some honest trade-offs to consider.
Time Estimate: 2 Hours
You can finish this setup in about 2 hours if you follow along step-by-step.
Prerequisites
Before diving in, make sure you have the following:
- A GitHub account (free)
- Visual Studio Code (VS Code) installed (free)
- GitHub Copilot subscription ($10/month or $100/year)
- Basic familiarity with JavaScript or Python (for best results)
Step-by-Step Setup
1. Install Visual Studio Code
Download and install Visual Studio Code from here. It’s a lightweight yet powerful code editor that works well with GitHub Copilot.
2. Install GitHub Copilot Extension
- Open VS Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window.
- Search for "GitHub Copilot" and click "Install."
3. Sign In to GitHub
Once the extension is installed:
- Open the Command Palette (Ctrl+Shift+P).
- Type “GitHub: Sign in” and follow the prompts to link your GitHub account.
4. Start a New Project
Create a new folder for your project and open it in VS Code.
5. Write Some Code
Begin writing a function or piece of code. For example, if you're in JavaScript, start with:
function calculateSum(a, b) {
You’ll notice that Copilot starts suggesting completions almost immediately. Accept its suggestion by hitting the Tab key.
6. Experiment with Different Prompts
To get the best out of Copilot, try writing comments or prompts for what you want to achieve. For instance:
// Create a function that fetches data from an API
Copilot should generate a function that outlines the structure of your API call.
7. Review and Edit Suggestions
Copilot’s suggestions won’t always be perfect. Make sure to review each suggestion carefully. For example, if it suggests a method that doesn't handle errors, you may want to add error handling logic yourself.
Troubleshooting Common Issues
- Suggestion Lag: If suggestions are slow, check your internet connection. Copilot relies on cloud processing.
- Inaccurate Suggestions: Sometimes, Copilot generates code that doesn’t fit your context. Always validate the output.
What's Next?
Once you feel comfortable using Copilot, consider exploring its advanced features:
- Pair Programming: Use Copilot to assist in pair programming sessions, where it can suggest alternative solutions.
- Learning New Languages: Try out Copilot for languages you’re not familiar with, like Go or Ruby. It can help you learn syntax and best practices.
Limitations
While GitHub Copilot can speed up coding significantly, it has its drawbacks:
- Not Always Accurate: The suggestions can be off-target, especially for complex logic.
- Dependency on Prompts: If your prompts are vague, the output can also be vague.
- Subscription Cost: At $10/month, it might not be feasible for everyone, particularly if you're just starting out.
Pricing Comparison of AI Coding Tools
| Tool | Pricing | Best For | Limitations | Our Verdict | |--------------------|----------------------------|---------------------------------|-----------------------------------|----------------------------------| | GitHub Copilot | $10/mo or $100/yr | General coding assistance | Can be inaccurate, needs prompts | Essential for rapid coding | | TabNine | Free tier + $12/mo pro | Autocompletion for many languages| Limited to code completion only | Good for specific languages | | Codeium | Free | AI-assisted code suggestions | Fewer integrations | Great for budget-conscious users | | Replit | Free tier + $20/mo pro | Collaborative coding | Less focused on individual coding | Best for team projects | | Sourcery | Free tier + $12/mo pro | Python code improvement | Limited to Python | Great for Python developers | | AI Dungeon | Free tier + $10/mo pro | Story-driven coding examples | Not focused on traditional coding | Fun for creative coding |
What We Actually Use
In our experience, we primarily use GitHub Copilot for its versatility and integration with VS Code, especially when building new features rapidly. For more complex projects, we also incorporate TabNine for additional language support, but GitHub Copilot remains our go-to tool.
Conclusion
To get started with GitHub Copilot, follow the steps outlined above, and remember to keep an eye on the quality of the code it suggests. It’s a powerful tool that, when used correctly, can significantly enhance your coding efficiency.
If you're looking to take your coding to the next level, give GitHub Copilot a try today.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.