Back to blog

April 9, 2026

Claude Code Guide -- Part 1

How to Set Up Claude Code: The Complete Guide (2026)

Claude Code is not a chat interface that happens to write code. It is an agent -- it reads your files, runs commands, edits code, and iterates until the task is done. This guide covers installation, authentication, CLAUDE.md (the feature that changes everything), model selection, and how to give it a real task worth doing. By the end, you will have a working setup and a mental model of how to use it effectively.

InstallationCLAUDE.mdAuthenticationModel SelectionPermissionsFirst Task

What Is Claude Code (and What Makes It Different)

Claude Code shipped in February 2025 as a research preview and went generally available in early 2026. It is Anthropic's answer to GitHub Copilot, Cursor, and Windsurf -- but with a different philosophy. Those tools are primarily autocomplete and inline suggestion engines. Claude Code is an autonomous agent that takes a task description and works through it end-to-end.

The difference matters. With an inline suggestion tool, you are still the driver -- it fills in the next line. With Claude Code, you describe a goal and it navigates the codebase, identifies what needs to change, makes the changes, runs the tests, and reports back. You review the output, give feedback, and iterate.

Available as

  • CLI -- the core product; runs in any terminal
  • Desktop app -- native GUI, easier project switching
  • VS Code extension -- embedded in your editor sidebar
  • JetBrains plugin -- IntelliJ, PyCharm, WebStorm, etc.
  • claude.ai -- web app with Projects feature

What it can do

  • Read and write files across your project
  • Run shell commands (tests, builds, linters)
  • Search code with grep, glob, and ripgrep
  • Browse the web (with web tool enabled)
  • Call MCP servers for external integrations
  • Spawn sub-agents for parallel workstreams

The mental model shift

Stop thinking of Claude Code as a smarter autocomplete. Think of it as a junior developer who is extremely fast, never complains about boring tasks, and does exactly what you tell it -- for better or worse. Your job is to write clear task descriptions and review the output critically.

Installation

Three ways to install. Pick the one that matches how you work.

RECOMMENDED

npm (any platform)

Requires Node.js 18+. This is the most widely used install method because it works identically on macOS, Linux, and Windows.

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

# Verify install
claude --version

Homebrew (macOS / Linux)

If you manage most CLI tools with Homebrew, this keeps everything consistent and makes updates easy.

brew install claude-code

Desktop App (macOS / Windows)

Download from claude.ai/code. The desktop app is good if you want a visual UI for switching between projects, but the CLI is faster once you are comfortable with it. The desktop app also installs the CLI automatically.

Windows note

Claude Code works on Windows via WSL2 (Windows Subsystem for Linux). The native Windows experience is still rough in 2026 -- use WSL2 with Ubuntu and you will have a much better time. The desktop app is the exception; it runs natively on Windows.

First Run and Authentication

Run claude in your terminal. First launch triggers authentication. You have two options:

Option 1: Anthropic account (OAuth)

Claude Code opens a browser window and logs you in via your Anthropic account. If you have a Claude Pro subscription ($20/mo), this is the easiest path -- you get a monthly usage allowance included. When you hit the allowance limit, it falls back to API billing.

Option 2: API key (direct billing)

Set ANTHROPIC_API_KEY in your environment before running claude. Generate a key at console.anthropic.com. This is the better option for teams, CI/CD, and automated workflows where you need predictable billing.

# Add to ~/.zshrc or ~/.bashrc
export ANTHROPIC_API_KEY="sk-ant-..."

# Reload and verify
source ~/.zshrc
claude --version

After authentication, Claude Code drops you into an interactive session. You will see a > prompt. Type a message and hit enter. That is the full interface -- everything else is configuration and skill.

The complete playbook

Setup is the easy part. The KaiShips Guide covers everything after -- CLAUDE.md architecture, cost control, multi-agent workflows, and the patterns that separate hobbyist setups from production agents.

This tutorial gets you running. The guide shows you how to make Claude Code genuinely useful -- the kind of useful where it ships real work without you babysitting every step.

Get the KaiShips Guide to Claude Code -- $29

CLAUDE.md -- The Feature That Changes Everything

CLAUDE.md is a plain Markdown file that Claude Code reads automatically at the start of every session. It is the single most important thing to set up correctly because it is how you give the agent persistent context -- things it needs to know about your project that you do not want to re-explain every time.

