How to use Claude Code
By Mari Luukkainen · 7 min read · Last updated
On this page
To use Claude Code, install it, open a terminal in your project folder, type claude, sign in once and describe a task. It reads your files, proposes changes and edits or runs commands depending on its permission mode. Add a CLAUDE.md file with your project rules and commit to Git before each task.
This tutorial gives the install steps for each operating system, a first session you can copy, the commands worth learning and the problems a first-time user meets. For the background first, see what Claude Code is. Anthropic's setup page is the source for install commands.
Ask AI about this pageChatGPTClaudePerplexityGoogle AI ModeGrok
How do you install Claude Code?
Open a terminal. On macOS that is the Terminal app, on Windows PowerShell, on Linux your usual terminal. Anthropic recommends the native installer.
macOS, Linux and Windows Subsystem for Linux
curl -fsSL https://claude.ai/install.sh | bashWindows (PowerShell)
irm https://claude.ai/install.ps1 | iexGit for Windows is optional. With it installed, Claude Code uses Git Bash for shell commands. Without it, Claude Code uses its PowerShell tool. The Windows Subsystem for Linux route does not need it.
Homebrew
brew install --cask claude-codeThat installs the stable release. The cask claude-code@latest follows the newest release.
npm
npm install -g @anthropic-ai/claude-codenpm is documented under advanced installation options. It needs Node.js 22 or newer and installs the same native binary. The native installer and Homebrew do not need Node.js. Do not use sudo with npm. If you get a permission error (EACCES), configure npm to install global packages in your home folder, or use the native installer.
Check that it worked
claude --version
claude doctorThe first command prints a version. The second runs a health check of the installation. If the terminal says "command not found: claude", close it, open a new one and try again. The installer adds a folder to your PATH, and an old terminal window does not know about it yet.
How do you start your first session?
- Make or pick a project folder. For practice, use a new empty one: mkdir practice, then cd practice.
- Run git init so the repository is tracked.
- Type claude and press Enter.
- The first time, it asks you to sign in. A browser window opens, you approve, and you return to the terminal.
- It asks whether you trust the folder. Say yes only for folders you made or trust.
- Write your first task.
Create a single-page website index.html for a bakery called Corner Loaf. Sections: opening hours (Tuesday to Saturday, 7 to 15), a list of five products, and an address placeholder. Plain CSS in the same file, readable on a phone. Then tell me the file path so I can open it.Approve the file creation if it asks, open the file in your browser, then ask for one change at a time: "make the product names bigger", "put the hours in a table".
Which commands are worth learning first?
Type a forward slash in a session to see the list. These are the ones for the first week:
| Command | What it does | When to use it |
|---|---|---|
| /init | Looks at the project and drafts a CLAUDE.md | Once per project, then edit by hand |
| /help | Lists commands | When you forget one |
| /clear | Empties the conversation | When you start a new task |
| /compact | Summarises the conversation to free space | In a long session you want to continue |
| /context | Shows how much of the conversation space is used | When answers get worse in a long session |
| /model | Switches the model | Check which models your account offers |
| /permissions | Shows and edits what is allowed | After you approve the same command five times |
| /rewind | Opens the checkpoint menu (also Esc twice) | When a task went wrong |
Other things to know:
- Esc stops what the tool is doing. Esc twice opens the rewind menu.
- @ followed by a file name points it at a file. A line starting with ! runs a shell command without leaving the session.
- Shift+Tab cycles permission modes: default, acceptEdits (auto-accept file edits) and plan (it proposes and does not edit). Auto and bypassPermissions appear only when enabled (permission modes).
- claude --continue picks up the last session in this folder. claude --resume (or -r) lets you pick an earlier one. claude -p "question" answers once and exits.
The list changes between releases, so /help is the authority.
How do you write a useful CLAUDE.md?
Run /init, read what it wrote, and cut it down. Keep what the tool cannot guess: the commands to run tests and the build, where things live, and rules. Leave out what it can read from the code.
# Corner Loaf website
Static site. No framework.
## Commands
- View: open index.html in a browser
- Check: no build step
## Rules
- Keep everything in index.html unless I ask for more files.
- Plain CSS, no libraries.
- Mobile first, test at 375 pixels wide.
- Ask before deleting a file.- A CLAUDE.md in the project is shared with anyone who clones the repository. A file at ~/.claude/CLAUDE.md applies to all your projects, so keep personal habits there.
- If you also use Codex, Copilot or Cursor, write the rules once in AGENTS.md and make CLAUDE.md a single line: @AGENTS.md. Claude Code imports the file. Without a CLAUDE.md, Claude Code reads AGENTS.md on its own (memory).
Review it every few weeks. When the tool does something you did not want, add one line. When a line stops being true, remove it. I do the same at a larger scale: I write each decision down once, so neither I nor the AI re-decides it (post).
How do permissions work in practice?
Which actions need your approval depends on the permission mode (see Shift+Tab above). When Claude Code asks, you can approve once, approve and stop asking, or refuse. Refusing is fine. Tell it what to do instead: "Do not run that. Show me the command and explain it."
- Reading files and read-only commands such as git status and git diff run without a prompt.
- Approving a file edit with "allow for the session" lasts until the session ends. "Yes, don't ask again" on a shell command saves a rule in .claude/settings.local.json that stays for that repository and command.
- Read every command that deletes (rm), installs (npm install, pip install), changes Git history (git reset, git push --force) or sends data (curl, scp).
- Never approve a command you cannot read. Ask for an explanation first.
CLAUDE.md is guidance. Writing "never read .env" in it blocks nothing. A deny rule does, in .claude/settings.json:
{
"permissions": {
"allow": ["Bash(npm run test)", "Bash(npm run build)"],
"deny": ["Read(./.env)"]
}
}What is a good daily routine?
- Start from a clean Git state: git status shows nothing uncommitted.
- Write the task with an outcome, constraints and a check: "Run the tests and the build."
- Let it plan first for anything bigger than a small fix (plan mode).
- Approve steps you understand.
- Read the diff: git diff. Run the app.
- Commit if good, rewind or discard if not, then /clear for the next task.
More habits are in Claude Code best practices. Prompts to start from are in the prompt library.
What goes wrong for first-time users?
command not found: claude
Open a new terminal window. If it persists, the install folder is not on your PATH. Re-run the installer and read its closing message.
It asks to sign in every time
The sign-in did not complete. Run the start command again, finish the browser step, and wait for the confirmation before returning to the terminal.
It edited files you did not mention
Add to the task: "Only change files needed for this." Add the rule to CLAUDE.md. Check with git status.
It says the tests pass but the app is broken
The tests do not cover what you see. Ask: "Write a test that fails for the problem I just described, then fix it."
The conversation got slow or confused
Check /context, run /compact to summarise, or /clear and restate the task. Long sessions drift.
You approved something you regret
Press Esc twice or type /rewind to restore Claude's own file edits from a checkpoint made before the prompt. Checkpoints do not track changes made by shell commands, so also run git status and git diff. Committed work is recoverable with git log. If the folder was not under Git, start every project with git init.
You hit a usage limit
Claude plans measure usage per five hours and per week. Wait for the reset, switch to a smaller task, or move to a larger plan. Limits per plan are in best vibe coding tools.
Frequently asked questions
How much usage does Claude Pro include for Claude Code?
Anthropic lists Pro as 1x usage per 5 hours and per week, Max ($100) as 5x, and Ultra ($200) as 10x weekly with no 5-hour limit (checked 1 November 2026). The free plan has no Claude Code access.
Can Claude Code open a pull request for me?
Yes, in two ways. A cloud session started from claude.ai/code pushes a branch and you can create the pull request there. Or install the GitHub app with /install-github-app and mention @claude in an issue or pull request, which runs the anthropics/claude-code-action.
Can I run Claude Code inside Cursor or VS Code?
Yes. There is a Claude Code extension for VS Code, which also works in Cursor, and a plugin for JetBrains.
Can I start a task on my phone?
Yes, the Claude mobile app can start cloud sessions, which run in an Anthropic-managed virtual machine and push a branch. They are available on Pro, Max, Ultra and Team plans.
Next guideClaude Code pricing →