Introduction

Claude Code is a powerful CLI tool that brings Claude’s capabilities directly to your terminal. This guide will walk you through installation, configuration, and your first interactions.

Installation

Install Claude Code globally using npm:

npm install -g @anthropic-ai/claude-code

Or with Bun:

bun install -g @anthropic-ai/claude-code

Authentication

Claude Code uses your Anthropic API key for authentication. Set it as an environment variable:

export ANTHROPIC_API_KEY="your-api-key"

Or add it to your shell profile for persistence.

First Run

Launch Claude Code in any directory:

claude

You’ll see the interactive prompt where you can start asking questions or requesting code changes.

Basic Commands

  • /help - Show available commands
  • /clear - Clear the conversation
  • /compact - Toggle compact mode
  • Ctrl+C - Cancel current operation

Configuration Files

CLAUDE.md

Create a CLAUDE.md file in your project root to provide context and instructions specific to your codebase:

# Project Context

This is a Rails 7 application using PostgreSQL...

## Code Style

- Use 2-space indentation
- Prefer single quotes for strings
...

settings.json

Configure Claude Code behavior in ~/.claude/settings.json:

{
  "theme": "dark",
  "model": "claude-sonnet-4-20250514",
  "mcpServers": {}
}

Next Steps