A VS Code window with the Claude Code panel on the right, showing a code change as a diff with Accept and Reject buttons
Category: AI

Claude Code is Anthropic's coding assistant, and it does more than answer questions: it reads your whole project, edits files, runs commands and asks for your permission before anything sensitive. The best place to use it is the editor you already write code in every day: VS Code.

In this guide you will connect Claude to VS Code with the official extension, sign in, reference files and lines of code, review changes before they are applied and, if you prefer the terminal, run Claude Code from the VS Code terminal. If you are still choosing between Claude and other tools, read Claude, ChatGPT, Gemini, Grok and Codex compared first.

A VS Code window with the Claude Code panel showing a proposed change as a diff with Accept and Reject buttons
A VS Code window with the Claude Code panel showing a proposed change as a diff with Accept and Reject buttons

Two ways to connect Claude to VS Code

MethodWho it suitsWhat you get
The Claude Code extensionMost usersA graphical panel, diffs next to your code, quick references to files and selections
The CLI in the VS Code terminalPeople who prefer the command lineThe same Claude Code in a terminal, connected to the editor with /ide

The two are not competitors. The extension ships with its own copy of Claude Code, which is enough for the graphical panel. But if you also want to run the claude command in a terminal, you need to install the CLI separately (explained below).

Requirements

  • VS Code 1.94 or later. Check your version under Help › About and update if it is older.
  • A paid Claude subscription (Pro, Max, Team or Enterprise) or a Claude Console account, which is billed by API usage. The free claude.ai plan does not include Claude Code. You do not need an API key to sign in to the extension.
  • Workspace Trust. The extension does not work in Restricted Mode. When VS Code asks whether you trust the folder, choose Trust if the project is yours.
  • A supported country. Anthropic only offers its services in supported countries; check the list and the terms of use before you buy a subscription.

Installing the Claude Code extension in VS Code

