How to Use GitHub Copilot: Developer’s Complete Guide
How to Use GitHub Copilot: Developer’s Complete Guide
GitHub Copilot has fundamentally changed how many developers write code. Instead of constantly switching between your editor and documentation, Stack Overflow, or AI chat windows, Copilot brings intelligent code suggestions directly into your development environment.
But there is a meaningful gap between developers who use Copilot passively (accepting the occasional autocomplete suggestion) and those who use it as a full-fledged coding partner. The tool has evolved well beyond simple code completion. It now includes chat, agent mode, slash commands, custom instructions, and the ability to understand your entire workspace context.
This guide covers everything from initial setup to advanced workflows, so you can get the most out of Copilot regardless of which IDE you use or what language you code in.
What Is GitHub Copilot?
GitHub Copilot is an AI-powered coding assistant developed by GitHub (owned by Microsoft). It uses large language models trained on code to provide:
- Inline code suggestions as you type
- Chat-based assistance for questions, explanations, and generation
- Agent mode for autonomous multi-file edits
- Code review assistance
- Terminal command suggestions
- Pull request summaries
Copilot works inside your code editor and understands the context of your project, including open files, file structure, dependencies, and coding patterns.
GitHub Copilot Plans (2026)
GitHub offers five tiers, each with different capabilities:
| Plan | Price | Completions | Premium Requests | Best For |
|---|---|---|---|---|
| Free | $0 | 2,000/mo | 50/mo | Students, casual use |
| Pro | $10/mo | Unlimited | 300/mo | Individual developers |
| Pro+ | $39/mo | Unlimited | 1,500/mo | AI power users |
| Business | $19/user/mo | Unlimited | 300/user/mo | Teams and organizations |
| Enterprise | $39/user/mo | Unlimited | 1,000/user/mo | Large enterprises |
Important notes about pricing:
- The Free plan is a solid starting point but the 2,000 completion limit and 50 premium request cap can run out fast during active development
- Pro is free for verified students, teachers, and maintainers of popular open-source projects
- Pro+ gives access to all available AI models, including Claude Opus 4 and OpenAI o3
- Premium requests power chat, agent mode, code reviews, and model selection
- When you exceed your premium request allocation, additional requests cost $0.04 each
Step 1: Set Up GitHub Copilot in VS Code
VS Code is the most popular editor for Copilot, so we will start there. The setup process takes about five minutes.
Install the Extension
Verify It Is Working
After installation, open any code file and start typing. You should see gray, ghosted text suggestions appearing ahead of your cursor. If you see suggestions, Copilot is working.
Quick verification test:
test.pydef fibonacci(If no suggestions appear, check that:
- You are signed into GitHub in VS Code
- Your Copilot subscription is active
- The Copilot icon in the bottom status bar shows as active (not crossed out)
Other IDE Support
Copilot is not limited to VS Code. It also works in:
| IDE | Extension/Plugin |
|---|---|
| Visual Studio | Built-in (2022+) |
| JetBrains IDEs | GitHub Copilot plugin (IntelliJ, PyCharm, WebStorm, etc.) |
| Neovim | github/copilot.vim |
| Vim | github/copilot.vim |
| Azure Data Studio | GitHub Copilot extension |
| Xcode | GitHub Copilot for Xcode |
The core experience is similar across editors, though some features like agent mode and advanced chat are most fully developed in VS Code.
Step 2: Use Inline Code Suggestions
Inline suggestions are the foundation of Copilot. As you type, Copilot predicts what you are about to write and shows it as gray ghost text.
Accepting and Rejecting Suggestions
| Action | Keyboard Shortcut |
|---|---|
| Accept full suggestion | Tab |
| Accept word-by-word | Ctrl+Right Arrow (Cmd+Right on Mac) |
| Reject suggestion | Esc |
| See next suggestion | Alt+] |
| See previous suggestion | Alt+[ |
| Open suggestions panel | Ctrl+Enter |
Tips for Better Inline Suggestions
1. Write clear function names and signatures
Copilot reads your function name and parameter names to understand what you want. A function called calculate_monthly_revenue(transactions, month) gives Copilot far more context than calc(data, m).
2. Add comments before your code
# Parse a CSV file and return the total sales amount
for each product category as a dictionary
def parse_sales_data(filepath):
That comment tells Copilot exactly what the function should do, resulting in much more accurate suggestions.
3. Provide type hints
def filter_users(users: list[dict], min_age: int) -> list[dict]:
Type hints reduce ambiguity and help Copilot generate type-correct code.
4. Open related files
Copilot looks at your open tabs for context. If you are writing a function that uses a class defined in another file, open that file in a tab so Copilot can reference it.
What Copilot Excels At
- Boilerplate code — Repetitive patterns, CRUD operations, API endpoints
- Test generation — Writing unit tests based on existing functions
- Common algorithms — Sorting, searching, string manipulation
- Framework-specific code — React components, Express routes, Django views
- Data transformations — Parsing, filtering, mapping operations
- Regular expressions — Pattern matching from natural language descriptions
- Documentation — Docstrings, comments, README sections
Step 3: Use Copilot Chat
Copilot Chat is an AI conversation interface built into your editor. It is more than just a chatbot; it understands your code, your workspace, and your development context.
Opening Copilot Chat
- Chat panel: Click the Copilot icon in the sidebar or press
Ctrl+Shift+I(Cmd+Shift+I on Mac) - Inline chat: Place your cursor in the code and press
Ctrl+I(Cmd+I on Mac) for a focused inline dialog - Quick chat: Press
Ctrl+Shift+Alt+Lfor a floating chat window
Chat Participants
Copilot Chat uses participants (prefixed with @) to direct your question to the right context:
| Participant | What It Does |
|---|---|
@workspace |
Searches across your entire project for relevant context |
@vscode |
Answers questions about VS Code settings and features |
@terminal |
Helps with terminal commands and shell scripts |
@github |
Searches GitHub issues, pull requests, and repositories |
Example:
@workspace Where is the user authentication middleware defined in this project?
Copilot searches your workspace files and returns the location with relevant code snippets.
Practical Chat Examples
Explain unfamiliar code:
Explain this regex pattern and give me examples of strings it would match:
^(?=.[A-Z])(?=.\d)[A-Za-z\d@$!%*?&]{8,}$
Generate a component:
@workspace Create a React component for a paginated data table that accepts an array of objects and displays them with sortable columns. Use the same styling conventions as the existing components in this project.
Debug an error:
I'm getting this error when running my tests:
TypeError: Cannot read property 'map' of undefined at UserList.render
Here's the component code. What's causing this and how do I fix it?
Refactor code:
Select a block of code, open inline chat (Ctrl+I), and type:
Refactor this to use async/await instead of .then() chains and add proper error handling
Step 4: Master Slash Commands
Slash commands are shortcuts that tell Copilot Chat to perform specific actions without you having to type out a full prompt.
Essential Slash Commands
| Command | What It Does | Example |
|---|---|---|
/explain |
Explains selected code | Select code, then /explain |
/fix |
Suggests fixes for problems | /fix on code with errors |
/tests |
Generates unit tests | Select a function, then /tests |
/doc |
Generates documentation | Select code, then /doc |
/new |
Creates a new file or project | /new Express API with user routes |
/clear |
Clears chat history | /clear |
/delegate |
Hands off work to the coding agent on GitHub | /delegate complete the API tests |
Using Slash Commands Effectively
Generate tests for a function:
/testsDocument your code:
/docFix broken code:
/fixStep 5: Use Agent Mode
Agent Mode is where Copilot becomes genuinely autonomous. Instead of just suggesting code, it can plan and execute multi-step tasks across multiple files, run terminal commands, install packages, and iterate on its own work.
How Agent Mode Works
Add a dark mode toggle to this React app. It should persist the user's preference in localStorage and apply a dark color scheme to all existing components.
– Identifies relevant files
– Creates or modifies components
– Updates CSS/styling
– Adds localStorage logic
– Runs tests if applicable
When to Use Agent Mode
Agent Mode shines for tasks that span multiple files:
- Feature implementation — Adding a new feature that touches multiple components
- Refactoring — Renaming variables across a codebase, changing an architecture pattern
- Bug fixes — When the bug involves interactions between multiple files
- Migration tasks — Updating a dependency, converting code to a new framework
- Project scaffolding — Setting up a new project with standard structure
Agent Mode Best Practices
Step 6: Set Up Custom Instructions
Custom instructions let you tell Copilot about your project’s conventions, preferred patterns, and coding standards. This context persists and improves every suggestion.
Repository-Level Instructions
Create a file at .github/copilot-instructions.md in your repository root. This file is automatically included in Copilot’s context for everyone working on the project.
Example .github/copilot-instructions.md:
# Copilot Instructions
Language and Framework
- This is a TypeScript project using Next.js 15 and React 19
- Use functional components with hooks, never class components
- All components should use TypeScript with strict types (no
any)
Code Style
- Use named exports, not default exports
- Prefer
const arrow functions for component definitions
- Use Tailwind CSS for styling, never inline styles or CSS modules
- Error handling should use custom error classes from
lib/errors.ts
Testing
- Write tests using Vitest and React Testing Library
- Test files go in
__tests__ directories next to the code they test
- Use
describe and it blocks, not test
- Mock external API calls using MSW
Naming Conventions
- Components: PascalCase (e.g., UserProfile.tsx)
- Hooks: camelCase starting with "use" (e.g., useAuth.ts)
- Utils: camelCase (e.g., formatDate.ts)
- Types/Interfaces: PascalCase with no prefix (e.g., User, not IUser)
Architecture
- API routes go in
app/api/
- Shared components go in
components/shared/
- Page-specific components go in
components/[page-name]/
- Server actions go in
actions/
User-Level Instructions
For personal preferences that apply across all your projects, you can configure custom instructions in your VS Code settings or GitHub account settings.
In VS Code, open Settings (Ctrl+,) and search for “Copilot instructions” to add your personal coding preferences.
Step 7: Use Copilot in the Terminal
Copilot can suggest and explain terminal commands, which is especially useful for developers who do not memorize every CLI flag.
Terminal Inline Suggestions
In VS Code’s integrated terminal, Copilot can suggest commands as you type, similar to how it suggests code. Start typing a command and look for ghost text suggestions.
Ask Copilot for Commands
Use the @terminal participant in Copilot Chat:
@terminal How do I find all JavaScript files modified in the last 7 days that contain the word "deprecated"?
Copilot responds with the exact command:
find . -name "*.js" -mtime -7 -exec grep -l "deprecated" {} \;
This saves significant time when working with complex CLI tools like git, docker, kubectl, ffmpeg, or aws.
Step 8: Use Copilot for Code Review
Copilot can review code in pull requests on GitHub.com, catching issues before human reviewers spend time on them.
How to Use Copilot Code Review
What Copilot Looks for in Reviews
- Potential bugs and logic errors
- Security vulnerabilities
- Performance issues
- Deviation from common patterns
- Missing error handling
- Unused variables or imports
This works as a first pass that catches obvious issues before human reviewers look at the code, saving everyone time.
Real-World Workflow: Building a Feature with Copilot
Let us walk through a practical example of using Copilot to build a feature from start to finish.
Task: Add a search endpoint to a Node.js Express API that searches products by name, category, and price range.
Step 1: Plan with Chat
@workspace I need to add a product search endpoint to this Express API.
Look at the existing route structure and database queries.
What approach would be consistent with the current codebase?
Copilot examines your project and suggests an approach that matches your existing patterns.
Step 2: Generate the Route
Open your routes file and add a comment:
// GET /api/products/search
// Query params: name (partial match), category (exact match),
// minPrice, maxPrice
// Returns paginated results with total count
Copilot generates the route handler based on your comment and existing code patterns.
Step 3: Generate Tests
Select the new route handler and type /tests in Copilot Chat. Copilot generates test cases covering:
- Successful search with all parameters
- Search with partial name match
- Category filtering
- Price range filtering
- Empty results
- Invalid parameters
- Pagination
Step 4: Generate Documentation
Select the route handler and type /doc to generate JSDoc comments with parameter descriptions, return types, and example responses.
Step 5: Review with Agent
If you need to make additional changes (like adding the route to your Swagger docs or updating the README), switch to Agent Mode and describe the remaining work.
Copilot Across Programming Languages
Copilot works with virtually every programming language, but its effectiveness varies based on the volume of training data available.
| Language | Copilot Quality | Notes |
|---|---|---|
| Python | Excellent | Strongest language support |
| JavaScript/TypeScript | Excellent | Great for React, Node, and frameworks |
| Java | Very good | Strong for Spring Boot, enterprise patterns |
| C# | Very good | Solid .NET and Unity support |
| Go | Very good | Clean idiomatic suggestions |
| Rust | Good | Handles ownership/borrowing concepts |
| C/C++ | Good | Works well for common patterns |
| Ruby | Good | Solid Rails support |
| PHP | Good | Laravel and WordPress patterns |
| Swift | Good | iOS development support |
| SQL | Good | Query generation from descriptions |
| Shell/Bash | Good | Script generation and command suggestions |
Frequently Asked Questions
Is GitHub Copilot free?
GitHub Copilot offers a Free tier with 2,000 code completions and 50 premium requests per month. The Pro plan at $10 per month provides unlimited completions and 300 premium requests. Verified students, teachers, and maintainers of popular open-source projects get Pro for free.
Does Copilot use my code to train its models?
For individual Free and Pro plans, OpenAI may use your data for model training unless you opt out in your GitHub settings. For Business and Enterprise plans, your code snippets and prompts are never used for training public models. Check your settings under GitHub > Settings > Copilot to manage your data preferences.
Can Copilot write entire applications?
Copilot can generate significant portions of an application, especially with Agent Mode. However, it works best as a collaborative partner rather than a fully autonomous developer. You still need to provide direction, review output, and make architectural decisions. Think of it as a very capable junior developer who needs guidance on the “what” and “why” while being good at the “how.”
What AI models does Copilot use?
Copilot Free and Pro use a default model optimized for code. Pro+ subscribers get access to all available models including Claude Opus 4 and OpenAI o3, which they can select in Copilot Chat. The ability to switch between models is useful when different models have different strengths for specific tasks.
Is Copilot worth the cost for hobbyist developers?
Start with the Free tier. If you find yourself hitting the 2,000 completion limit regularly or wanting more from chat, the $10 Pro plan is a reasonable investment. Studies show that developers using Copilot report being up to 55% more productive at writing code, which translates into real time savings even for personal projects.
Tips for Maximizing Copilot’s Effectiveness
userEmailAddress gives better context than x.github/copilot-instructions.md pays dividends on every suggestionWrapping Up
GitHub Copilot is most powerful when you treat it as an integrated part of your development process rather than an occasional helper. Set up custom instructions so it understands your codebase conventions. Use inline suggestions for routine code. Turn to Chat when you need explanations or focused generation. Switch to Agent Mode for larger tasks that span multiple files. For more insights, check out our guide on How to Use Stable Diffusion.
The Free tier is enough to experience the core value. If you write code regularly, the $10 Pro plan is arguably the best return on investment in the developer tools market right now. And if you want access to every available AI model and maximum premium requests, Pro+ at $39 per month gives you that ceiling.
Start by installing the extension, writing a few functions with Copilot’s help, and gradually incorporating Chat and Agent Mode into your workflow. Most developers find that within a week, they cannot imagine going back to coding without it.
Ready to get started?
Try GitHub Copilot Free →Find the Perfect AI Tool for Your Needs
Compare pricing, features, and reviews of 50+ AI tools
Browse All AI Tools →Get Weekly AI Tool Updates
Join 1,000+ professionals. Free AI tools cheatsheet included.