Claude Code

Getting started

From install to your first real task in under fifteen minutes. This page walks through the whole thing.


1. Install it

Claude Code is a command-line tool installed via npm or Homebrew. Pick whichever you already have.

installation
# Option 1: npm (recommended)
$ npm install -g @anthropic-ai/claude-code
# Option 2: Homebrew (macOS)
$ brew install claude-code
# Verify the install
$ claude --version
Claude Code v2.1.62

You need Node.js 18 or later for the npm install. If you do not have Node, install it first from nodejs.org.


2. Authenticate

The first time you run claude, it will ask you to log in. This links Claude Code to your Anthropic account (the same account you use for claude.ai).

first launch
$ claude
Opening browser for authentication...
Authenticated as sandy@abingdon.co. Welcome.
Claude Code v2.1.62 (Sonnet 4.6)
Working directory: ~/projects/my-app
Hi! I can see this is a Node.js project with Express and Prisma. How can I help?

Claude reads the current directory on startup and gives you a quick orientation. If you are in a git repo, it knows. If there is a package.json, a requirements.txt, or a Cargo.toml, it reads them.


3. Your first real task

Do not start with something theoretical. Start with something you were actually going to do today. Here is a full worked example: adding a simple health check endpoint to an Express app.

first real task
> Add a GET /health endpoint to the Express app that returns { status: "ok", timestamp: Date.now() }. Add a test for it. Run the tests to confirm.
I'll read the existing route structure first to match the patterns you're using.
Read src/routes/index.ts (34 lines)
Read src/routes/__tests__/index.test.ts (28 lines)
Your routes use the Router pattern with a separate test file per route group. I'll follow that pattern.
Create src/routes/health.ts
Allow this edit? [Y/n/explain]
y
Create src/routes/__tests__/health.test.ts
Allow this edit? [Y/n/explain]
y
Edit src/routes/index.ts (1 line added: import health route)
Allow this edit? [Y/n/explain]
y
Run npm test
All 12 tests passed (including 2 new health endpoint tests).
Done. The /health endpoint returns the status and timestamp, and both tests pass (200 response + correct JSON shape). Want me to commit?

Notice three things. First, Claude read the existing code before writing anything, to match your patterns. Second, it asked for permission before each file change (the [Y/n/explain] prompts). Third, it ran the tests after making changes and confirmed they passed. This is the shape of a healthy Claude Code interaction.


4. Understanding the permission prompts

Every time Claude wants to do something that changes your system (editing a file, creating a file, running a command), it asks for permission. You have four options at each prompt:

Y

Yes. Allow this specific action. The default. Press Enter or type Y.

n

No. Block this action. Claude will try a different approach or ask you what to do instead.

e

Explain. Claude explains what it is about to do and why, without doing it. Useful when you are not sure whether to allow.

Tab

Change mode. Press Shift+Tab to cycle through permission modes: default, acceptEdits, plan, and auto. Each mode changes what gets auto-approved.

Start in the default mode (reads auto-approved, everything else asks). Once you are comfortable with the interaction, switch to acceptEdits mode, which auto-approves file changes. See the workflow page for when to use each mode.


5. Create your first CLAUDE.md

A CLAUDE.md file gives Claude persistent instructions about your project. Without it, Claude guesses your conventions anew every session. With it, Claude starts every session already knowing your stack, your style, and your preferences.

A starter CLAUDE.md to copy

Create this file at the root of your project. Tweak it to match your actual setup.

CLAUDE.md# Project conventions ## Stack - TypeScript, Node.js 20, Express, Prisma ORM - Tests: Jest with supertest for API tests - Linting: ESLint + Prettier (run with `npm run lint`) ## Commands - `npm test` runs the test suite - `npm run build` compiles TypeScript - `npm run dev` starts the dev server ## Style - Use ES module syntax (import/export), not CommonJS - 2-space indentation - Destructure imports when possible - Tests go in __tests__ directories next to the source ## Git - Feature branches off main - Commit messages: imperative mood, under 72 chars - Run tests before committing

Keep it short. Under 200 lines is the target. If you find yourself repeating an instruction in conversations, add it to CLAUDE.md and you will never type it again. The configuration page goes much deeper on this.


The five-minute first-session checklist

1.

Navigate to your project directory in the terminal. Claude Code works in whichever folder you launch it from.

2.

Run claude and let it read the project. Watch the orientation message to confirm it understands the stack.

3.

Start with a real task, not a test. Something you were going to do anyway. A bug fix, a small feature, a file rename. Real work builds intuition faster than experiments.

4.

Read every permission prompt. For your first few sessions, approve each one individually. Understand what Claude is doing before you trust it to do it faster.

5.

Create a CLAUDE.md after the session. Write down the two or three things you had to tell Claude that it should have already known. Save it at the project root. Next session starts with that context loaded.


Common first-session stumbles

Claude makes a change you did not expect

Press Esc to stop it mid-action. Type /rewind to undo the last step. Type /clear to reset the conversation and start again with a clearer prompt. Git is your safety net: if the working tree is clean before you start, you can always git checkout . to revert everything Claude did.

Claude suggests running a command you don't recognise

Type e (explain) at the permission prompt. Claude will explain what the command does and why it wants to run it. If you are still not sure, type n to block it and ask Claude to try a different approach.

Claude doesn't know about your project's conventions

This is normal on the first session without a CLAUDE.md. Tell Claude the convention in the chat ("we use 2-space indentation" or "tests go in __tests__ directories"), and then add it to CLAUDE.md afterwards so the next session starts knowing.


That is the whole first session. Install, authenticate, do one real task, read the permission prompts, create a CLAUDE.md. Everything after this is about getting faster and more confident.

Next: The workflow covers the Explore, Plan, Implement, Commit cycle that makes Claude Code sessions consistently productive. Or go back to the Claude Code overview.