Recipe · Basic · 10 min
Claude Code in VS Code: extension or terminal, how to install
Install the official Claude Code extension for VS Code (anthropic.claude-code), compare it with the terminal CLI and use it safely in Cursor.
Tested with Claude Code 2.1.316 · reviewed
The problem
Most of us code in VS Code, and it is not obvious how to bring Claude Code into it: the extension, the CLI in the integrated terminal, or both? Is it free? Does it work in Cursor or Windsurf? And there is a new worry: on October 29, 2026, the Cursor marketplace served a tampered copy of the extension. This recipe leaves you with the official extension installed, verified and set up properly.
The solution
1. Check the requirements
According to the official documentation:
- VS Code 1.94.0 or later. Check with
code --version. - An account: any paid Claude plan (Pro, Max, Ultra, Team or Enterprise) or a Claude Console account. No API key is needed: you sign in the first time you open the extension.
- It also works with Amazon Bedrock, Google Cloud or Microsoft Foundry: turn on the
claudeCode.disableLoginPromptsetting and follow your provider's guide.
2. Install the official extension
The official identifier is anthropic.claude-code and the publisher is Anthropic. Install it from the terminal:
code --install-extension anthropic.claude-code
Or in VS Code: open Extensions (Ctrl+Shift+X; on Mac Cmd+Shift+X), search for "Claude Code" and pick the one from publisher Anthropic. If it does not show up after installing, restart VS Code or run Developer: Reload Window from the Command Palette.
3. Check it comes from the official publisher
The name is not enough: the tampered copy in Cursor used the same identifier, anthropic.claude-code. Check three things:
- On the extension page, the publisher is Anthropic with the verified badge and the
anthropic.comdomain. On the Visual Studio Marketplace, theanthropicpublisher has a verified domain; on Open VSX theAnthropicnamespace is shown as verified. - The installed version:
code --list-extensions --show-versions | grep -i claude
This is the output on the machine where this recipe was tested (VS Code 1.136.1 on Linux):
anthropic.claude-code@2.1.312
- The publisher the extension itself declares:
grep '"publisher"' ~/.vscode/extensions/anthropic.claude-code-*/package.json
It must say "publisher": "Anthropic". And never install a .vsix someone sends you by chat, email or a link: use your editor's marketplace.
4. Open it and learn the shortcuts
To open Claude Code you have the Spark icon at the top right of the editor (it only appears when a file is open), the Activity Bar icon, ✻ Claude Code in the Status Bar, or the Command Palette (Ctrl+Shift+P, type "Claude Code").
| Action | Windows/Linux | Mac |
|---|---|---|
| Toggle focus between the editor and Claude | Ctrl+Esc | Cmd+Esc |
| Open in a new tab | Ctrl+Shift+Esc | Cmd+Shift+Esc |
| Insert a mention of the current file and selection | Alt+K | Option+K |
| Reopen a closed session | Ctrl+Shift+T | Cmd+Shift+T |
New conversation (turn on enableNewConversationShortcut first) | Ctrl+N | Cmd+N |
| New line in the prompt | Shift+Enter | Shift+Enter |
5. Use mentions and diffs
- Automatic context: Claude sees the open file and any text you have selected.
- Mentions:
Alt+Kinserts something like@app.ts#5-10(file and line range). You can also type@authto search by name or@src/components/for a folder.@terminal:nameadds a terminal's output. - Images and files: paste an image from the clipboard, or hold
Shiftand drag files into the prompt box. - Diffs: in Manual mode, each change opens in a side-by-side diff to accept or reject. Since version 2.1.275 there are Accept this change and Reject this change buttons under each change (not shown for diffs with more than 100 changes). If you edit the proposed content in the diff, Claude knows you changed it.
- Checkpoints: hover over a message to fork the conversation, rewind the code changes, or both.
- Mode: the prompt box footer shows the permission mode (Auto, Manual, Plan, Edit automatically). To set the starting one, use
claudeCode.initialPermissionModein your user settings.
6. Decide: extension, CLI or both
The extension bundles its own CLI for the chat panel, but it does not add claude to your PATH. If you want the CLI in the integrated terminal, install it separately:
curl -fsSL https://claude.ai/install.sh | bash
claude --version
The differences according to the official documentation:
| Feature | CLI in the terminal | VS Code extension |
|---|---|---|
| Commands and skills | All | A subset (type / to see them) |
| MCP configuration | Yes | Yes (/mcp in the panel) |
| Checkpoints | Yes | Yes |
! Bash shortcut | Yes | No |
| Tab completion | Yes | No |
You do not have to choose forever: both share history. Start in the panel and continue in the terminal with claude --resume. If you run claude in an external terminal, run /ide to connect it to VS Code and see diffs in the editor.
Our recommendation: the extension for day-to-day work (diffs, Alt+K mentions) and the CLI when you need every command, the ! shortcut or scripts.
7. Cursor, Windsurf and other forks
- Cursor: the documentation gives the link
cursor:extension/anthropic.claude-code. Before installing, check the publisher as in step 3 and the version withcursor --list-extensions --show-versions | grep -i claude. - Other VS Code forks: search their Extensions view or install from Open VSX. The documentation does not name Windsurf; if its extension search does not show the one from the verified Anthropic publisher, do not install another one.
- Editors that cannot install the extension: install the CLI and run
claudein the integrated terminal.
Anthropic publishes the extension on the Visual Studio Marketplace and Open VSX, and warns that it does not endorse or audit third-party marketplaces.
8. Security notice: the tampered copy in Cursor
This is what the Cursor security notice and StepSecurity confirm:
- On October 29, 2026, between 2:27am and 1:35pm Pacific time, the Cursor extension marketplace served tampered versions 2.1.312 and 2.1.313 of
anthropic.claude-codefor macOS and Windows. Cursor says those versions "were not developed by Anthropic". - The added code tried to add an attacker SSH key labeled
svc-telemetry, open a reverse SSH tunnel, persist across reboots and send machine data. - Anthropic stated there was no compromise of its systems and that its official channels are not affected. StepSecurity verified the Open VSX 2.1.312 build as clean; 2.1.313 was never published on Open VSX or the Visual Studio Marketplace.
If you use Cursor and it updated that day, look for the key (macOS and Linux):
grep -qs svc-telemetry ~/.ssh/authorized_keys && echo "svc-telemetry key found" || echo "No key: machine not affected"
If it shows up, uninstalling the extension is not enough: follow the steps in our news post about the incident and in Cursor's notice.
Check it
- Open a folder with code, open a file and press
Ctrl+Esc(Cmd+Escon Mac). The Claude Code panel opens. - Select a few lines, press
Alt+Kand you will see something like@app.ts#5-10in the prompt box. - Ask for a small change ("add a comment to this function"). In Manual mode a diff opens with buttons to accept or reject.
- If you installed the CLI, in the integrated terminal (menu Terminal > New Terminal):
claude --version
2.1.316 (Claude Code)
Why it works
The extension runs Claude Code inside VS Code and also starts a local MCP server called ide that listens only on 127.0.0.1, on a random port, with a new token each time it starts. The CLI connects to it to open diffs in the editor, read your selection and see diagnostics. That is why the extension and the terminal complement each other and share history. It is explained in the VS Code documentation.
Common mistakes
- The Spark icon does not appear → no file is open, VS Code is older than 1.94, or the folder is in Restricted Mode → open a file, update VS Code, trust the folder and run Developer: Reload Window.
claude: command not foundin the integrated terminal → the extension does not add the CLI to PATH → install the CLI separately (step 6) and open a new terminal.- The panel is blank → old version → update to 2.1.309 or later, reload the window and check Claude Code: Show Logs.
ANTHROPIC_API_KEYis ignored → VS Code does not inherit your terminal's variables → launch it withcode .from the terminal or sign in with your Claude account.- The extension reinstalls itself after you uninstall it → running
claudein the VS Code terminal installs it again → turn off Auto-install IDE extension in/configor setCLAUDE_CODE_IDE_SKIP_AUTO_INSTALL=1. Cmd+Escdoes nothing on macOS Tahoe → the system Game Overlay captures it → clear it under System Settings > Keyboard > Keyboard Shortcuts > Game Controllers, or rebind "Claude Code: Focus input".
FAQ
Is Claude Code for VS Code free?
The extension is free to install, but to use it you need a paid Claude plan (Pro or higher) or a Claude Console account, which bills by usage.
Do I need to install the CLI if I already have the extension?
Not for the chat panel: the extension bundles its own CLI. Yes if you want to run claude in the terminal, which gives you every command and the ! shortcut.
Does it work in Cursor and Windsurf?
In Cursor, yes, with the official link cursor:extension/anthropic.claude-code. For other forks the documentation points to Open VSX; either way, check that the publisher is the verified Anthropic one.
Is the 2.1.312 version I have in VS Code dangerous?
According to Cursor and Anthropic, the tampered copy was only served from the Cursor marketplace. On the test machine, VS Code's 2.1.312 came from the Visual Studio Marketplace. Even so, update to 2.1.314 or later.
Can I move a conversation from the extension to the terminal?
Yes. They share history: run claude --resume in the terminal and pick the conversation.