Ravindra BagaleCourses & study guides Track your progress
AI CODING ASSISTANTS · CHAPTER 2 · SETUP

How to Set Up Claude Code in VS Code (Step by Step)

Claude Code is Anthropic's coding agent. Its VS Code extension gives you a chat panel that can read your project, plan, edit files and show you the changes as diffs.

In short: install the “Claude Code” extension, sign in with a paid Claude plan or a Claude Console account, open the Spark icon, and start in Manual or Plan mode.

Why use Claude Code in VS Code

WHY

You stay in your editor. You see every change as a side-by-side diff before you accept it. It can work on many files at once, like adding a feature plus its tests.

What you need

WHAT
  • VS Code: version 1.94.0 or later (Help → About).
  • An Anthropic account: any paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account. No API key needed for sign-in.
  • Claude Code extension: search “Claude Code” in Extensions. It includes its own copy of the CLI for the panel.
  • Optional: the CLI: install it separately if you want to type claude in the terminal.

How setup flows

1 · Install extension Ctrl+Shift+X → Claude Code 2 · Open the panel Spark icon, top-right 3 · Sign in browser authorisation 4 · Pick a mode Manual or Plan to start 5 · First prompt review the diff, accept

Install steps

HOW
  1. Open VS Code. Check the version is 1.94.0 or later.
  2. Press Ctrl+Shift+X (Mac: Cmd+Shift+X) to open Extensions.
  3. Search Claude Code (publisher Anthropic). Click Install.
  4. If it does not appear, run Developer: Reload Window from the Command Palette.
  5. Open any file. Click the Spark icon in the top-right of the editor. (Or click ✻ Claude Code in the bottom status bar.)
  6. Click Sign in and finish authorisation in your browser.
  7. You will see a short “Learn Claude Code” checklist. Follow it or close it.

Settings (what to change first)

Open Ctrl+, → Extensions → Claude Code.

  1. Permission mode: click the mode at the bottom of the prompt box. Beginners: use Manual (asks before edits) or Plan (shows a plan first).
  2. initialPermissionMode: set the default for new chats, e.g. plan.
  3. preferredLocation: sidebar keeps Claude on the right while you code.
  4. respectGitIgnore: keep it on so ignored files are left out.
  5. Model: click the model name at the bottom of the prompt box, or type /model, to switch models.

Configuration (project and user files)

  1. CLAUDE.md in the project root: short project rules (language, test command, style). Claude reads it each session.
  2. ~/.claude/settings.json: shared by the extension and the CLI. Use it for allowed or denied commands and MCP servers.
  3. Block secret files with a deny rule so Claude never reads them:
~/.claude/settings.json
{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./secrets/**)"]
  }
}
CLAUDE.md
# Project rules
- Language: Python 3.12
- Tests: pytest -q (must pass before you finish)
- Style: type hints, short functions
- Never touch .env or deploy scripts

First test (5 minutes)

  1. Open a folder with one small file, e.g. utils.py.
  2. Select a function. Claude sees the selected text automatically.
  3. Type: “Add input checks and a pytest test for this function. Run the tests.”
  4. In Manual mode, Claude shows a side-by-side diff. Read it. Click accept or reject for each change.
  5. When it wants to run pytest, approve it. Check the result yourself.
  6. Use Rewind (hover a message) if you want to undo its file changes.

Useful shortcuts

ActionWindows/LinuxMac
Focus Claude / editorCtrl+EscCmd+Esc
Insert @file#linesAlt+KOption+K
New tab chatCtrl+Shift+EscCmd+Shift+Esc
New line in promptShift+EnterShift+Enter
  • Optional CLI: to run claude in the terminal, install the standalone CLI from the official Claude Code docs. The extension does not add it to PATH.
  • Company cloud: if your company uses Amazon Bedrock or Google Cloud, turn on Disable Login Prompt and set the provider in ~/.claude/settings.json.
Rule: do not turn on “bypass permissions” on your real machine. Keep approval for commands that delete, install or deploy.

Quick quiz

1. What VS Code version does the extension need?

1.94.0 or later.

2. Which mode shows the plan before any change?

Plan mode.

3. Which file holds project rules for Claude?

CLAUDE.md in the project root.

4. How do you stop Claude reading .env?

Add a Read(./.env) deny rule in ~/.claude/settings.json.

Save tokens and money

SMART AI USE

Select only the code you need and use @file#lines instead of whole folders. Keep CLAUDE.md short. Start a new chat for a new task. Run /compact on long chats. Check /usage to see what is using your plan.

Save these cards

INTERVIEW CARDAI Coding

What is Claude Code in VS Code?

Anthropic's coding agent as a VS Code panel.
Plans, edits files, runs commands, shows diffs for approval.
Ravindra Bagale · ravindrabagale.com/ai-coding
COMPARISON CARDAI Coding

Claude Code vs Copilot in VS Code

Claude Code: agent + chat panel, plan/manual modes, no inline ghost text.
Copilot: inline ghost text + chat + agent mode.
Ravindra Bagale · ravindrabagale.com/ai-coding
REVISION CARDAI Coding

Setup in 4

Install “Claude Code” → Spark icon → Sign in → Manual/Plan mode.
Rules in CLAUDE.md. Deny .env in settings.json.
Ravindra Bagale · ravindrabagale.com/ai-coding