GitHub Copilot Mastery Part 2: Basic Usage Fundamentals
13 Sep 2025 | github-copilot ai developer-tools productivity vscodeWelcome back to the GitHub Copilot Mastery series! In Part 1, we covered the art of prompt crafting. Now it’s time to get our hands dirty with the actual tools and features that make Copilot such a game-changer.
If you’re still on the fence about Copilot or struggling to see its value, this post will change your perspective. We’re going beyond the basic “it autocompletes my code” understanding to show you how Copilot can become your most valuable coding companion.
Installing and Activating Copilot
Let’s start with the basics—getting Copilot set up properly. I’m constantly amazed by how many developers skip the proper setup and then wonder why their experience is subpar.
Prerequisites
Before you start, make sure you have:
- A GitHub Copilot subscription (Individual, Business, or Enterprise)
 - A supported IDE (we’ll focus on VS Code, but Copilot works in many editors)
 - An active internet connection (Copilot requires cloud connectivity)
 
VS Code Installation
- Install the GitHub Copilot Extension
    
- Open VS Code
 - Go to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
 - Search for “GitHub Copilot”
 - Install the official Microsoft extension
 
 - Install GitHub Copilot Chat (highly recommended)
    
- Search for “GitHub Copilot Chat”
 - Install this extension as well—it unlocks the conversational features
 
 - Sign In to GitHub
    
- Use Cmd+Shift+P (Ctrl+Shift+P) to open the command palette
 - Type “GitHub Copilot: Sign In”
 - Follow the authentication flow
 
 
Verification
Test that everything works:
// Type this comment and press Enter
// Create a function that calculates compound interest
If Copilot is working, you should see a grayed-out suggestion appear. Press Tab to accept it.
Code Completions: Your New Superpower
Code completions are where most people start with Copilot, and for good reason—they’re immediately useful and surprisingly intelligent.
How Completions Work
Copilot analyzes several factors to generate completions:
- Current file content and cursor position
 - Open tabs and recently edited files
 - Your coding patterns and style
 - The broader context of your project
 
Types of Completions
1. Inline Completions
The most common type—Copilot suggests code as you type:
def fibonacci(n):
    # Copilot suggests the entire function implementation
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
Pro tip: Don’t just accept the first suggestion. Press Alt+] (or Option+] on Mac) to cycle through alternatives.
2. Multi-line Completions
Copilot can suggest entire code blocks:
interface User {
    id: string;
    name: string;
    email: string;
}
// Copilot might suggest an entire CRUD class
class UserService {
    // Complete implementation suggested here
}
3. Context-Aware Completions
Copilot understands your existing code and suggests consistent patterns:
const users = [
    { name: 'Alice', age: 30, city: 'New York' },
    { name: 'Bob', age: 25, city: 'San Francisco' }
];
// Copilot knows the structure and suggests appropriate operations
const adultUsers = users.filter(
    // Suggests: user => user.age >= 18
);
Completion Best Practices
- Write descriptive comments first: They guide Copilot’s suggestions
 - Use consistent naming conventions: Copilot picks up on patterns
 - Don’t accept everything: Review suggestions critically
 - Experiment with alternatives: Use keyboard shortcuts to see different options
 - Provide context through imports: Import statements help Copilot understand your stack
 
Next Edit Suggestions: Predictive Coding
This is where Copilot starts feeling like magic. Next Edit Suggestions predict what you’ll want to change next based on your current edits.
How It Works
As you make changes to your code, Copilot analyzes the pattern and suggests logical next steps. It’s like having a pair programmer who’s always one step ahead.
Example Scenarios
Refactoring Patterns
// You change this:
const userName = user.name;
const userAge = user.age;
// Copilot suggests continuing the pattern:
const userEmail = user.email;  // <- Suggested next edit
const userCity = user.city;    // <- Another suggestion
Test Case Generation
def test_user_creation():
    user = create_user("Alice", "alice@example.com")
    assert user.name == "Alice"
    # Copilot suggests: assert user.email == "alice@example.com"
Error Handling Patterns
try {
    const data = await fetchUserData(userId);
    // If you add error handling here...
} catch (error) {
    console.error('Failed to fetch user data:', error);
    // Copilot might suggest similar patterns for other async calls in the file
}
Ask/Edit/Agent Modes: The Power Trio
This is where Copilot Chat really shines. These three modes give you different ways to interact with Copilot beyond simple completions.
Ask Mode: Your AI Consultant
Use Ask mode when you need explanations, guidance, or code reviews.
Example conversations:
You: "Explain this regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/"
Copilot: This is an email validation regex that breaks down as follows:
- ^ : Start of string
- [a-zA-Z0-9._%+-]+ : One or more alphanumeric characters, dots, underscores, etc.
- @ : Literal @ symbol
- [a-zA-Z0-9.-]+ : Domain name characters
- \. : Literal dot
- [a-zA-Z]{2,} : Top-level domain (2+ letters)
- $ : End of string
Best practices for Ask mode:
- Be specific about what you want to know
 - Provide relevant code context
 - Ask follow-up questions to dig deeper
 - Use it for code reviews and optimization suggestions
 
