Claude Code — Getting Started
Install and configure Claude Code, Anthropic's terminal-based AI coding agent. Covers installation, API key setup, project configuration, and first session walkthrough.
Claude Code — Getting Started
Claude Code is Anthropic's terminal-based AI coding agent. It reads your codebase, writes and edits files, runs terminal commands, and can autonomously complete multi-step engineering tasks — all through natural language prompts in your terminal.
Installation
# Via npm (recommended)
npm install -g @anthropic-ai/claude-code
# Via Homebrew
brew install claude-code
# Verify installation
claude --version
Authentication
You need an Anthropic API key. Get one at console.anthropic.com (API Keys section).
# Set as environment variable
export ANTHROPIC_API_KEY="sk-ant-..."
# Or Claude Code will prompt on first run
claude
First Session
Navigate to your project directory and launch Claude Code:
cd my-project
claude

Claude Code scans your project structure automatically. On first run, you'll see:
⚡ Welcome to Claude Code!
Directory: /Users/you/my-project
Model: claude-sonnet-4-20250514 (default)
Context: 200K tokens
Type /help for available commands.
>
Type a prompt to start:
> Explain the architecture of this project and suggest improvements
Claude Code will read relevant files, analyze the structure, and respond inline in your terminal.
Essential Slash Commands
| Command | What it does |
|---|---|
/help | Show all available commands |
/file <path> | Add a file to the conversation context |
/clear | Clear conversation history |
/compact | Compress context by summarizing history |
/config | Open configuration settings |
/cost | Show current session token costs |
/doctor | Diagnose installation issues |
/init | Initialize CLAUDE.md for this project |
Project Configuration: CLAUDE.md
Create a CLAUDE.md file in your project root (or .claude/CLAUDE.md). Claude Code reads this every session — it's your project's system prompt.
# CLAUDE.md
## Commands
- `npm run dev` — Start development server
- `npm run build` — Production build
- `npm run lint` — ESLint + TypeScript check
- `npm run test` — Run test suite
## Architecture
- Next.js 14 App Router
- TypeScript strict mode
- Tailwind CSS for styling
- PostgreSQL via Prisma ORM
## Conventions
- Use server components by default
- `'use client'` only for interactivity
- Path alias `@/` maps to project root
- No any types — use explicit types or unknown
See Prompt Engineering in Claude Code for advanced CLAUDE.md patterns.
Environment Variables
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY | API authentication (required) |
ANTHROPIC_MODEL | Override default model |
ANTHROPIC_MAX_TOKENS | Max output tokens per request |
ANTHROPIC_BASE_URL | Custom API endpoint (proxies) |
Related Pages
- Prompt Engineering in Claude Code — CLAUDE.md patterns, extended thinking
- Claude Code Configuration Reference — claude.json, MCP, hooks, .claude/ conventions
- Tool Comparison — Claude Code vs OpenCode vs Gemini CLI vs Cursor vs Copilot
- Claude Code vs Gemini CLI vs OpenCode (Blog) — Head-to-head comparison
- Prompting Claude Code (Prompts Section) — Detailed CLAUDE.md command patterns
- MCP Setup for Claude Code — Adding MCP servers
Related Articles
Gemini CLI — Getting Started (Enterprise)
Enterprise installation and setup for Gemini CLI via Vertex AI. Product is deprecated for public use — replaced by Google Antigravity. Covers enterprise auth, sandbox modes, and first session.
OfficeCLI — An Office Suite Purpose-Built for AI Agents
OfficeCLI is the first open-source Office suite designed from the ground up for AI agents. Single binary, no Office installation required, with a built-in rendering engine that closes the create-view-fix loop autonomously. Here's why this fills a critical gap in enterprise agent tooling.
Cursor — AI-Powered IDE
Complete guide to Cursor, the AI-powered code editor. Covers prompt engineering, .cursorrules, agent mode, composer, and best practices for AI-assisted development.