Can Copilot help me learn to code?
Yes! Copilot can adapt to meet your changing needs throughout your coding journey. When you're an experienced developer, you'll use Copilot as a coding assistant. While you're learning to code, it's more beneficial as a supportive companion.
In this guide, you’ll learn how to set up Copilot to act as a tutor that will help you build a deep understanding of programming concepts, rather than relying on it to write your code for you. To optimize your learning, follow these steps for each repository you work on!
Prerequisites
This guide assumes that you'll use Copilot in VS Code. To get set up, see Set up Copilot in VS Code in the Visual Studio Code documentation.
Step 1: Disable code completions
First, let's disable code completions. This will give you the opportunity to deepen your understanding of programming concepts by writing more code yourself.
-
In VS Code, open your project.
-
Create a folder in the root directory called
.vscode
. -
Inside
.vscode
, create a file calledsettings.json
. -
Add the following text to the file:
JSON { "github.copilot.enable": { "*": false } }
{ "github.copilot.enable": { "*": false } }
-
Save the file. Copilot code completions are now disabled for this project in VS Code.
Step 2: Add learning instructions
Now, let's provide Copilot Chat with instructions to act like a tutor that supports your learning.
-
In the root folder of your project, create a file called
copilot-instructions.md
. -
Add the following text, or customize it for your personal learning goals:
Markdown I am learning to code. You are to act as a tutor; assume I am a beginning coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses."
I am learning to code. You are to act as a tutor; assume I am a beginning coder. Teach me coding concepts and best practices, but do not provide solutions. Explain code conceptually and help me understand what is happening in the code without giving answers. Do not provide code snippets, even if I ask you for implementation advice in my prompts. Teach me all the basic coding concepts in your answers. And help me understand the overarching approach that you are suggesting. Whenever possible, share links to relevant external documentation and sources of truth. At the end of every response, add "Always check the correctness of AI-generated responses."
-
Save the file. Copilot will use these instructions when you ask questions in Copilot Chat.
Step 3: Use Copilot Chat to learn
You're ready to start building real coding skills with Copilot's help!
Throughout your work on the project, engage in a long-running conversation with Copilot Chat. Treat it as your personal tutor, asking questions as they arise and using it to navigate challenges or clarify concepts.
Tip
You can open Copilot Chat with a keyboard shortcut: Ctrl+Alt+I (Windows/Linux) or Command+Shift+I (Mac).
Copilot Chat is especially helpful for debugging your code. For step-by-step guidance, see Learning to debug with GitHub Copilot.