Claude Code looks for CLAUDE.md files in three places, in order:

  1. ~/.claude/CLAUDE.md -- your global instructions, loaded in every project
  2. ./CLAUDE.md -- project-level instructions in the current working directory
  3. Subdirectory CLAUDE.md files -- loaded when the agent enters that directory

What to put in your global CLAUDE.md

Your global file should contain preferences that apply to every project -- your name, communication style, tools you always use, and behaviors you always want (or never want).

# ~/.claude/CLAUDE.md

## Who I Am
- Name: Alex
- I'm a senior fullstack engineer
- Preferred stack: TypeScript, React, Postgres, Node.js

## How I Work
- Always write tests alongside implementation
- Prefer explicit over implicit -- no magic
- Use conventional commits (feat:, fix:, chore:)
- Never use --force on git operations without asking

## Tools Available
- gh (GitHub CLI) is installed and authenticated
- pnpm is my package manager, not npm
- I use zsh, not bash

## Hard Rules
- Never commit .env files
- Never rm -rf without confirmation
- Ask before making API calls that cost money

What to put in your project CLAUDE.md

Project-level CLAUDE.md should cover everything specific to this codebase. Think of it as onboarding documentation for a new developer -- except the new developer can read 10,000 lines of Markdown in under a second.

# CLAUDE.md -- my-saas-app

## Project Overview
SaaS app for invoice management. Multi-tenant Postgres,
React frontend, Node/Express API, deployed on Railway.

## Architecture
- /apps/web -- React frontend (Vite, React Router v7)
- /apps/api -- Express API server
- /packages/db -- Prisma schema and migrations
- /packages/shared -- shared TypeScript types

## Key Commands
- pnpm test -- run all tests (vitest)
- pnpm lint -- ESLint + TypeScript check
- pnpm dev -- start dev servers (Turbo)
- pnpm db:migrate -- run pending migrations
- pnpm db:studio -- open Prisma Studio

## Database
- Local: postgresql://localhost:5432/myapp_dev
- Migrations in /packages/db/prisma/migrations
- Run migrations before testing any DB changes

## What to Avoid
- Never touch /apps/web/src/legacy -- deprecated, leaving for now
- Don't run pnpm db:reset -- will wipe local data
- Auth is handled by Clerk -- don't add custom auth logic

## Testing Conventions
- Unit tests: co-located with source files (*.test.ts)
- Integration tests: /tests/integration
- Always mock Stripe API calls in tests

The CLAUDE.md ROI

Spending 30 minutes writing a good project CLAUDE.md saves hours of re-explaining context across sessions. It also dramatically reduces mistakes -- the agent knows which directories to avoid, which commands are safe to run, and what conventions the codebase follows. This is the difference between Claude Code feeling useful and feeling like a liability.

Essential Settings -- Model, Permissions, Effort

Model selection

Claude Code supports multiple Claude models. Use /model inside a session to switch. Your options in 2026:

BEST DEFAULTclaude-sonnet-4-5

Fast, capable, and significantly cheaper than Opus. Handles 95% of coding tasks well. This is what you should use unless you have a specific reason to switch.

HEAVY TASKSclaude-opus-4-5

Best reasoning and planning. Use for complex multi-file refactors, architectural decisions, or tasks where you need it to think carefully across a large codebase. ~5x the cost of Sonnet.

FAST + CHEAPclaude-haiku-3-5

Lowest latency, lowest cost. Good for rapid iteration on small, well-defined tasks. Not great for complex reasoning.

Permission levels

Claude Code asks for permission before taking actions that could have side effects -- writing files, running shell commands, installing packages. The default behavior is to ask every time. You can change this.

# Start a session that auto-approves safe actions
claude --dangerously-skip-permissions

# Or use the /permissions command inside a session
# to toggle specific permission categories

Start conservative, not liberal

Keep the default permission behavior until you understand what Claude Code does in your codebase. The approval prompts are annoying, but they teach you what the agent is actually doing. Once you trust its behavior on a specific project, you can selectively open up permissions. Never run with full auto-approve on a production system.

Extended thinking

Claude Code supports extended thinking -- a mode where the model spends extra tokens reasoning through a problem before responding. Use /think or /think harder to enable it for the next task. Extended thinking is genuinely useful for architectural decisions and debugging complex problems, but it costs significantly more -- use it selectively.

Your First Real Task

