Skip to main content
Tutorials10 min

How to Use Claude Code: A Step-by-Step Beginner's Guide

How to use Claude Code as a beginner: install it, log in, run a first session, write a CLAUDE.md file, and undo changes with checkpoints and Git.

By Thomas Lovas Lokoy — researched and drafted with AI assistance from published sources; edited and published by NorwegianSpark SALast updated: October 16, 2026
Lines of code on a dark monitor

Affiliate disclosure: Some links below are affiliate links. We may earn a commission if you sign up through them — at no extra cost to you. See our affiliate disclosure for details.

The Short Answer

To use Claude Code, install it with Anthropic's one-line installer, open a terminal in your project folder, type claude, log in with a paid Claude plan or a Console account, and describe what you want in plain English. It reads the files it needs, proposes changes, asks before editing when your permission mode says it should, and can run your tests and Git commands. Everything in this guide follows Anthropic's own Claude Code documentation as read on 16 October 2026; commands change between versions, so check /help inside your session if something differs.

What Claude Code Is — and What It Needs

Most AI coding tools sit inside an editor and suggest the next line. Claude Code is an agent: it works on the whole project from your terminal, reading files, editing them, running commands and checking the results before it moves on. That makes it good at tasks that span many files, and it is why the habits in this guide — clear goals, a project file, checkpoints and Git — matter more than they would for autocomplete.

Before you start, check three things:

  • An account. Anthropic's setup page says Claude Code requires a Pro, Max, Team, Enterprise or Console account; the free claude.ai plan does not include it. Enterprise cloud access through Amazon Bedrock, Google Cloud or Microsoft Foundry is also supported.
  • A supported system. The documentation lists macOS 13 or later, Windows 10 (version 1809) or later, Ubuntu 20.04+, Debian 10+ and Alpine 3.19+, with at least 4 GB of RAM and an internet connection.
  • A project under version control. Not strictly required, but Git is your real undo button, as the section on recovering explains.

Step 1: Install It

The recommended route is the native installer. On macOS, Linux or WSL:

curl -fsSL https://claude.ai/install.sh | bash

In Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Homebrew (brew install --cask claude-code) and WinGet (winget install Anthropic.ClaudeCode) also work, but unlike the native install they do not update themselves. An npm package still exists; Anthropic's page now lists Node.js 22 or later for it and warns against installing it with sudo. Open a new terminal afterwards and run claude --version — a version number means it worked. If the shell says the command is not found, the install folder is not on your PATH yet; claude doctor prints a diagnosis.

Step 2: Start a Session and Log In

cd path/to/your-project
claude

The first time, Claude Code asks you to log in through your browser. If you have set an ANTHROPIC_API_KEY environment variable and approve it when asked, it uses that instead. Your credentials are stored, so you log in once.

Step 3: Let It Read Before It Writes

Start with questions, not changes:

what does this project do?
where is the main entry point?
explain the folder structure

You do not have to paste files in — it reads what it needs. This first pass tells you whether it has understood the codebase before you trust it with an edit.

Step 4: Make a First Small Change

Ask for something small and easy to check, such as "add input validation to the signup form". Claude Code shows the change and, depending on the session's permission mode, asks before applying it. Press Shift+Tab to cycle permission modes; as a beginner, stay in the mode that asks before edits until you know how it behaves on your code.

How to Give Instructions That Work

Too vague: "Fix the bug." Too narrow: "On line 247 of auth.ts, change 3000 to 5000." Useful: "Users are logged out after about three minutes. Find out why and fix it, then run the auth tests."

Describe the outcome, the symptom and how you will know it is done. For bigger jobs, break the work into numbered steps in one message. And let it explore first — "analyse the database schema" — before asking for changes that depend on it.

Give It a Project File: CLAUDE.md

Every session starts with a fresh context, so anything you want Claude Code to remember about your project goes in a file called CLAUDE.md in the project root (or in .claude/CLAUDE.md). Run /init and it generates a starting version by reading your codebase: build commands, test instructions and conventions it finds. Then edit it: add the commands you run, coding standards, naming rules and things it must never touch. Anthropic's guidance is to keep each CLAUDE.md under about 200 lines, because longer files use more context and are followed less consistently. Treat it as instructions Claude reads, not as enforcement — the documentation says that to block an action outright you need a hook, not a line in CLAUDE.md. Personal preferences for every project go in ~/.claude/CLAUDE.md instead.

When It Goes Wrong: Rewind, Then Git

Claude Code saves a checkpoint of your files before each prompt you send. Press Esc twice with an empty prompt, or type /rewind, and you can restore the code, the conversation or both to an earlier point. Two limits matter. Checkpoints do not track files changed by shell commands it runs — a deleted or moved file cannot be rewound — and Anthropic says plainly that checkpoints are not a replacement for version control. So commit before a large task, and ask it to work on a branch:

