This guide walks through everything you need to get Claude Code running, from installation to your first real task.
1. What is Claude Code?
Claude Code is a CLI-based agentic coding tool built by Anthropic. It runs in your terminal and can:
- Read and understand your entire project
- Edit files across your codebase
- Run shell commands (build, test, lint, git)
- Search through code and documentation
- Plan and execute multi-step tasks
It’s not an autocomplete tool. It’s an agent that thinks about your request, explores your code, and takes action.
2. Prerequisites
Before installing, make sure you have:
- OS: macOS 13+, Windows 10 1809+, Ubuntu 20.04+, or Debian 10+
- RAM: 4 GB+
- An Anthropic API key or a Claude subscription (Pro $20/mo, Max $100/mo or $200/mo)
With an API key, you pay per token used. This is flexible but costs can add up with heavy usage.
With a subscription (Pro or Max), you get Claude Code access included with usage limits that reset monthly. Pro is enough to get started. Max gives you higher limits for heavier usage.
3. Installation
The recommended way to install Claude Code is through the native installer. It auto-updates in the background so you’re always on the latest version.
a. macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash b. Windows PowerShell
irm https://claude.ai/install.ps1 | iex c. Windows CMD
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd d. Alternative package managers
# Homebrew (macOS/Linux)
brew install --cask claude-code
# WinGet (Windows)
winget install Anthropic.ClaudeCode The old npm install -g @anthropic-ai/claude-code method still works but is deprecated. If you already have it installed via npm, run claude install to migrate to the native installer.
e. Verify installation
claude --version f. Windows setup
On Windows, Claude Code requires Git for Windows (which provides Git Bash). You can also run it inside WSL. Both WSL 1 and WSL 2 are supported, though WSL 2 is recommended for full sandbox support.
4. Authentication
On first run, Claude Code will walk you through authentication.
a. Subscription (Pro/Max)
Just run claude. It will open a browser window for you to log in with your Claude.ai account.
claude b. API key
# Set your API key as an environment variable
export ANTHROPIC_API_KEY=sk-ant-...
# Or let Claude Code prompt you on first run
claude 5. First run
Navigate to any project directory and start Claude Code:
cd your-project
claude You’ll see an interactive prompt. Try something simple:
> What does this project do? Give me an overview. Claude Code will scan your project files, read key files like README.md, package.json, or CLAUDE.md, and give you a summary.
a. Try a real task
> Find all TODO comments in the codebase and list them with file paths > Add input validation to the login form in src/components/LoginForm.tsx > Write tests for the utils/date.ts module Watch how it reads files, thinks through the approach, and makes changes. It asks for your approval before writing to files or running commands.
6. CLAUDE.md (project instructions)
This is one of the most powerful features. Create a CLAUDE.md file in your project root to give Claude Code persistent instructions about your project.
# My Project
## Stack
- Runtime: Bun
- Framework: SvelteKit
- Styling: Tailwind CSS
## Commands
bun run dev # Start dev server
bun run test # Run tests
bun run build # Production build
## Conventions
- Use Svelte 5 runes syntax
- Prefer early returns over else blocks
- Keep functions short and single-purpose Claude Code reads this file automatically at the start of every session. It’s like onboarding a new developer. The better your CLAUDE.md, the better Claude Code understands your project.
- Keep it concise. Claude Code reads this every session, so don’t make it a novel
- Focus on what’s unique to your project (conventions, non-obvious patterns)
- Include your build/test/dev commands
- Mention constraints that aren’t obvious from the code
a. Hierarchy
Claude Code supports multiple instruction files:
| File | Scope |
|---|---|
~/.claude/CLAUDE.md | Global, applies to all projects |
./CLAUDE.md | Project root, main project instructions |
./src/CLAUDE.md | Subdirectory, overrides for specific paths |
7. Key concepts
a. Context window
Claude Code has a finite context window (how much text it can “remember” at once). As your conversation grows, older messages get compressed or dropped. This means:
- Start fresh sessions for unrelated tasks
- Be specific in your prompts to avoid unnecessary exploration
- Use
/clearto reset the conversation when switching contexts
b. Tool use
Claude Code has access to tools like file reading, file writing, shell execution, and web search. When you ask it to do something, it decides which tools to use and in what order.
You’ll see tool calls in real-time. For anything that modifies files or runs commands, Claude Code asks for your permission first (unless you’ve configured auto-approval).
c. Permission modes
Claude Code has four permission levels:
- Default: Asks before every file write and command execution
- Accept Edits: Automatically writes files, still asks before running commands
- Plan Mode: Only plans and reads, no file writes or command execution
- YOLO: Runs everything without asking (use with caution)
Start with default mode. As you build trust, you can gradually give it more autonomy. Use plan mode when you want to review the approach before it makes any changes.
8. Useful commands
Inside a Claude Code session, these slash commands are helpful:
| Command | What it does |
|---|---|
/help | Show all available commands |
/clear | Reset the conversation |
/compact | Compress the conversation to save context |
/cost | Show token usage and cost for the session |
/model | Switch between models (Opus, Sonnet, Haiku) |
9. What’s next
Now that you’re set up, head over to Tips to learn how to use Claude Code effectively. It covers prompting patterns, context management, and workflows that I’ve refined through daily use.