Do not start with "hello world." That tells you nothing useful about how Claude Code performs on your actual work. Start with something meaningful -- a task you were going to do anyway.

What makes a good first task

Good first tasks

  • Write tests for an existing module
  • Add input validation to a form
  • Refactor a specific file to a new pattern
  • Add TypeScript types to a JS file
  • Fix a known bug with a clear description

Bad first tasks

  • "Build me an app"
  • "Make the code better"
  • Anything touching auth or payments
  • Tasks with no clear acceptance criteria
  • Changes across dozens of files at once

How to write a good task description

The quality of Claude Code's output is directly proportional to the quality of your task description. A vague prompt gets a vague result.

Weak prompt

"Add error handling to the API"

Strong prompt

"In /apps/api/src/routes/invoices.ts, the POST /invoices endpoint doesn't validate the request body. Add Zod validation for the fields defined in the Invoice type in /packages/shared/src/types.ts. Return a 400 with a structured error message if validation fails. Write a test in /apps/api/src/routes/invoices.test.ts that covers the happy path and the two most likely validation failures."

The iteration loop

Claude Code works best as an iterative back-and-forth. Give it a task, review what it produces, then tell it what to fix. "The validation looks right but the error format doesn't match our other endpoints -- look at how /routes/users.ts formats errors and match that." Three rounds of focused feedback beats trying to write the perfect prompt up front.

Key Concepts: Tools, Context, and Cost

How tools work

Claude Code has a set of built-in tools it can call during a session -- Read, Write, Edit, Bash, Glob, Grep, and others. When you give it a task, it decides which tools to use and in what order. You will see it call tools in the session output, which is how you can follow what it is actually doing.

You can extend the built-in tools with MCP servers -- adding GitHub, Slack, databases, browsers, or any custom integration. More on that in a later guide.

Context window

Claude Code has a context window -- a limit on how much information it can hold in a single session. For Claude Sonnet 4.5, this is 200,000 tokens. Each file it reads, each command it runs, each message in the conversation consumes context.

For most tasks this is not a problem. It becomes relevant when you are asking it to work across a large codebase. The agent is smart about reading only relevant files, but if you have it ingest 50 large files, you will hit limits. The fix is better task scoping and a good CLAUDE.md that tells it which files matter for each type of work.

Use /compact to compress the session history when you are deep in a long session and starting to feel the context limit. It summarizes earlier turns to free up room.

Cost awareness

Claude Code shows you token usage after each exchange. Pay attention to it. A typical focused 30-minute session on a medium-sized task costs $1-3 with Sonnet. A sprawling session where you throw everything at it can cost $10-20.

Quick task

Fix a single bug

~$0.25-0.75

with Sonnet 4.5

Standard session

Add a feature with tests

~$1-3

with Sonnet 4.5

Heavy session

Large refactor or new module

~$5-15

with Sonnet 4.5

Common Mistakes (and How to Avoid Them)

These are the mistakes we see everyone make in the first week, including ourselves.

1

Skipping CLAUDE.md

The single biggest mistake. Without it, you re-explain your project every session, the agent makes avoidable mistakes (wrong package manager, wrong test command, wrong file conventions), and you spend half the session correcting it instead of getting work done.

2

Vague task descriptions

"Make the auth better" is not a task. Describe the specific behavior you want, the files involved, and what done looks like. The more concrete you are, the better the output.

3

Not reading what it outputs

Claude Code will tell you exactly what it is doing -- which files it is reading, what commands it is running, what changes it is making. If you are not reading this output, you are flying blind. Slow down, read the tool calls, and you will catch problems early.

4

Approving everything without reviewing

The permission prompts exist for a reason. When Claude Code asks to run a command or write a file, read what it is proposing before hitting enter. Especially early on. The agent is confident even when it is wrong.

5

One giant task instead of small iterations

"Rebuild the entire auth system" is a recipe for a long expensive session that produces something you will mostly rewrite. Break it into steps: schema changes first, then API endpoints, then UI, then tests. Review each step before moving to the next.

6

Not using /compact on long sessions

Long sessions accumulate context. When performance degrades or you are near the context limit, use /compact to summarize the history. You can also start a fresh session for new tasks -- the session does not need to be continuous to be effective.

The complete playbook

Setup is the easy part. The KaiShips Guide covers everything after -- CLAUDE.md architecture, cost control, multi-agent workflows, and the patterns that separate hobbyist setups from production agents.

