Dev tools
How to Use Claude Code: A Beginner's Guide
Learn how to use Claude Code step by step: install it, run your first session, set up CLAUDE.md, learn the key commands, and avoid common beginner mistakes.
If you want to know how to use Claude Code, the good news is that the basics take about fifteen minutes to learn. Claude Code is Anthropic's AI coding agent. You describe what you want in plain English, and it reads your project, edits files, runs commands, and explains what it did, asking your permission along the way.
This beginner's guide walks you through everything in order: what you need, how to install it, your first session, the settings that keep you in control, the commands worth learning, and the habits that separate good results from frustrating ones.
What is Claude Code?
Claude Code is a coding assistant that works directly inside your project, rather than in a chat window you copy and paste from. It can:
- Read and search your whole codebase to answer questions about it.
- Write new code and edit existing files.
- Run terminal commands such as tests, builds, and Git.
- Fix errors by reading the output and trying again.
It started as a tool you run in the terminal, and that's still the most common way to use it. It's also available as an extension for VS Code and JetBrains editors, in a desktop app, and on the web. This guide focuses on the terminal, because everything else builds on the same ideas.
If you're still choosing a tool, our comparison of Claude Code vs Cursor vs Codex explains how it differs from the alternatives.
What you need before you start
A Claude account with access
Claude Code needs either a paid Claude subscription, such as Pro or Max (it's also available on Team and Enterprise plans), or a Claude Console account, which bills you per use through Anthropic's API.
Is Claude Code free?
No. A common question is "is Claude Code free," and the answer is that it isn't included in Claude's free plan. You'll need one of the paid plans or Console billing above. Each plan comes with usage limits, and long sessions on big projects use more of your allowance. Check Anthropic's pricing page for current plans and limits.
A computer and a terminal
Claude Code runs on macOS, Linux, and Windows. You don't need to be a terminal expert, but you should be comfortable opening one and moving into a folder with cd.
A project in Git (strongly recommended)
Git isn't strictly required, but it's your safety net. If your project is in Git, you can always see exactly what Claude changed and undo it. If you've never used Git, it's worth learning the basics first: git status, git diff, and git commit.
How to install Claude Code
Here's how to install Claude Code using the methods recommended in Anthropic's official repository.
macOS and Linux
Open a terminal and run:
curl -fsSL https://claude.ai/install.sh | bashIf you use Homebrew, you can instead run:
brew install --cask claude-codeWindows
Open PowerShell and run:
irm https://claude.ai/install.ps1 | iexOr, with WinGet:
winget install Anthropic.ClaudeCodeOlder guides tell you to install it with npm (npm install -g @anthropic-ai/claude-code). That method still exists but is now deprecated, so use one of the options above instead.
Check that it works
Close and reopen your terminal, then run claude --version. If you see a version number, you're ready. If something seems wrong later, the /doctor command inside Claude Code checks your setup and points out problems.
How to use Claude Code: your first session
Follow these steps for your first real session. Try them on a small personal project before your main work.
1. Open your project and start Claude Code
In the terminal, go to your project folder and type claude:
cd path/to/your-project
claudeAlways start Claude Code from your project's main folder, because that's the part of your computer it works in.
2. Sign in
The first time, Claude Code asks you to sign in. Choose your Claude account or your Console account, and finish signing in through your browser. You can switch accounts later with /login.
3. Ask about the project first
Before changing anything, ask questions. This is the safest way to learn how Claude Code thinks, and it often teaches you something about your own code. Try:
- "Give me an overview of this project and how it's organized."
- "Where is the login logic handled?"
- "How do I run the tests?"
4. Make a small change
Now ask for something small and specific, such as "Add a check that the email field isn't empty before the form is submitted, and show an error message if it is."
Claude Code will look at the relevant files, propose edits, and show you what it wants to change. By default it asks before editing files or running commands. Read each request and approve or reject it.
5. Review and commit
When it's done, check the result yourself. Run the app, look at the change with git diff, and commit it if you're happy. If you're not, tell Claude Code what's wrong and let it try again, or undo the change.
That's the core loop of how to use Claude Code: ask, review, approve, check, commit. Everything else makes this loop faster or safer.
Stay in control: permission modes
Claude Code has several permission modes that decide how much it can do without asking you. Press Shift+Tab to switch between them. The current mode is shown near the input box.
Default mode asks before it edits files or runs commands. Stay here while you're learning.
Auto-accept edits lets Claude edit files without asking each time, while still checking before other actions. It's handy once you trust the task and have committed your work in Git.
Plan mode lets Claude research your code and write a plan without changing anything. Use it for bigger tasks: read the plan, push back on parts you disagree with, and only then let it start.
The /permissions command lets you pre-approve safe commands you use often, such as running tests, so you aren't asked every time. Be careful about approving anything that deletes files, touches production systems, or uses secrets.
Give Claude Code a memory with CLAUDE.md
Each new session starts fresh. To avoid explaining your project every time, Claude Code reads a file called CLAUDE.md from your project folder at the start of each session.
The easiest way to create one is to run /init in a session. Claude Code studies the project and writes a first draft. Then edit it to add what matters to you, such as:
- How to install, run, build, and test the project.
- Your coding style and conventions.
- Important folders and what they contain.
- Things to avoid, like "don't edit files in /generated."
Keep it short and practical. You can open your memory files with the /memory command. A good CLAUDE.md is one of the biggest improvements you can make to the quality of Claude's work.
Essential Claude Code commands
Inside a session, commands start with a slash. Type / to see the full list. These are the Claude Code commands most useful for beginners:
| Command | What it does |
|---|---|
/help | Shows help and available commands |
/init | Creates a starter CLAUDE.md for your project |
/clear | Clears the conversation to start a fresh task |
/compact | Summarizes a long conversation to free up space |
/model | Switches the AI model |
/permissions | Manages which actions are allowed without asking |
/resume | Picks up a previous conversation |
/rewind | Rewinds the conversation, and optionally the code, to an earlier point |
/usage | Shows how much of your plan's usage you've used |
/memory | Opens your CLAUDE.md memory files |
/config | Opens settings |
/doctor | Checks your installation for problems |
A few other shortcuts are worth knowing. Press Esc to stop Claude mid-task, and press Esc twice to open the rewind menu. Start Claude Code with claude --continue to pick up your most recent conversation.
Claude Code tips for beginners
These Claude Code tips will save you time and frustration.
Be specific
"Fix the bug" gives Claude little to go on. "When I submit the form with an empty name, the page crashes. Find out why and fix it" gets far better results. Mention the file, the behavior you see, and the behavior you want.
Work in small steps
Ask for one feature or fix at a time, check it, and commit it. Big, vague requests produce big, tangled changes that are hard to review.
Plan before big changes
For anything that touches many files, switch to plan mode first. A minute spent correcting a plan saves much longer untangling bad code.
Start fresh between tasks
Use /clear when you move to an unrelated task. Long conversations full of old details can confuse Claude and use more of your allowance.
Ask it to test its own work
Say "write tests for this and run them" or "run the test suite and fix anything that fails." Claude Code can run commands, so let it check its own work.
Keep reading the code
Claude Code is fast, but it can still make mistakes. Accepting code you haven't read is called vibe coding. It's fine for throwaway experiments, but risky for anything real. Read every change before you commit it.
How to use Claude Code in your editor, desktop, or browser
Once you're comfortable in the terminal, you can use Claude Code in other places:
- VS Code and JetBrains: official extensions let you work with Claude Code inside your editor and see proposed changes as visual diffs.
- Desktop app: run Claude Code sessions from Anthropic's desktop app.
- Web: start tasks from your browser that run in the cloud, which is useful when you're away from your computer.
The same ideas apply everywhere: clear requests, permissions, CLAUDE.md, and careful review.
Common beginner mistakes
Starting in the wrong folder. Claude Code works in the folder where you launched it. Starting in your home folder instead of your project leads to confusion.
Skipping Git. Without commits, undoing a bad change is much harder. Commit before and after each task.
Approving everything without reading. The permission prompts are there for a reason, especially for commands that delete or move files.
One giant conversation. Mixing many tasks in one long session makes results worse. Clear and start fresh.
Pasting secrets into the chat. Keep passwords and API keys in environment files that Claude doesn't need to read, never in your prompts.
FAQ
Is Claude Code free?
No. It isn't part of Claude's free plan. You need a paid Claude subscription, such as Pro or Max, a Team or Enterprise plan, or a Claude Console account with pay-per-use billing.
Do I need to know how to code to use Claude Code?
It helps a lot. Non-programmers can build simple things with it, but you'll get better and safer results if you can read code, understand errors, and use basic terminal and Git commands.
Can I use Claude Code on Windows?
Yes. Claude Code runs on Windows, macOS, and Linux. On Windows, install it from PowerShell with the official install script or with WinGet.
What's the difference between Claude Code and the Claude chat app?
The Claude chat app is a general assistant you talk to in a browser or app. Claude Code works directly in your project: it reads your files, edits them, and runs commands, which the chat app can't do on your computer.
Can I use Claude Code in VS Code?
Yes. There's an official VS Code extension, and you can also run Claude Code in VS Code's built-in terminal. JetBrains editors have an extension too.