create a new branch called fix/session-timeout
what files have I changed?
commit my changes with a descriptive message

Commands Worth Knowing

CommandWhat it does
claudeStart an interactive session
claude "task"Start with a first instruction
claude -cContinue the most recent conversation in this folder
claude -rPick a previous conversation to resume
claude -p "query"Answer once and exit — useful in scripts
/helpList the commands available in your version
/clearClear the conversation history
/initCreate or improve CLAUDE.md
/rewindOpen the checkpoint menu
/exitLeave the session

For harder problems you can raise the effort level when you start: claude --effort high. The documentation lists low, medium, high, xhigh and max, with the levels available depending on the model; higher effort uses more of your allowance. (Older guides mention a --thinking flag; it is not in the current command reference.)

What to Use It For — and What Not To

Good first tasks: refactors that touch many files, writing tests for existing behaviour, tracing a bug through unfamiliar code, adding a feature that follows a pattern already in the codebase, and updating documentation.

Poor fits: one-line edits you could type faster yourself, real-time autocomplete while you type (an editor assistant such as Cursor or GitHub Copilot does that), and decisions about architecture or product direction, which stay yours. Review every diff before you merge it; a change that runs is not the same as a change you want.

→ Full Claude Code profile | Compare coding agents

Related: Best AI Coding Agents in 2026 | What Is an AI Agent? | How to Build an AI Agent Workflow

The Habits That Separate Useful From Frustrating

The difference between people who get value from an agentic coding tool and people who give up is almost entirely process, not prompting skill:

  • Work in a git repository, and commit before you start. The ability to throw away
everything the agent did is what makes it safe to let it work broadly.
  • Give it one task with a definition of done. "Fix the build" is checkable. "Improve
this file" is not, and it produces sprawling changes nobody wants to review.
  • Let it read before it writes. An agent that has explored the surrounding code
matches the conventions; one that starts editing immediately invents its own.
  • Ask for a plan on anything non-trivial, read it, then approve. Correcting a plan
costs seconds; correcting an implementation costs a review.
  • Review the diff, always. This is not optional and it does not become optional with
experience.

What to Put in a Project Instruction File

Most repeated frustration is a missing instruction rather than a model limitation. A short project file that the agent reads every session removes it permanently:

IncludeWhy
How to build, test and lintOtherwise it guesses, and guesses wrong
The package manager to useThe single most common avoidable error
Conventions that are not obvious from the codeNaming, error handling, file layout
What must never be touchedGenerated files, vendored code, migrations
How to run one test rather than all of themTurns a slow loop into a fast one

Keep it short and factual. A long document of aspirations is ignored; five lines of "here is how this repository actually works" changes every session.

Where an Agent Is Genuinely Strong

TaskSuitability
Mechanical refactors across many filesExcellent, and tedious by hand
Writing tests for existing behaviourExcellent
Tracing a bug through unfamiliar codeVery good; it reads faster than you
Adding a feature that resembles an existing oneVery good
Migrations with a clear before and afterGood, with verification
Architecture decisionsPoor; that judgement is yours
Anything with no way to check the resultPoor, and dangerous

The final row is the real boundary. If you cannot verify the output, you have not delegated the work, you have only delegated the typing.

When It Goes Wrong

Two failure modes recur, and both have a cheap fix:

  • It has misunderstood the goal and is confidently building the wrong thing. Stop
it early. Restating the goal costs less than reviewing work you will discard.
  • It is thrashing on a problem, trying variations. That usually means the task is
under-specified or the feedback loop is broken — the tests do not run, or the error is not surfacing. Fix the loop rather than re-prompting.

For how this fits into a wider agent workflow, see building an AI agent workflow, and for the comparison across coding tools, the best AI coding agents.

Frequently asked questions

Is Claude Code free?

No. Anthropic's setup documentation says Claude Code requires a Pro, Max, Team, Enterprise or Console account, and that the free claude.ai plan does not include it. Enterprise access through Amazon Bedrock, Google Cloud or Microsoft Foundry is also supported.

How do I install Claude Code?

Run Anthropic's native installer — curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux or WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell — then open a new terminal and run claude --version to check it worked. Homebrew and WinGet installs are also available.

What is CLAUDE.md and do I need one?

CLAUDE.md is a file in your project root that Claude Code reads at the start of every session: build and test commands, coding standards and project rules. Running /init creates a first version. You do not strictly need one, but without it every session starts knowing nothing about your conventions.

How do I undo changes Claude Code made?

Press Esc twice with an empty prompt, or type /rewind, to restore code or conversation to an earlier checkpoint. Changes made by shell commands are not tracked by checkpoints, so commit to Git before large tasks and use Git for anything checkpoints cannot restore.

What should a beginner ask Claude Code to do first?

Start with questions about the codebase, then a small change you can check easily, such as adding validation to one form. Move on to multi-file refactors and test writing once you have seen how it handles your project.

Related articles

Continue in this collection