Claude Code Setup Guide

Claude Code Setup Guide: CLI, VS Code, and JetBrains

Claude Code is Anthropic's official agentic coding assistant that runs directly in your terminal and integrates with popular IDEs. It can edit files, run commands, search codebases, and manage git workflows autonomously. This guide covers complete setup for the CLI, Visual Studio Code, and JetBrains IDEs.

Prerequisites

Installing Claude Code CLI

Install Claude Code globally using npm:

# Install globally
npm install -g @anthropic-ai/claude-code

# Verify installation
claude --version

Configuring the API Connection

For direct Anthropic access, set your API key:

export ANTHROPIC_API_KEY="sk-ant-your-key-here"

To use a relay service like claude4u.com for better availability and cost management:

export ANTHROPIC_BASE_URL="https://claude4u.com/antigravity"
export ANTHROPIC_API_KEY="cr_your_relay_key_here"
Tip: Add these exports to your ~/.zshrc or ~/.bashrc so they persist across terminal sessions. Using a relay service like claude4u.com gives you automatic failover and multi-account load balancing.

First Run

Navigate to any project directory and launch Claude Code:

cd /path/to/your/project
claude

Claude Code will analyze your project structure, read any CLAUDE.md instructions, and present an interactive prompt. Try a simple command to verify everything works:

# Inside Claude Code, type:
> Explain the project structure

VS Code Extension Setup

Claude Code integrates directly with Visual Studio Code through an official extension:

  1. Open VS Code and go to the Extensions panel (Cmd+Shift+X on macOS, Ctrl+Shift+X on Linux/Windows).
  2. Search for "Claude Code" and install the extension by Anthropic.
  3. Open VS Code settings (Cmd+,) and search for "claude".
  4. Set the API key and base URL if using a relay service.
  5. Restart VS Code to apply the changes.

Alternatively, configure via VS Code settings JSON:

{
  "claude-code.apiKey": "cr_your_relay_key_here",
  "claude-code.baseUrl": "https://claude4u.com/antigravity"
}

Access Claude Code in VS Code by pressing Cmd+Shift+P (or Ctrl+Shift+P) and typing "Claude Code" to see available commands.

JetBrains IDE Setup

Claude Code supports JetBrains IDEs including IntelliJ IDEA, PyCharm, WebStorm, and GoLand:

  1. Open your JetBrains IDE and navigate to Settings > Plugins.
  2. Search the Marketplace for "Claude Code" and install the plugin.
  3. Restart the IDE when prompted.
  4. Go to Settings > Tools > Claude Code.
  5. Enter your API key and set the base URL to https://claude4u.com/antigravity if using a relay.

The Claude Code panel will appear in your IDE's tool window. You can open it with the keyboard shortcut shown in the Tools menu.

Useful CLI Flags

# Start with a specific prompt
claude "fix the failing tests in src/auth"

# Print output to stdout (non-interactive mode)
claude -p "explain this function" --file src/utils/parser.js

# Resume the most recent conversation
claude --continue

# Use a specific model
claude --model claude-sonnet-4-20250514

# Allow specific tools without prompting
claude --allowedTools "Bash(npm test)" "Edit"

Creating a CLAUDE.md File

A CLAUDE.md file in your project root provides persistent instructions to Claude Code. This is essential for maintaining consistent behavior across sessions:

# CLAUDE.md

## Project Overview
Node.js REST API using Express and PostgreSQL.

## Development Commands
- `npm run dev` — Start dev server
- `npm test` — Run test suite
- `npm run lint` — Check code style

## Code Style
- Use TypeScript strict mode
- Prefer async/await over callbacks
- Write Jest tests for all new functions
Tip: Claude Code reads CLAUDE.md files automatically when entering a directory. Place them at the project root and in key subdirectories for context-specific guidance.

Verifying Your Setup

Run through this checklist to confirm everything is working:

  1. Open a terminal and run claude --version to confirm installation.
  2. Run echo $ANTHROPIC_BASE_URL to verify the relay URL is set.
  3. Navigate to a git repository and run claude to start a session.
  4. Ask Claude to make a small change and verify it edits the correct file.
  5. In VS Code or JetBrains, open the Claude Code panel and send a test message.
Warning: Claude Code can execute shell commands and modify files. Always review proposed changes before accepting, especially in production repositories. Use git branches for safety.

Troubleshooting

With Claude Code configured, you now have a powerful AI coding assistant ready to help with code generation, debugging, refactoring, and more. See our tips and tricks guide for advanced productivity techniques.

Get Started with 轻舟 AI

Stable, fast AI API relay — supports Claude, OpenAI, Gemini and more

Sign Up Free