Edit Mode: AI-Powered Refactoring
Edit mode lets you select code and ask Copilot to modify it according to your instructions.
Example workflow:
- Select a function that needs improvement
 - Open Copilot Chat
 - Type: “Make this function more efficient and add error handling”
 - Review and accept/modify the suggestions
 
Common Edit mode use cases:
- Adding error handling to existing code
 - Optimizing performance
 - Converting between programming paradigms (imperative to functional)
 - Adding type annotations
 - Refactoring for better readability
 
Agent Mode: Your AI Pair Programmer
Agent mode (available with GitHub Copilot Chat) provides a conversational interface for complex coding tasks.
Example interaction:
You: "I need to build a REST API for user management with authentication"
Agent: I'll help you build that. Let's start with the basic structure:
1. What framework would you prefer? (Express.js, FastAPI, Spring Boot, etc.)
2. What type of authentication? (JWT, sessions, OAuth)
3. What database will you use?
Based on your answers, I'll generate the complete setup with:
- Route definitions
- Authentication middleware  
- Database models
- Input validation
- Error handling
Coding Agent: Advanced Assistance
The Coding Agent is Copilot’s most sophisticated mode, capable of understanding complex requirements and generating substantial code solutions.
When to Use Coding Agent
- Starting new projects: Get boilerplate and project structure
 - Implementing complex algorithms: Get well-structured, commented implementations
 - Learning new frameworks: Get example code with explanations
 - Debugging complex issues: Get analysis and suggested fixes
 
Example: Building a Complete Feature
You: "Create a user authentication system with login, logout, and JWT token management"
Coding Agent: I'll create a complete authentication system for you. Here's what I'll build:
1. User model with password hashing
2. Authentication routes (login/logout/refresh)
3. JWT token utilities
4. Authentication middleware
5. Input validation
6. Error handling
7. Example usage
[Generates multiple files with complete implementation]
Advanced Agent Patterns
Project Analysis
“Analyze this codebase and suggest improvements for performance and maintainability”
Architecture Planning
“Design a microservices architecture for an e-commerce platform”
Code Migration
“Help me migrate this jQuery code to modern JavaScript with proper error handling”
Integration Tips and Tricks
Keyboard Shortcuts to Master
Tab: Accept current suggestionEsc: Dismiss suggestionAlt+]/Option+]: Next suggestionAlt+[/Option+[: Previous suggestionCtrl+Enter/Cmd+Enter: Open all suggestions in a new tab
Configuration Optimization
Add these to your VS Code settings for a better experience:
{
    "github.copilot.enable": {
        "*": true,
        "yaml": true,
        "plaintext": false,
        "markdown": true
    },
    "github.copilot.editor.enableAutoCompletions": true,
    "github.copilot.conversation.localeOverride": "en"
}
Working with Different File Types
Copilot isn’t just for code—it works with:
- Configuration files (JSON, YAML, TOML)
 - Documentation (Markdown, reStructuredText)
 - SQL queries
 - Shell scripts
 - Infrastructure as Code (Terraform, CloudFormation)
 
Common Pitfalls and How to Avoid Them
1. Over-Reliance on Suggestions
❌ Don’t: Accept every suggestion without review ✅ Do: Critically evaluate suggestions and understand the code
2. Ignoring Context
❌ Don’t: Work in isolation without providing context ✅ Do: Write descriptive comments and use meaningful variable names
3. Treating Copilot as Infallible
❌ Don’t: Assume all suggestions are correct and optimal ✅ Do: Test, review, and refactor Copilot’s suggestions
4. Not Leveraging Chat Features
❌ Don’t: Only use basic completions ✅ Do: Use Ask/Edit/Agent modes for complex tasks
Key Takeaways
Master these fundamentals to unlock Copilot’s potential:
- Set up properly: Install both main extension and chat extension
 - Learn the modes: Completions for speed, Chat for complexity
 - Use keyboard shortcuts: They dramatically improve workflow
 - Provide context: Better context leads to better suggestions
 - Review everything: Copilot is a tool, not a replacement for thinking
 - Experiment: Try different approaches and learn what works best
 
What’s Next
In Part 3 of this series, we’ll explore how Copilot works across different IDEs. Each editor has its own strengths and quirks when it comes to AI assistance—knowing these differences can help you choose the right tool for each project.
Start practicing these basic usage patterns in your daily coding. The more you use Copilot’s core features, the more natural they’ll become, setting you up for success with the advanced techniques we’ll cover later in this series.
Additional Resources
- GitHub Copilot in VS Code
 - Using GitHub Copilot Chat
 - Copilot Keyboard Shortcuts
 - GitHub Copilot Settings Reference
 
This post is part 2 of the GitHub Copilot Mastery series. Coming up: IDE differences and how to optimize Copilot for your preferred development environment.