This content originally appeared on DEV Community and was authored by Ravgeet Dhillon
GitHub Copilot is already an incredible tool for autocompleting code, but if you haven’t tried Copilot Chat, you’re missing out on one of the most powerful AI developer workflows available today.
In this post, you’ll walk through:
How to use Copilot Chat in VS Code
What it’s best at
Real-world prompts you can use right away
What Is GitHub Copilot Chat?
Copilot Chat brings the power of ChatGPT directly into VS Code, allowing you to ask natural language questions about your code, request explanations, generate tests, fix bugs, refactor logic, and more — without ever leaving your editor.
It’s like having an AI pair programmer that:
Understands your code context
Works inline or in a chat panel
Helps you learn, debug, and ship faster
What Can You Use Copilot Chat For?
Here are some powerful use cases:
Code Understanding & Explanation
You can highlight any block of code and ask:
“Explain what this code does”
“What is the time complexity here?”
“Why am I getting this TypeError?”
Code Improvement & Refactoring
Ask it to:
“Refactor this function to be cleaner”
“Optimize this loop”
“Suggest better variable names”
Test Generation
Save hours writing boilerplate with prompts like:
“Write unit tests for this function using Jest”
“Generate test cases for edge inputs”
Code Conversion & Migration
Let it help with transitions like:
“Convert this JS code to TypeScript”
“Rewrite this to use async/await”
“Switch from useEffect to React Query”
General Cleanup
Ask it to:
“Remove unused imports”
“Simplify this logic”
“Make this more readable”
Some Example Prompts You Can Use Right Now
Use Case | Example Prompt |
---|---|
Understand Code | Explain this function step by step |
Improve Performance | Optimize this loop for large datasets |
Refactor Logic | Make this code more readable and concise |
Convert Language | Translate this from Python to JavaScript |
Debug Errors | Fix the error in this fetch call |
Generate Tests | Write unit tests for this React component |
Learn Concepts | What is useMemo in React and when to use it? |
Clean Up Code | Remove all unused variables from this file |
Tip: You can highlight a code block and then open Copilot Chat to get smarter, context-aware answers.
How to Enable Copilot Chat in VS Code
Install the GitHub Copilot Chat extension from the VS Code Marketplace
Make sure you’re signed in to GitHub with an active Copilot plan
Open the Copilot Chat panel or use
Cmd/Ctrl + I
to start inline chatHighlight code and right-click → Ask Copilot
Final Thoughts
Copilot Chat takes the promise of AI-assisted development to the next level. It’s not just about writing code faster — it’s about thinking through problems, debugging more efficiently, and learning as you go, all inside your editor.
This content originally appeared on DEV Community and was authored by Ravgeet Dhillon