This tutorial gets you running. The guide shows you how to make Claude Code genuinely useful -- the kind of useful where it ships real work without you babysitting every step.

Get the KaiShips Guide to Claude Code -- $29

What to Learn Next

This guide covered the foundation -- installation, auth, CLAUDE.md, model selection, and your first task. Once you have the basics running, here is where the real leverage comes from:

CLAUDE.md Architecture

How to structure your global and project-level files for maximum effect. What to include, what to leave out, and how to handle multi-repo setups.

MCP Servers

Connect Claude Code to GitHub, your database, Slack, browsers, and custom APIs. The ecosystem has thousands of servers -- learn which ones matter.

Multi-agent Workflows

Spawn sub-agents for parallel workstreams. Let one agent write tests while another implements the feature. This is where throughput multiplies.

Cost Control

Model routing, context management, prompt caching, and session strategy. Running Claude Code at scale without a runaway API bill.

Hooks and Automation

Trigger Claude Code on git commits, file changes, or a schedule. Build background agents that run without you.

Production Patterns

How to use Claude Code safely on real codebases -- permission scoping, reviewable diffs, rollback strategies, and keeping humans in the loop.

All of these are covered in depth in the KaiShips Guide to Claude Code, along with real examples from production setups, annotated CLAUDE.md templates, and the workflows we use daily.

Frequently Asked Questions

What is Claude Code?

Claude Code is Anthropic's agentic coding tool. It runs as a CLI, a desktop app, and inside VS Code and JetBrains IDEs. You give it a task in plain English -- 'add authentication to this app', 'debug this test failure', 'refactor this module' -- and it reads files, writes code, runs commands, and iterates until the task is done. It uses the same Claude models available through the API.

How much does Claude Code cost?

Claude Code itself is free to install. You pay for the underlying model API calls. With Claude Sonnet 4.5 at $3/MTok input and $15/MTok output, a focused 30-minute coding session typically costs $0.50-$3. Complex tasks with large codebases cost more. You can also use Claude Code with a Claude Pro subscription ($20/mo), which includes a monthly usage allowance before API overage charges apply.

What is CLAUDE.md and why does it matter?

CLAUDE.md is a plain text file you place in your project root (or home directory). Claude Code reads it automatically at the start of every session and uses it as persistent instructions. It is where you put project-specific context: architecture decisions, coding standards, which commands to run tests, what directories to avoid, how to deploy. Without CLAUDE.md, you repeat this context every session. With it, the agent starts informed.

What is the difference between Claude Code CLI and the desktop app?

The CLI is the core product -- you run 'claude' in your terminal and get an interactive session. The desktop app wraps the same functionality in a native window with a chat UI, making it easier to switch between projects and see file diffs visually. The IDE extensions (VS Code, JetBrains) embed Claude Code directly in your editor, letting you invoke it without leaving your workflow. All three use the same models and settings.

How do I control how much Claude Code can do without my approval?

Claude Code has a permission system with three levels. In the default mode, it asks for approval before running shell commands or writing to files outside the current directory. In 'auto-approve' mode, it acts autonomously within your allowed paths -- useful for long-running tasks. You can also set per-directory allowlists and blocklists in your settings. Start with the default (approval for everything) and relax permissions as you build trust.

Which Claude model should I use with Claude Code?

Claude Sonnet 4.5 is the best default for most tasks -- it is fast, capable, and significantly cheaper than Opus. Use Claude Opus 4.5 for tasks that require deep reasoning across a large codebase or complex multi-step planning. Use Claude Haiku for rapid iteration on small tasks where you need low latency. You can switch models mid-session with the /model command.

Can Claude Code work on an existing large codebase?

Yes, and it handles large codebases better than most tools because it actively reads files rather than relying on an indexed vector store. For very large codebases (100k+ lines), the main challenge is context window limits. The solution is tight CLAUDE.md files that tell it which files are relevant to each type of task, so it does not read everything at once.

The complete playbook

Setup is the easy part. The KaiShips Guide covers everything after -- CLAUDE.md architecture, cost control, multi-agent workflows, and the patterns that separate hobbyist setups from production agents.

This tutorial gets you running. The guide shows you how to make Claude Code genuinely useful -- the kind of useful where it ships real work without you babysitting every step.

Get the KaiShips Guide to Claude Code -- $29