Getting Started with Claude Code
Install and configure Claude Code on your machine, authenticate, and run your first session.
What is Claude Code?
Claude Code is Anthropic's official CLI for Claude — a terminal-based AI coding assistant that understands your entire codebase. Unlike chat-based tools, Claude Code can read files, run commands, edit code, and manage git operations natively.
Installation
Install Claude Code globally via npm:
npm install -g @anthropic-ai/claude-code
After installation, run claude in any project directory to start a session.
Authentication
Claude Code authenticates via your Anthropic account. On first launch, it will open a browser window to complete OAuth. Your session persists locally — you won't need to re-authenticate each time.
First Run
Navigate to any project directory and start Claude Code:
cd ~/your-project
claude
Claude will scan the directory, read relevant files, and be ready for instructions. You can ask it to explain the codebase, fix bugs, add features, or run tests.
Key Concepts
Sessions are stateful conversations tied to a directory. Claude maintains context across turns within a session.
Tool use is how Claude interacts with your system — reading files, running shell commands, editing code, managing git. All tool calls are shown before execution.
CLAUDE.md files in your project give Claude persistent instructions. Think of them as a system prompt for your codebase.
Best Practices for Setup
Keep sessions focused on one task. Use /clear to reset context when switching topics. The --no-update flag prevents automatic updates if you need a stable version for CI.
Start with read-only exploration before asking for edits — let Claude explain the codebase structure before making changes.