Anthropic · Claude Code Guide

How to Use Claude Code

Claude Code is Anthropic's agentic coding tool — it runs in your terminal, reads your codebase, and ships code autonomously. This guide covers installation, your first session, and the workflows that experienced builders use to move fast.

Step 1 — Install Claude Code

Claude Code installs as a global npm package. You need Node.js 18 or later on your machine. Run this in your terminal:

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

Once installed, verify it worked:

claude --version

You also need a Claude Pro subscription ($20/month from Anthropic) or an Anthropic API key. On first run, Claude Code will prompt you to authenticate with your Anthropic account.

Note

If you're on a team or building something serious, the Anthropic API with per-token pricing removes the rate limits that come with a Pro subscription. For individual learners, Pro is the right starting point.


Step 2 — Start your first session

Navigate to any project directory and run:

claude

Claude Code opens an interactive session in your terminal. You're now talking directly to Claude with full access to your project files, shell, and git history.

For your first task, start small and specific. Something like:

Add a /health endpoint to this Express app that returns {"status": "ok"} and a 200 status code.

Claude Code will read your project structure, find the right file, make the change, and show you the diff before confirming. Review it, press Enter to accept, and you're done.


Step 3 — Set up a CLAUDE.md file

The single biggest improvement you can make to your Claude Code workflow is a CLAUDE.md file in your project root. Claude Code reads this automatically at the start of every session — think of it as a briefing document.

A good CLAUDE.md covers:

Example:

# Project: Booking system Stack: Next.js 14, TypeScript, Supabase (Postgres), Tailwind Tests: vitest, run with `npm test` Do not modify: /legacy/* — kept for reference only Current task: adding stripe payment flow to /checkout

A CLAUDE.md file eliminates the need to re-explain your project at the start of every session. On a larger codebase, it's the difference between Claude Code making sensible decisions and making generic ones.


Step 4 — Learn to frame tasks well

The quality of Claude Code's output is directly proportional to the quality of your instructions. This is the skill that separates fast builders from frustrated ones.

Vague vs specific

Vague: "Add authentication"
Specific: "Add email/password sign-in using NextAuth v5. Store sessions in the existing Postgres database using the users table. On success, redirect to /dashboard. Add a /logout route that clears the session and redirects to /."

The specific version tells Claude Code the library, the data layer, the success state, and the edge case. It will produce a better result in fewer iterations.

Break large goals into sequential tasks

"Build the whole app" produces worse output than a series of focused sessions. A reliable pattern:

  1. Data model first — schema, migrations, types
  2. Backend / API layer — routes, queries, validation
  3. UI — components, forms, error states
  4. Integration — wire the UI to the API, test the full flow
  5. Edge cases — empty states, error handling, loading states

Committing at the end of each step gives you clean rollback points and keeps each task small enough for Claude Code to reason about clearly.


Step 5 — Review every diff

Claude Code shows you exactly what it changed before applying. Get into the habit of reading every diff, every time. This one habit catches the vast majority of errors before they compound into something harder to fix.

If something looks wrong, press Escape to interrupt, revert with git checkout ., and give a more specific instruction. If the change is partially right, describe what's still wrong and let Claude Code continue from that point.

Workflow tip

Run git diff after each accepted change. A diff that spans 10 files is a sign the task scope was too broad — break it down next time.


Useful Claude Code commands

Beyond just typing tasks, Claude Code has a few built-in commands worth knowing:


Common mistakes and how to avoid them


Frequently asked questions

How do I install Claude Code?

Install Claude Code with npm: run npm install -g @anthropic-ai/claude-code in your terminal. You need Node.js 18 or later and a Claude Pro subscription or Anthropic API key. After installation, run claude inside any project directory to start a session.

What is a CLAUDE.md file and should I use one?

CLAUDE.md is a plain-text context file you place in your project root. Claude Code reads it automatically at the start of every session. It should contain your tech stack, coding conventions, what files not to touch, and any project-specific rules. A good CLAUDE.md file eliminates repeated re-explanation and dramatically improves output quality on larger projects.

How do I stop Claude Code mid-task?

Press Escape to interrupt Claude Code at any point. It will stop the current action and return to the prompt. If it has already made changes you want to undo, run git checkout . to revert all uncommitted changes.

Can I use Claude Code on an existing codebase?

Yes. Claude Code is designed to work with existing projects. It reads your file structure, imports, and recent git history to understand the codebase before making changes. Running it inside a git repository is strongly recommended.

How long does it take to learn Claude Code?

Most people find a working rhythm within 2 to 4 days of regular use. The first few sessions feel slow while you develop the task-framing skill. By the end of the first week, the bottleneck shifts from tool proficiency to product decisions. Claude Camp is designed to compress this learning into a single structured week in Pai, Thailand.

Claude Camp · Pai, Thailand

Master Claude Code in 7 days

Claude Camp is a residential retreat in northern Thailand where you build and ship a real app using Claude Code, with other founders and developers, in one focused week.

See Cohort 01 →