The four steps to install Claude Code: open Extensions, search for Claude Code, click Install and open the panel with the Spark icon
The four steps to install Claude Code: open Extensions, search for Claude Code, click Install and open the panel with the Spark icon
  1. In VS Code press Ctrl+Shift+X (Cmd+Shift+X on a Mac) to open the Extensions view.
  2. Search for Claude Code. The right extension is Claude Code for VS Code, published by Anthropic, with the ID anthropic.claude-code. Watch out for look-alike extensions from unknown publishers.
  3. Click Install. If the icon does not appear after installing, restart VS Code or run Developer: Reload Window from the Command Palette.
  4. The Spark icon (Claude's orange star) now appears in several places. Any of them opens the Claude panel:
  • The editor toolbar at the top right of the editor, when a file is open
  • The Activity Bar on the left, which shows your list of conversations
  • The status bar at the bottom of the window, on the words Claude Code
  • The Command Palette: press Ctrl+Shift+P and type Claude Code

You can also install the extension straight from its page on the Visual Studio Marketplace. The same extension also installs in Cursor.

Signing in to your Claude account

The first time you open the panel, a sign-in screen appears:

  1. Click Sign in.
  2. Your browser opens. Sign in with your Claude or Claude Console account and approve access.
  3. Go back to VS Code. The panel is ready.

If you see "Not logged in", run Developer: Reload Window to bring the sign-in screen back. Organisations that use Claude through Amazon Bedrock, Google Cloud or Microsoft Foundry can turn off the sign-in screen with the claudeCode.disableLoginPrompt setting and connect with that provider's environment variables.

Your first request: how Claude sees your code

Type your request in plain language in the box at the bottom of the panel, for example "Add a /health route to the server that returns ok". A few habits make the results more precise:

  • The open file and your selection are sent automatically. You do not need to copy code; Claude sees the active file and the lines you have selected.
  • Reference files and folders with @. Type @ and part of a file name to get suggestions; end a folder name with /.
  • Reference exact lines with Alt+K. Select some lines and press Alt+K (Option+K on a Mac); a reference such as @server.mjs#3-5 is added to your message.
  • Include terminal output. @terminal: followed by the terminal's name adds its output, such as an error message, to the conversation.
  • New line with Shift+Enter. Enter sends the message.
Working with Claude in VS Code: a proposed change as a diff, referencing lines with Alt+K, Accept and Reject buttons, and Manual or Plan mode
Working with Claude in VS Code: a proposed change as a diff, referencing lines with Alt+K, Accept and Reject buttons, and Manual or Plan mode

Reviewing changes: look before you apply

The biggest advantage over copying code from a chatbot is that changes are shown as a diff next to your code before they are applied: removed lines in red and added lines in green.

  • Every change has Accept and Reject buttons, so you can keep some parts and reject others.
  • If you do not like a change, tell Claude what to adjust; there is no need to start over.
  • The Command Palette also has Claude Code: Accept Change at Cursor and Reject Change at Cursor.

Permission modes

The current mode is shown under the message box, and you change it with a click:

ModeBehaviourWhen to use it
ManualAsks before every edit or commandThe default and safest mode; for real projects
PlanWrites a plan first and does not touch code until you approveBig changes, or when you want to see the approach first
Edit automaticallyEdits files without askingRepetitive work in a project backed up with Git
AutoDecides for itself which actions need your approvalExperienced users

My advice: start with Manual and use Plan for changes that span several files.

Going back and earlier conversations

  • Hover over an earlier message to reveal the rewind button; you can fork the conversation from that point or take the code back to that moment.
  • The Session history button at the top of the panel lets you search and reopen earlier conversations.
  • Open in New Tab keeps several separate conversations open at once.

Useful shortcuts

ActionWindows and LinuxMac
Open the Extensions viewCtrl+Shift+XCmd+Shift+X
Focus the Claude message boxCtrl+EscCmd+Esc
Open Claude in a new tabCtrl+Shift+EscCmd+Shift+Esc
Reference the selected linesAlt+KOption+K
Command PaletteCtrl+Shift+PCmd+Shift+P
New line in a messageShift+EnterShift+Enter
Open the VS Code terminalCtrl and the key above TabCtrl and the key above Tab

Method two: Claude Code in the VS Code terminal

Installing the Claude Code CLI in the VS Code terminal, running claude --version and claude, and connecting to the editor with /ide
Installing the Claude Code CLI in the VS Code terminal, running claude --version and claude, and connecting to the editor with /ide

If you are comfortable on the command line, or your editor does not support the extension, install the CLI. The official install commands:

Windows (PowerShell):

irm https://claude.ai/install.ps1 | iex

macOS, Linux and WSL:

curl -fsSL https://claude.ai/install.sh | bash

There are other options too: winget install Anthropic.ClaudeCode on Windows, brew install --cask claude-code on a Mac, or npm install -g @anthropic-ai/claude-code, which needs Node.js 22 or later. On Windows, installing Git for Windows is also recommended.

After installing:

  1. Open a new terminal (Ctrl and the key above Tab) so the program is found, and check the install with claude --version.
  2. Run claude in your project folder. The first time, you will be asked to sign in.
  3. If you run Claude Code in a terminal outside VS Code, type /ide and choose VS Code, so Claude can see the open file and your selection and show diffs inside the editor.

The extension and the CLI share conversations: claude --resume in the terminal continues a conversation you started in the panel.

CLAUDE.md: tell Claude your project rules once

At the start of every conversation Claude Code reads the CLAUDE.md file in the project root. Put your build and test commands, naming rules and anything that must not be forgotten there, so you do not have to repeat it. The /init command creates a first version of this file from your project's structure.

Common problems and fixes

ProblemLikely causeFix
The Spark icon is missingThe window was not reloaded after installing, or no file is openDeveloper: Reload Window, or open it from the Activity Bar or status bar
The extension will not installVS Code is too oldUpdate VS Code to 1.94 or later
"Not logged in"Sign-in did not finishReload Window and Sign in again
The extension does nothing and Restricted Mode is shownThe folder is not trustedChoose Trust for the project folder
claude is not recognised in the terminalThe CLI is not installed, or the terminal is oldInstall the CLI separately and open a new terminal
You cannot sign in even though you have an accountFree plan, or an unsupported countryCheck your plan and the list of supported countries

Security tips

  • Read every diff before you click Accept. Claude is accurate, but the code is your responsibility.
  • Never paste passwords or keys into the conversation, and keep files like .env in .gitignore; by default the extension skips gitignored files in search.
  • Commit your work before you start, so you always have a safe point to go back to.
  • On production servers or sensitive projects use Manual or Plan, not the automatic modes.

Summary

Connecting Claude to VS Code takes four steps: open Extensions, search for Claude Code, click Install and Sign in. After that you reference code with @ and Alt+K, review changes as diffs and decide with Accept or Reject. If you prefer the terminal, install the CLI and connect it to the editor with /ide.

Claude Code is not only for programming; the same technology is the basis of agents that take repetitive work off a business. If you want an AI agent or automation for your company, see the AI agent development and AI-based business automation services, read Installing n8n on localhost or get in touch.

Official sources: Claude Code in VS Code documentation, Claude Code setup guide and the extension on the Visual Studio Marketplace.

  • Claude Code
  • Claude VS Code
  • Claude extension
  • AI coding assistant
  • VS Code
  • Anthropic
  • AI for developers