Claude Code tutorial: from zero to your first task
A Claude Code tutorial for beginners: one-command install, login, your first task in the terminal, the CLAUDE.md file and the commands worth knowing.
This article in other languages:العربيةDeutschEspañolFrançaisItaliano日本語Polski简体中文
In this article
This Claude Code tutorial takes you from zero to your first working session: one install command, signing in with your Claude account, a first task in your own project, and a CLAUDE.md file that lets the agent remember your project’s rules. You need a terminal, any code project, and a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account with API credits. The whole thing takes about fifteen minutes.
I’m writing this as a user: I run this site with Claude Code, from the code to publishing posts. Every command below comes from the official documentation.
What is Claude Code
Claude Code is Anthropic’s coding agent, and it runs in your terminal. Unlike a chat, it doesn’t just answer: it reads files in your repository, edits them, runs commands, writes tests and makes commits. You describe what you want to achieve, and Claude finds the right files and proposes changes on its own.
The same engine also works outside the terminal: in VS Code and JetBrains, in the desktop app, in the browser at claude.ai/code and in the mobile app. In this tutorial I stick to the terminal, because that’s where you see the most.
Claude Code tutorial: install in one command
The recommended method is the native installer, which updates itself in the background.
macOS, Linux and WSL:
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Windows CMD:
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
The installer doesn’t show progress. When it finishes, open a new terminal window and check:
claude --version
If you see a version number followed by (Claude Code), everything works. A message saying claude is not recognized usually means the install directory is missing from your PATH; the docs have a dedicated section for that.
Alternatives: brew install --cask claude-code on macOS and winget install Anthropic.ClaudeCode on Windows. These two methods don’t update automatically. On Windows without WSL, it’s worth installing Git for Windows so Claude has access to Bash.
Logging in and your first session
Go to your project directory and start the agent:
cd /path/to/project
claude
On first launch, Claude Code asks you to log in through the browser. You sign in with a Claude account (Pro, Max, Team or Enterprise plan) or a Claude Console account, meaning API access with prepaid credits. Your credentials are saved, so you only do this once. If you have the ANTHROPIC_API_KEY environment variable set, Claude asks whether to use it and skips the login.
Once you’re logged in, you’ll see a prompt with the version number, the model name and your working directory. Type /help to see the available commands.
Your first task
Start with questions before you let the agent change anything. Claude reads the files itself, so you don’t need to paste them:
what does this project do?
where is the main entry point?
explain the folder structure
Then a small change:
add a hello world function to the main file
Claude finds the right file and shows you a diff. If it asks for permission, approve it. What the agent has to ask about is decided by the permission mode, which you switch with Shift+Tab. In newer versions the default is auto mode, where a separate classifier model checks actions and blocks only the risky ones.
You can handle Git in plain sentences too:
what files have I changed?
commit with a descriptive message
create a branch called feature/quickstart
CLAUDE.md, your project’s memory
Every session starts with an empty context. So you don’t have to explain every time how the project builds and which conventions you follow, write it down in a CLAUDE.md file in the repository root. Claude reads it at the start of every conversation.
The fastest way to begin is the /init command: Claude analyzes the repository and generates a file with the build commands, tests and conventions it discovers. Then you add what can’t be read from the code.
What’s worth keeping there, according to the documentation:
- commands Claude won’t guess (build, tests, lint),
- style rules that differ from the defaults,
- repository etiquette (branch names, PR conventions),
- architectural decisions and project-specific gotchas.
What to leave out: anything Claude can read from the code itself, and generic advice like “write clean code”. The docs recommend keeping the file under 200 lines. Longer files eat context and get followed less reliably.
A few facts that will save you some searching:
~/.claude/CLAUDE.mdholds your personal rules for all projects,./CLAUDE.mdholds project rules shared with your team, and./CLAUDE.local.mdholds private notes for a given repository (add it to.gitignore).- The file can pull in other files with the
@path/to/filesyntax. - If the repository already has an
AGENTS.mdfor other agents, Claude Code reads it instead ofCLAUDE.md. /contextshows which memory files were loaded.
Commands worth knowing
| Command | What it does |
|---|---|
claude |
starts an interactive session |
claude "task" |
starts right away with a first instruction |
claude -p "question" |
one query without a session, output to the terminal |
claude -c |
continues the last conversation in this directory |
claude -r |
picks an earlier conversation to resume |
/init |
generates a starter CLAUDE.md |
/clear |
clears the context between unrelated tasks |
/compact |
summarizes the conversation to free up context |
/rewind (or Esc twice) |
rolls the conversation and file changes back to a chosen point |
/permissions |
list of trusted tools, fewer permission prompts |
Shift+Tab |
switches the permission mode, including plan mode |
/exit |
exit |
The -p mode is especially handy in scripts: cat error.log | claude -p "explain this error" sends the file straight to the model.
Five habits that make a difference
Most of the advice in the official best practices comes down to one constraint: the context window fills up fast, and quality drops as it does.
- Explore and plan first, then code. For bigger changes, turn on plan mode (
Shift+Tabuntilplan mode onappears). Claude reads files and proposes a plan, but changes nothing until you approve it. For one-line fixes, a plan is unnecessary overhead. - Be specific. Instead of “fix the login bug”, say what the symptom is, where the cause probably lies and what “fixed” means. Point to files with
@file-name. - Give the agent a way to check its work. Tests, a build, lint or a screenshot to compare against. Without that, “looks done” is the only signal, and you end up being the tester.
- Clear the context.
/clearbetween unrelated tasks. If you’ve corrected Claude twice on the same issue, start over with a better prompt. - Roll back without fear. Every prompt creates a checkpoint. When an experiment doesn’t work out,
/rewindrestores the conversation and the files. It doesn’t replace Git, but it encourages bolder attempts.
Frequently asked questions
Is Claude Code free?
No. The docs require a paid Claude plan (Pro, Max, Team or Enterprise) or a Claude Console account, where you pay for API tokens. Current plan prices are at claude.com/pricing.
Does Claude Code work on Windows?
Yes, natively (PowerShell or CMD) and in WSL. On native Windows it’s worth having Git for Windows, because then the agent uses Bash; without it, it uses PowerShell.
Do I have to use the terminal?
No. The same agent is available as a VS Code and JetBrains extension, a desktop app and a browser version. CLAUDE.md files, settings and MCP servers work the same way on each of these surfaces.
How is Claude Code different from Claude chat?
The chat answers questions. Claude Code works in your repository: it reads and edits files, runs commands and tests, makes commits and opens pull requests. So it gets a task, not a question.