This page covers installation and IDE integration. See also: Overview, Context & Memory, Skills & Plugins.

Setup & IDE Integration

Prerequisites

  • Node.js LTS (18+) installed
  • Authentication — Claude Pro/Max subscription or Anthropic API key
  • IDE (optional) — VS Code, JetBrains, or standalone CLI

Installation

npm install -g @anthropic-ai/claude-code
claude   # Launch and authenticate
npm install -g @anthropic-ai/claude-code
claude   # Launch and authenticate

Windows uses the same npm package. Ensure Node.js 18+ is on your PATH. Claude Code runs in Git Bash, WSL, or PowerShell.

Launch Options

CommandPurpose
claudeStart a new session
claude --resumeResume your last session
claude --resume <session-id>Resume a specific session
claude -p "prompt"Headless / non-interactive mode
claude -wWorktree-aware mode

VS Code Setup

The official Claude Code extension by Anthropic provides a native sidebar chat panel with inline diffs, @-mentions, conversation history, and checkpoints.

Install: Ctrl+Shift+X > search “Claude Code” > Install (requires VS Code 1.98.0+)

Open the panel:

MethodHow
Editor toolbarClick the Spark icon (top-right of editor)
Status barClick Claude Code in the bottom-right
Command PaletteCtrl+Shift+P > “Claude Code: Open in New Tab”

Key features:

FeatureDescription
Inline diffsSide-by-side comparison; accept, reject, or revise
@-mentionsType @filename for context; fuzzy matching supported
Selection contextSelect code and Claude sees it automatically
Multiple conversationsOpen in New Tab for parallel sessions
CheckpointsHover any message to rewind code or fork conversation

Extension keyboard shortcuts:

ShortcutAction
Ctrl+EscapeToggle focus between editor and Claude panel
Ctrl+Shift+EscapeOpen new conversation in a tab
Ctrl+NNew conversation (when Claude panel is focused)
Alt+KInsert @-mention reference for current selection

If you prefer the terminal interface:

  1. Open terminal: View > Terminal or Ctrl+`
  2. Move the terminal panel to the right side for code on left, Claude on right
  3. Run claude and set model: /model > select Opus 4.6
  4. To connect an external terminal to VS Code, run /ide inside Claude Code

JetBrains Setup

Claude Code supports JetBrains IDEs (IntelliJ, PyCharm, WebStorm, GoLand, PhpStorm, Android Studio) with a dedicated plugin. Install from the JetBrains Marketplace.

Model Selection

Use /model to switch between models during a session:

AliasModel IDUse Case
opusclaude-opus-4-6Complex tasks, architecture, deep reasoning
sonnetclaude-sonnet-4-6Routine development, balanced speed/quality
haikuclaude-haiku-4-5-20251001Quick tasks, trivial operations

Open multiple parallel terminals in your IDE:

  • Terminal 1: Claude Code (main session)
  • Terminal 2: Your dev server (npm run dev)
  • Terminal 3+: Additional Claude sessions for parallel work

Permission Settings

Create .claude/settings.json in your project root for auto-accept:

{
  "permissions": {
    "allow": [
      "Edit",
      "Write",
      "Bash(npm run *)",
      "Bash(python *)",
      "Bash(git add *)",
      "Bash(git commit *)",
      "Bash(git status)",
      "Bash(git diff *)",
      "Bash(git log *)"
    ],
    "ask": [],
    "deny": []
  }
}

Hooks System

Hooks run shell commands automatically at specific points in Claude Code’s lifecycle:

EventWhen It Fires
PreToolUseBefore a tool executes (can block it)
PostToolUseAfter a tool completes
SessionStartWhen a session begins
SessionEndWhen a session ends

Example — auto-format after every edit:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit",
        "command": "npx prettier --write $FILE_PATH"
      }
    ]
  }
}

Git Worktrees — Parallel Development

Run multiple Claude Code sessions simultaneously on different features:

1

Create worktrees

git worktree add .trees/feature-auth -b feature-auth
git worktree add .trees/feature-payments -b feature-payments
2

Open terminals in each worktree

Open a separate terminal per worktree directory.
3

Run Claude in each

claude -w   # Worktree-aware mode

Each session has its own context, working independently.

4

Merge when done

Merge each feature branch when the work is complete.

Headless & Automation Mode

Run Claude Code non-interactively for CI/CD pipelines and scripting:

# Plain text output
claude -p "Explain the architecture of this project"

# JSON output
claude -p "List all API endpoints" --output-format json

# Streaming JSON
claude -p "Refactor the database module" --output-format stream-json
FlagPurpose
-p "prompt"Run non-interactively
--output-formattext, json, stream-json
--continueContinue from previous session
--allowedToolsRestrict available tools
--modelSpecify model

Keyboard Shortcuts Reference

ShortcutAction
Shift+Tab / Alt+MCycle through permission modes
EscapeStop current generation
Escape EscapeRewind or summarize
Alt+T (Win/Linux)Toggle extended thinking
@File path autocomplete / mention
!Enter Bash mode