Lesson 10 of 40AI coding tools
GitHub Copilot in VS Code
Use Copilot's suggestions, chat and agents in VS Code, give it the right context and instructions, and know when to reach for Claude Code instead.
GitHub Copilot is the AI assistant built into VS Code. It works at three speeds: suggestions that appear as you type, a chat you can ask questions in, and agents that plan and make changes across many files. On GitHub itself it can also review pull requests and work on issues by itself. This lesson walks through each layer, how to give Copilot the right context, how to customise it for your project, and how it fits alongside Claude Code. Copilot changes often (features get renamed, shortcuts move), so treat code.visualstudio.com/docs/copilot as the source of truth for current details.
Getting started
Copilot Chat has been built into VS Code since version 1.116 (April 2026), so on a current VS Code there is nothing to install. To sign in, hover over the Copilot icon in the Status Bar (the bar along the bottom of the window), choose Use AI Features, and pick a sign-in method. Without a subscription you get Copilot Free, which includes a monthly allowance of completions and chat. Free and paid tiers exist for individuals and organizations; check GitHub's site for what each includes.
Layer 1: suggestions as you type
Inline suggestions appear as grey "ghost text" ahead of your cursor. Copilot predicts what you are about to type, from a few characters to a whole function.
Next edit suggestions (NES) go one step further. After you make a change, Copilot predicts the next edit you will need somewhere else, like updating the other three places that use a variable you just renamed. An arrow appears in the gutter (the margin beside the line numbers) to show where.
| Action | Key |
|---|---|
| Accept a suggestion | Tab |
| Accept the next word only | Cmd+Right |
| Dismiss | Esc |
| Jump to a next edit suggestion, then accept | Tab, then Tab |
| Open the Chat view | Ctrl+Cmd+I |
| Inline chat | Cmd+I |
| Action | Key |
|---|---|
| Accept a suggestion | Tab |
| Accept the next word only | Ctrl+Right |
| Dismiss | Esc |
| Jump to a next edit suggestion, then accept | Tab, then Tab |
| Open the Chat view | Ctrl+Alt+I (Windows) |
| Inline chat | Ctrl+I |
Accepting word by word is underrated. When a suggestion starts well and then drifts, take the good part and type the rest yourself.
qty to quantity. An arrow appears in the gutter a few lines down. What is it?Layer 2: chat
There are three places to chat:
- The Chat view, a panel at the side for longer conversations (Ctrl+Cmd+I on macOS, Ctrl+Alt+I on Windows).
- Inline chat (Cmd+I or Ctrl+I), which opens right in the editor at your cursor, for a quick change to the code in front of you. It works in the terminal too, which is handy for "what command does X?".
- Quick Chat, a small floating box for a fast question without opening the panel.
Slash commands give common requests a shortcut: /explain explains code, /fix proposes a fix, /tests writes tests, /plan starts a plan, /init generates a project instructions file, /models opens the model picker, and /compact and /clear manage the conversation.
Layer 3: agents
The Chat view has built-in agents (earlier versions called these chat modes). You pick one in the chat input:
| Agent | What it does | Changes code? |
|---|---|---|
| Ask | Answers and explains | No |
| Plan | Researches the codebase and proposes a plan for you to approve | No |
| Agent | Works across many files, edits, runs terminal commands within your approval level | Yes |
The rhythm is the same as with any coding agent: understand with Ask, design with Plan, build with Agent, then read the diff. If you see older tutorials that mention an "Edit mode" or chat participants like @workspace, they describe earlier versions.
Match each task to the built-in agent that fits.
Giving Copilot context
Copilot answers better when it sees the right code. In the chat input, type # to attach context:
#codebaselets Copilot search the whole project for what is relevant.#selectionattaches the code you have selected.- A file by name, like
#checkout.ts. - Folders, symbols, terminal output, source control changes and tools are also available from the # menu.
You can also drag files from the Explorer onto the chat, or use the Add Context button. As with Claude Code, point at specific files rather than pasting large blocks of code.
Customising Copilot for your project
You do not want to repeat "we use pytest, not unittest" in every chat. Copilot reads instruction files from your repo automatically.
- my-app/
- AGENTS.mdread by default; shared with other AI tools
- .github/
- copilot-instructions.mdrepo-wide instructions
- instructions/
- python.instructions.mdapplyTo: "**/*.py"
- prompts/
- new-endpoint.prompt.mdrun as /new-endpoint
- agents/
- reviewer.agent.mda custom agent
- .vscode/
- mcp.jsonMCP servers for this workspace
- src/
.github/copilot-instructions.mdholds repo-wide rules: commands, conventions, things to avoid..github/instructions/*.instructions.mdfiles hold rules for certain paths. Frontmatter likeapplyTo: "**/*.py"means the rules only apply to Python files.- AGENTS.md at the repo root is supported and on by default, and CLAUDE.md is read too. One well-kept instructions file can serve both Copilot and Claude Code.
- Prompt files in
.github/prompts/*.prompt.mdare reusable prompts.new-endpoint.prompt.mdruns as/new-endpoint. - Custom agents in
.github/agents/*.agent.mdhave frontmatter with a name, description and the tools they may use. Agent skills and hooks also exist; see the docs.
---
applyTo: "**/*.py"
---
- Use pytest for tests; put them in tests/ mirroring src/.
- Type-hint every public function.
- Use pathlib, not os.path.Which file should a rule go in? Ask who needs it and when. A rule every request should follow belongs in the repo-wide file. A rule for one language or folder belongs in a path-specific file, so it does not clutter unrelated requests. A task you repeat every week belongs in a prompt file.
The Context Engineering lesson covers what makes these files good.
Models and MCP
The chat input has a model picker (also /models), including an Auto option that chooses for you. Claude models are available alongside OpenAI and Google models. Which ones you see depends on your plan, and organization admins can restrict them. You can also bring your own API key.
Copilot can use MCP servers, plug-ins that give it extra tools like querying a database or reading tickets (the MCP and Tools lesson explains MCP). Workspace servers go in .vscode/mcp.json:
{
"servers": {
"my-server": {
"type": "stdio",
"command": "npx",
"args": ["example-mcp-server"]
}
}
}Replace example-mcp-server with the package name and arguments from the server's own docs. A remote server uses "type": "http" with a "url" instead.
Copilot on GitHub
Two features work on github.com rather than in the editor:
The cloud agent (formerly called the coding agent) picks up an issue you assign to it.
Copilot or Claude Code?
You do not have to choose. They coexist in the same editor and can read the same AGENTS.md or CLAUDE.md. A practical split:
| Copilot shines at | Claude Code shines at |
|---|---|
| Suggestions while you type, word by word | Long, multi-step tasks driven from a goal |
| Quick inline edits with Cmd+I / Ctrl+I | Fine-grained permission rules and modes |
| Issue to PR on GitHub with the cloud agent | Scripting with claude -p, hooks, subagents |
| Switching between many vendors' models | Working the same way in terminal, IDE and CI |
A common setup: Copilot for completions and quick questions, an agent (Copilot's Agent or Claude Code) for bigger changes, and one shared instructions file so both follow the same rules.
- inline suggestion
- Grey ghost text Copilot proposes as you type; Tab accepts it.
- next edit suggestion
- A predicted follow-on edit elsewhere in the file, shown by an arrow in the gutter.
- inline chat
- A chat box that opens at your cursor in the editor or terminal for a quick change.
- Agent (Copilot)
- The built-in agent that edits across files and runs commands with your approval.
- custom instructions
- Repo files like copilot-instructions.md that Copilot reads automatically for every request.
- prompt file
- A reusable prompt in .github/prompts that runs as a slash command.
- cloud agent
- Copilot working on an assigned GitHub issue in a cloud environment and opening a PR.