Claude Code is Anthropic's terminal-native coding agent. It reads your files, writes code, runs commands, and works with git directly from the terminal. No IDE plugin, no browser tab -- just your terminal and your codebase.
Install
Requires Node.js 18+.
npm install -g @anthropic-ai/claude-code
API Key
You need an Anthropic API key. Grab one from console.anthropic.com.
On first run, Claude Code will prompt you for the key. It stores it in ~/.claude/ and you won't need to enter it again.
You can also set it as an environment variable:
export ANTHROPIC_API_KEY=sk-ant-...
Usage
Navigate to any project directory and run:
claude
That's it. Claude Code scans your project, reads the relevant files, and you start chatting. Ask it to write code, fix bugs, run tests, create commits.
A few useful flags:
claude --model claude-sonnet-4-6 # use a specific model
claude --resume # resume last conversation
claude -p "fix the failing tests" # non-interactive, run and exit
CLAUDE.md
Drop a CLAUDE.md file in your project root and Claude Code reads it automatically at the start of every session. Use it for:
- Project-specific instructions and conventions
- Build/test commands
- Architecture notes
- Learned corrections (things that tripped you up that you don't want to hit again)
This is the single most impactful thing you can do. A good CLAUDE.md turns Claude Code from a generic assistant into something that knows your project.
Configuration Notes
- Model selection: Opus is the most capable but costs more and is slower. Sonnet is the sweet spot for most coding tasks. Haiku is fast and cheap for simple stuff. You can switch mid-conversation with
/model. - Context window: Claude Code manages context automatically, compressing older messages as the conversation grows. Long sessions work fine -- you don't need to restart every 20 messages.
- MCP servers: Claude Code supports Model Context Protocol servers for connecting to external tools and data sources. Configure them in
.mcp.jsonat the project root. See the Anthropic API Key guide for API setup. - Permissions: Claude Code asks before running commands or editing files. You can configure auto-approve rules in settings if the prompts slow you down on trusted projects.
- Cost: API usage is billed directly to your Anthropic account. A typical coding session runs $0.50-3.00 depending on model and conversation length. Opus-heavy sessions can run higher.