VS Code AI Setup GuideΒΆ
A hands-on guide to configuring VS Code as a fully AI-powered development environment.
1. GitHub Copilot: The Three ModesΒΆ
GitHub Copilot in VS Code operates in three progressively more capable modes:
1.1 Completions (Inline)ΒΆ
The default experience. Copilot suggests code as you type, shown as ghost text.
Key settings (settings.json):
{
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": true,
"scminput": false
},
"editor.inlineSuggest.enabled": true
}
Tips:
Press
Tabto accept,Escto dismissPress
Alt+]/Alt+[to cycle through alternative suggestionsWrite a comment describing what you want, then let Copilot complete the code
1.2 Chat (Panel and Inline)ΒΆ
Open the chat panel (Ctrl+Shift+I or Cmd+Shift+I on macOS) to ask questions, explain code, or request changes.
Key chat participants:
Participant |
What it does |
|---|---|
|
Searches your entire codebase for context |
|
References terminal output |
|
Asks about VS Code settings and commands |
Slash commands in chat:
Command |
Effect |
|---|---|
|
Explain the selected code |
|
Fix problems in the selected code |
|
Generate tests for the selected code |
|
Generate documentation |
|
Scaffold a new file or project |
1.3 Agent ModeΒΆ
The most powerful mode. Agent mode can:
Read and edit multiple files
Run terminal commands and react to output
Search the codebase for context
Call MCP tools (databases, APIs, web browsers)
Iterate until tests pass
How to use it:
Open Copilot Chat (
Ctrl+Shift+I)Switch to Agent mode using the mode picker (dropdown at top of chat)
Describe your task in natural language
Agent proposes edits, runs commands, and iterates
What makes agent mode different from chat:
Chat gives you suggestions. Agent mode executes changes.
Agent can run terminal commands and read their output.
Agent can call MCP tools youβve configured.
Agent iterates: if a test fails, it reads the error and tries again.
2. Custom InstructionsΒΆ
Custom instructions tell Copilot how to behave in your project. They persist across sessions and apply to every team member who clones the repo.
2.1 Repository-Level InstructionsΒΆ
Create .github/copilot-instructions.md in your repo root:
# Project: Zero to AI Curriculum
## Code Style
- Python 3.12+, use type hints on all function signatures
- Prefer f-strings over .format() or %
- Use pathlib.Path instead of os.path
- Docstrings in Google format
## Project Structure
- Each phase is a numbered directory (00-course-setup/, 01-python/, etc.)
- Notebooks are ordered: 00_START_HERE.ipynb, 01_*, 02_*, ...
- Each directory has a README.md as the chapter entrypoint
## Testing
- Use pytest for all tests
- Run tests with: pytest tests/ -v
- Self-contained notebooks should use toy data, no API keys required
## What NOT to do
- Do not add API keys or secrets to any file
- Do not install packages globally; use .venv
- Do not modify notebooks that have execution outputs without re-running them
2.2 File-Scoped Instructions (.instructions.md)ΒΆ
For instructions that only apply to specific files or directories, create .instructions.md files with YAML frontmatter:
---
applyTo: "08-rag/**"
---
# RAG Notebook Rules
- All RAG notebooks must be self-contained (no API keys)
- Use TF-IDF or sklearn for retrieval in toy examples
- Every notebook must include a benchmark comparison table
- Link to 08_rag_technique_selection.md for technique context
Place this file anywhere in your repo. The applyTo glob pattern controls which files it affects.
2.3 Prompt Files (.prompt.md)ΒΆ
Reusable prompt templates that appear in the chatβs prompt picker:
---
mode: agent
tools: ["terminal", "codebase"]
description: "Add evaluation metrics to a notebook"
---
# Add Evaluation Metrics
Add precision@k, recall@k, MRR, and NDCG metrics to the selected notebook.
Create a benchmark set with at least 3 test queries across categories.
Compare at least 2 retrieval variants in a summary table.
Run all cells to verify they execute without errors.
Save as .github/prompts/add-evaluation.prompt.md. It will appear in the Copilot chat prompt picker.
3. Model SelectionΒΆ
Copilot supports multiple models. Switch per conversation using the model picker in the chat panel.
Model |
Best for |
Speed |
|---|---|---|
GPT-4o |
General coding, fast iteration |
Fast |
Claude Sonnet 4 |
Complex reasoning, long contexts |
Medium |
o3 |
Algorithmic problems, math, hard bugs |
Slow |
Gemini 2.0 Flash |
Quick questions, simple edits |
Fastest |
Routing strategy:
Start with GPT-4o or Gemini Flash for exploration
Switch to Claude Sonnet 4 or o3 when you hit a hard problem
Use the same model throughout a multi-step agent task (avoid switching mid-task)
4. MCP in VS CodeΒΆ
MCP (Model Context Protocol) connects Copilot agent mode to external tools: databases, browsers, APIs, file systems, and custom servers.
4.1 ConfigurationΒΆ
MCP servers are configured in .vscode/mcp.json (workspace-scoped) or your user settings.json (global):
Workspace-scoped (.vscode/mcp.json):
{
"servers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
},
"filesystem": {
"command": "npx",
"args": [
"-y", "@modelcontextprotocol/server-filesystem",
"/path/to/allowed/directory"
]
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"POSTGRES_CONNECTION_STRING": "${input:pgConnectionString}"
}
}
}
}
Project-root (.mcp.json) β also supported by Claude Code:
{
"mcpServers": {
"my-server": {
"command": "python",
"args": ["scripts/my_mcp_server.py"]
}
}
}
4.2 Popular MCP ServersΒΆ
Server |
What it does |
Install |
|---|---|---|
Playwright |
Browser automation, screenshots, web scraping |
|
Filesystem |
Read/write files outside workspace |
|
PostgreSQL |
Query database, inspect schema |
|
SQLite |
Local database access |
|
GitHub |
Issues, PRs, repository data |
|
Memory |
Persistent key-value store across sessions |
|
Brave Search |
Web search from agent mode |
|
Azure |
Azure resource management |
VS Code Azure MCP extension |
4.3 Using MCP Tools in Agent ModeΒΆ
Once configured, MCP tools appear automatically in agent mode. When the agent needs to browse a web page, query a database, or read a file, it calls the appropriate MCP tool.
Example agent prompt:
Check the current schema of the users table in our Postgres database,
then update the User model in src/models/user.py to match.
Add any missing fields and update the migration file.
The agent will:
Call the Postgres MCP server to inspect the schema
Read
src/models/user.pyCompare and update the model
Generate a migration
4.4 Verifying MCP ServersΒΆ
To check if your MCP servers are running:
Open the Command Palette (
Ctrl+Shift+P)Search βMCP: List Serversβ
Each server should show a green status
If a server fails to start, check:
Is the command installed? (
npx,python, etc.)Are environment variables set?
Check the Output panel β βMCPβ channel for error logs
5. Extensions That Complement CopilotΒΆ
Extension |
Purpose |
|---|---|
GitHub Copilot |
Core AI assistant |
GitHub Copilot Chat |
Chat panel and agent mode |
Pylance |
Python language server (provides Copilot with type info) |
Jupyter |
Notebook support |
Error Lens |
Inline error display (helps agent see errors faster) |
GitLens |
Git blame and history (useful context for agent) |
6. Recommended settings.json for AI-Powered DevelopmentΒΆ
{
// Copilot
"github.copilot.enable": { "*": true },
"chat.agent.enabled": true,
// Python
"python.analysis.typeCheckingMode": "basic",
"python.analysis.autoImportCompletions": true,
// Terminal (helps agent mode read output)
"terminal.integrated.scrollback": 10000,
// Editor (helps Copilot understand your code)
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
// Files (reduce noise in @workspace searches)
"files.exclude": {
"**/__pycache__": true,
"**/.pytest_cache": true,
"**/node_modules": true,
"**/*.egg-info": true
}
}
7. TroubleshootingΒΆ
Problem |
Fix |
|---|---|
Agent mode not available |
Update VS Code and Copilot extension to latest version |
MCP server wonβt start |
Check Output β MCP channel; verify command is installed |
Agent doesnβt use MCP tools |
Ensure youβre in Agent mode (not Chat mode); check server status |
Copilot ignores instructions |
Verify |
Model picker not showing |
Requires Copilot Pro or Business plan |
Slow responses |
Switch to a faster model (GPT-4o or Gemini Flash) |
Next: 02_mcp_deep_dive.md β the MCP protocol in depth