Claude Code is Anthropic's official AI coding agent, used by developers at companies from startups to Fortune 500. Learn more →
Claude Code IntegrationHow to Use Claude Code in VS Code
VS Code users have two ways to use Claude Code: the official extension for integrated workflows, or the terminal for full CLI power. Here's how to set up both.
You can use Claude Code in VS Code two ways: install the official VS Code extension for an integrated visual experience with inline diffs and checkpoints, or run the CLI directly in VS Code's built-in terminal. The extension is the recommended approach for most users, but both methods work well — and you can use them together.
This guide covers both setup options step by step, plus keyboard shortcuts, plan mode, and workflow tips that make Claude Code and VS Code a genuinely productive combination.
What Is Claude Code?
Claude Code is Anthropic's AI coding assistant that runs in your terminal. Unlike autocomplete tools that suggest the next few characters, Claude Code understands your entire codebase and can make complex, multi-file changes based on natural language instructions. It is powered by Claude Sonnet 4.5 by default, with the option to switch to Claude Opus 4.6 or Claude Haiku 4.5.
You tell it what you want in plain English. It reads your code, plans the changes, and implements them—asking for permission along the way.
In VS Code, you can use Claude Code through:
- The integrated terminal — Full CLI experience, no extension needed
- The official VS Code extension — Native graphical interface with inline diffs, @-mentions, plan review, checkpoints, and keyboard shortcuts (this is the recommended approach)
- Both together — Use the extension for quick tasks, terminal for advanced CLI-only features
Option 1: Using Claude Code from VS Code's Terminal
The simplest approach. If you've already installed Claude Code CLI, just open VS Code's terminal and run it.
Step 1: Open the Integrated Terminal
Press Ctrl+` (backtick) on Windows/Linux or Cmd+` on Mac. This opens VS Code's built-in terminal.
Step 2: Navigate to Your Project
The terminal usually opens in your workspace root. If not, use cd to navigate to your project folder.
Step 3: Start Claude Code
Type claude and press Enter. Claude Code starts and automatically reads your project structure.
cd /path/to/your/project
claude
That's it. You now have Claude Code running alongside your editor.
Split your view
Drag the terminal panel to the right side of VS Code. Now you have your code on the left and Claude Code on the right—perfect for watching changes as they happen.
Option 2: Installing the VS Code Extension
The official extension provides a more integrated experience with visual panels and editor shortcuts.
Step 1: Check VS Code Version
The extension requires VS Code 1.98.0 or higher. Check your version under Help > About, and update if needed.
Step 2: Open Extensions
Press Cmd+Shift+X (Mac) or Ctrl+Shift+X (Windows/Linux) to open the Extensions panel.
Step 3: Search and Install
Search for "Claude Code" and find the official Anthropic extension (publisher: anthropic). Click Install. If the extension does not appear after installation, restart VS Code or run "Developer: Reload Window" from the Command Palette.
Step 4: Authenticate
The extension will prompt you to sign in with your Anthropic account. Follow the authentication flow. If you use a third-party provider like Amazon Bedrock or Google Vertex AI, disable the login prompt in settings and configure your provider instead.
Step 5: Open the Claude Panel
The quickest way: click the Spark icon in the Editor Toolbar (top-right corner of the editor). You can also click "Claude Code" in the Status Bar (bottom-right), or use the Command Palette (Cmd/Ctrl+Shift+P and type "Claude Code").
Extension Features
The VS Code extension adds:
- Draggable panel — Chat interface you can position in the sidebar, editor area, or secondary sidebar. Drag the panel to wherever you prefer it.
- Inline diff previews — Side-by-side comparison of original and proposed changes with accept/reject buttons
- @-mention files with line ranges — Type
@followed by a file name, or pressOption+K(Mac) /Alt+K(Windows/Linux) to insert a reference like@auth.ts#5-10 - Plan mode — Claude describes what it will do and waits for approval before making changes
- Auto-accept mode — Claude makes edits without asking, for fast iteration
- Checkpoints — Track Claude's file edits and rewind to any previous state with fork, rewind, or fork-and-rewind options
- Multiple conversations — Open additional tabs or windows for parallel tasks, each with independent history and context
- Conversation history — Browse and search past conversations by keyword or time period
- Status bar integration — See current model, session info, and context usage
- Plugin management — Install and manage plugins via
/pluginswith a graphical interface - Browser integration — Type
@browserto connect to Chrome for testing web apps (requires Claude in Chrome extension)
Keyboard Shortcuts in VS Code
Master these shortcuts to move faster:
I documented my full VS Code + Claude Code configuration in a free guide if you want to replicate the exact setup.
VS Code Terminal Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+` / Cmd+` |
Toggle integrated terminal |
Ctrl+Shift+` |
Create new terminal |
Ctrl+PageDown |
Switch to next terminal |
Ctrl+PageUp |
Switch to previous terminal |
Cmd+K (in terminal) |
Clear terminal |
Claude Code Shortcuts (Inside Terminal CLI)
| Shortcut | Action |
|---|---|
Shift+Tab |
Cycle permission modes |
Ctrl+R |
Searchable prompt history |
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit Claude Code |
/ |
Open slash command menu |
@ |
Reference a file |
Shift+Enter |
Add a new line without sending |
Extension Shortcuts
| Shortcut | Action |
|---|---|
Cmd+Esc / Ctrl+Esc |
Toggle focus between editor and Claude prompt |
Cmd+N / Ctrl+N |
Start a new conversation (Claude must be focused) |
Option+K / Alt+K |
Insert @-mention reference from current selection |
Cmd+Shift+Esc / Ctrl+Shift+Esc |
Open a new conversation in a separate tab |
Cmd/Ctrl+Shift+P then "Claude Code" |
Open Claude commands in Command Palette |
Customize your shortcuts: Open Cmd/Ctrl+K, Cmd/Ctrl+S to access keyboard shortcuts. Search for "Claude" to rebind any command to your preferred keys.
Workflow Tips for VS Code + Claude Code
Split Terminal Layout
Keep one terminal for Claude Code and another for running your app/tests. Use Ctrl+Shift+` to create terminals, then drag to split.
Use the @ Symbol for File References
In Claude Code, type @filename to reference specific files. Claude will focus on those files when answering. Example: "Refactor @auth.js to use async/await". In the extension, press Option+K / Alt+K to automatically insert file path and line numbers from your current selection.
Watch Files Side-by-Side
Open the file Claude is editing, then watch changes appear in real-time. Use Cmd/Ctrl+\ to split the editor if you want to see multiple files.
Use Source Control Panel
After Claude makes changes, open VS Code's Source Control panel (Ctrl+Shift+G) to review all modifications before committing.
Dedicate a Workspace for Claude
Create a VS Code workspace with your preferred terminal and panel layout for Claude Code work. Save it and reopen whenever you need it.
VS Code Extension vs. CLI: What's Different
The extension and CLI share the same conversation history and settings, but some features are only available in one or the other.
| Feature | Extension | CLI (Terminal) |
|---|---|---|
| Commands and skills | Subset (type / to see) |
All |
| MCP server config | No (configure via CLI, use in extension) | Yes |
| Checkpoints / rewind | Yes | Yes |
! bash shortcut |
No | Yes |
| Tab completion | No | Yes |
| Plugin management UI | Yes (/plugins) |
CLI commands |
To continue an extension conversation in the CLI, run claude --resume in the terminal.
Comparing Claude Code to Other VS Code AI Tools
| Feature | Claude Code | GitHub Copilot | Cursor |
|---|---|---|---|
| Inline autocomplete | No | Yes | Yes |
| Multi-file changes | Yes | Limited | Yes |
| Codebase understanding | Full project | Current file + context | Full project |
| Natural language commands | Yes (primary) | Yes (chat) | Yes |
| Run shell commands | Yes | No | Limited |
| Terminal-based | Yes (CLI + extension) | No | No |
| MCP tool integrations | Yes (hundreds) | Limited | Limited |
| Subagents / parallel tasks | Yes | No | No |
| Pricing model | Usage-based | Subscription | Subscription |
Use them together
Claude Code and GitHub Copilot serve different purposes. Copilot for fast autocomplete while typing. Claude Code for larger tasks, debugging, and understanding code. Many developers use both.
Common Mistakes
- Running Claude Code in a tiny terminal: Give the terminal enough height to see responses properly. Resize by dragging the terminal border or use
Cmd/Ctrl+Jto toggle panel. - Not using the right working directory: Claude Code reads from the current directory. Make sure your terminal is in the project root before starting.
- Forgetting VS Code has its own git UI: After Claude makes changes, use VS Code's Source Control panel to review diffs. It's often clearer than terminal git.
- Not saving files before asking Claude to read them: The extension has an autosave feature enabled by default, but verify this in settings. If using the CLI in the terminal, save with
Cmd/Ctrl+Sbefore referencing changed files. - Terminal font too small: Claude Code output can be dense. Increase terminal font size in VS Code settings for readability.
- Missing the Spark icon: The Spark icon only appears in the Editor Toolbar when you have a file open. If you do not see it, check your VS Code version (1.98.0+ required), restart VS Code, or try the Status Bar button at the bottom-right instead.
Setting Up Your Ideal VS Code Layout
Here's a recommended layout for Claude Code work:
+------------------+------------------+
| | |
| Editor | Editor |
| (main file) | (related file) |
| | |
+------------------+------------------+
| |
| Terminal (Claude Code) |
| |
+-------------------------------------+
To set this up:
- Open your main file
- Press
Cmd/Ctrl+\to split the editor - Open a related file in the second pane
- Press
Ctrl+`to open terminal at bottom - Resize the terminal to about 30-40% of window height
- Run
claudein the terminal
FAQ
Does Claude Code work with VS Code Remote (SSH/Containers)?
Yes. If you have Claude Code installed on the remote machine, you can run it from VS Code's remote terminal. The extension also works in remote sessions.
Can I use Claude Code with multiple VS Code windows?
Yes. Each VS Code window can have its own Claude Code session in its terminal. Sessions are independent.
Does the extension work offline?
No. Claude Code requires an internet connection to communicate with Anthropic's API.
Can Claude Code edit files I have open in VS Code?
Yes. Claude Code modifies files on disk. VS Code will detect the changes and update the editor. Save your work before letting Claude edit to avoid conflicts.
Which is better: terminal or extension?
The extension is the recommended approach for most users. It provides inline diffs, checkpoints, plan mode, and @-mention file references in a visual interface. The CLI gives access to every command and feature, plus tab completion and the ! bash shortcut. They share conversation history, so you can switch freely. Many developers use both.
What are checkpoints and how do I use them?
Checkpoints track Claude's file edits so you can rewind to any previous state. Hover over any message in the extension to see the rewind button with three options: fork conversation from that point, rewind code to that point, or both. This is useful when Claude goes down the wrong path.
What is plan mode?
Plan mode is a permission setting where Claude describes what it will do and waits for your approval before making any changes. Click the mode indicator at the bottom of the prompt box to switch between normal mode, plan mode, and auto-accept mode. You can set the default in VS Code settings.
Related Guides
- How to Install Claude Code — complete installation guide
- Slash Commands in Claude Code — all the shortcuts
- Claude Code vs Cursor — detailed comparison
- How to Change Models in Claude Code — Opus vs Sonnet vs Haiku
Free: The AI Growth Breakdown
See how one business went from 0 to 600 daily visitors in 14 days using AI. The exact tools and results.
Get the Free Breakdown →