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
| Command | Purpose |
|---|---|
claude | Start a new session |
claude --resume | Resume your last session |
claude --resume <session-id> | Resume a specific session |
claude -p "prompt" | Headless / non-interactive mode |
claude -w | Worktree-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:
| Method | How |
|---|---|
| Editor toolbar | Click the Spark icon (top-right of editor) |
| Status bar | Click Claude Code in the bottom-right |
| Command Palette | Ctrl+Shift+P > “Claude Code: Open in New Tab” |
Key features:
| Feature | Description |
|---|---|
| Inline diffs | Side-by-side comparison; accept, reject, or revise |
| @-mentions | Type @filename for context; fuzzy matching supported |
| Selection context | Select code and Claude sees it automatically |
| Multiple conversations | Open in New Tab for parallel sessions |
| Checkpoints | Hover any message to rewind code or fork conversation |
Extension keyboard shortcuts:
| Shortcut | Action |
|---|---|
Ctrl+Escape | Toggle focus between editor and Claude panel |
Ctrl+Shift+Escape | Open new conversation in a tab |
Ctrl+N | New conversation (when Claude panel is focused) |
Alt+K | Insert @-mention reference for current selection |
If you prefer the terminal interface:
- Open terminal:
View > TerminalorCtrl+` - Move the terminal panel to the right side for code on left, Claude on right
- Run
claudeand set model:/model> select Opus 4.6 - To connect an external terminal to VS Code, run
/ideinside 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:
| Alias | Model ID | Use Case |
|---|---|---|
opus | claude-opus-4-6 | Complex tasks, architecture, deep reasoning |
sonnet | claude-sonnet-4-6 | Routine development, balanced speed/quality |
haiku | claude-haiku-4-5-20251001 | Quick tasks, trivial operations |
Recommended Terminal Layout
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:
| Event | When It Fires |
|---|---|
PreToolUse | Before a tool executes (can block it) |
PostToolUse | After a tool completes |
SessionStart | When a session begins |
SessionEnd | When 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:
Create worktrees
git worktree add .trees/feature-auth -b feature-auth
git worktree add .trees/feature-payments -b feature-payments
Open terminals in each worktree
Run Claude in each
claude -w # Worktree-aware mode
Each session has its own context, working independently.
Merge when done
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
| Flag | Purpose |
|---|---|
-p "prompt" | Run non-interactively |
--output-format | text, json, stream-json |
--continue | Continue from previous session |
--allowedTools | Restrict available tools |
--model | Specify model |
Keyboard Shortcuts Reference
| Shortcut | Action |
|---|---|
Shift+Tab / Alt+M | Cycle through permission modes |
Escape | Stop current generation |
Escape Escape | Rewind or summarize |
Alt+T (Win/Linux) | Toggle extended thinking |
@ | File path autocomplete / mention |
! | Enter Bash mode |