Tutorial · Productivity
How to use Claude Code: install, first session, CLAUDE.md and permissions
A step-by-step guide to Claude Code: install it, log in, run your first session, write a CLAUDE.md, learn the essential commands and choose a permission mode.
The short answer
To use Claude Code, install it with one command (curl -fsSL https://claude.ai/install.sh | bash on macOS, Linux and WSL, or irm https://claude.ai/install.ps1 | iex in Windows PowerShell), open a terminal in your project, run claude and log in. Then ask questions about your code, request changes, and approve or decline each action Claude proposes.
Claude Code is Anthropic’s coding agent. It reads your codebase, edits files, runs commands and works with tools such as Git, and it lives where developers already work: the terminal, VS Code and JetBrains, a desktop app and the web. This tutorial walks through the essentials: installing it, logging in, running your first session, giving it instructions with a CLAUDE.md file and choosing how much it may do without asking. Commands and settings are taken from Anthropic’s documentation as of September 2026.
What you need
- A terminal or command prompt.
- A code project to work on.
- A Claude Pro, Max, Team or Enterprise plan, a Claude Console account, or access through Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry.
Step 1: Install Claude Code
macOS, Linux and WSL
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell
irm https://claude.ai/install.ps1 | iex
Windows Command Prompt
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Homebrew
brew install --cask claude-code
WinGet
winget install Anthropic.ClaudeCode
Confirm it worked:
claude --version
The command prints a version number followed by “(Claude Code)”. Native installs update themselves; Homebrew and WinGet installs don’t. On native Windows, Anthropic recommends installing Git for Windows so Claude Code can use the Bash tool; without it, Claude Code uses PowerShell.
Step 2: Log in
Start Claude Code with claude. On first use it asks you to log in, and you finish signing in through your browser. If you have set the ANTHROPIC_API_KEY environment variable, Claude Code asks you to approve the key instead. To switch accounts later, type /login inside a session.
Step 3: Start your first session
Open your terminal in a project folder and run:
cd /path/to/your/project
claude
You’ll see the version, the current model and the working directory. Type /help for available commands, or /resume to continue an earlier conversation.
Step 4: Ask your first questions
Start by letting Claude explore. It reads your files as needed, so you don’t have to paste context.
- “what does this project do?”
- “what technologies does this project use?”
- “where is the main entry point?”
- “explain the folder structure”
Step 5: Make your first change
Ask for something small, such as “add a hello world function to the main file”. Claude finds the right file and shows the change. If it asks before editing, select Yes to approve.
Step 6: Use Git conversationally
Claude Code works directly with Git:
- “what files have I changed?”
- “commit my changes with a descriptive message”
- “create a new branch called feature/quickstart”
- “help me resolve merge conflicts”
Step 7: Fix a bug or add a feature
Describe the goal in plain language: “there’s a bug where users can submit empty forms - fix it”. Claude locates the code, works out the context, implements a solution and runs tests if they exist. Be specific. Instead of “fix the bug”, say “fix the login bug where users see a blank screen after entering wrong credentials”. For big jobs, list the steps.
Essential commands
| Command | What it does |
|---|---|
claude | Start interactive mode |
claude "task" | Start with an initial prompt |
claude -p "query" | Run a one-off query, then exit |
claude -c | Continue the most recent conversation in this directory |
claude -r | Resume a previous conversation |
/help | Show available commands |
/clear | Clear conversation history |
/exit or Ctrl+D twice | Exit |
Give Claude instructions with CLAUDE.md
Each session starts with a fresh context window. A CLAUDE.md file carries your instructions across sessions: coding standards, architecture, common commands and review checklists.
| Scope | Where it lives | Shared with |
|---|---|---|
| User | ~/.claude/CLAUDE.md | Just you, in all projects |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | Your team, through source control |
| Local | ./CLAUDE.local.md (add it to .gitignore) | Just you, in this project |
- Run
/initto generate a startingCLAUDE.md. Claude analyses your codebase and writes build commands, test instructions and conventions it finds. If one already exists, it suggests improvements. - Run
/memoryto list and edit the memory files loaded in the session, and to toggle auto memory, notes Claude writes itself from your corrections and preferences. - Run
/contextto check which files loaded. - Keep it short and specific. Claude treats
CLAUDE.mdas context, not enforced rules; to block an action for certain, use a permission rule or a hook.
If your repository already has an AGENTS.md for other coding agents, Claude Code can read that too.
Choose a permission mode
A permission mode decides what Claude can do without asking. Press Shift+Tab to cycle modes in a session.
| Mode | What runs without asking | Best for |
|---|---|---|
default (Manual) | Reads only | Reviewing every action, sensitive work |
acceptEdits | Reads, file edits and common file commands such as mkdir, mv and cp | Iterating on code you’re reviewing |
plan | Reads, plus classifier-approved commands where auto mode is available | Exploring a codebase before changing it |
auto | Everything, with background safety checks by a classifier | Long tasks, fewer prompts |
dontAsk | Reads and pre-approved tools; anything else is denied | Locked-down CI and scripts |
bypassPermissions | Everything | Isolated containers and VMs only |
On Pro, Max and Team plans, auto mode is the built-in starting mode for interactive terminal sessions; on other plans it is Manual. Run /permissions to see and change the allow and deny rules, which live in settings.json files such as .claude/settings.json in a project and ~/.claude/settings.json for you. Claude Code enforces these rules, not the model, so an instruction in your prompt can’t override them.
Use Claude Code beyond the terminal
- VS Code and Cursor: an extension with inline diffs, @-mentions and plan review.
- JetBrains: a plugin for IntelliJ IDEA, PyCharm, WebStorm and other IDEs; it needs the CLI installed separately.
- Desktop app: macOS and Windows, with visual diffs, side-by-side sessions and scheduled tasks. Open the Code tab. It needs a paid plan.
- Web: claude.ai/code, and the Claude apps for iOS and Android, for long-running tasks with no local setup.
- Slack and CI: mention @Claude in Slack, or run it in GitHub Actions and GitLab CI/CD.
Go further
Once the basics feel natural, Anthropic’s documentation points to MCP servers that connect Claude to tools such as Jira and Slack, skills that package repeatable workflows, hooks that run commands before or after actions, subagents that work in parallel, and routines that run on a schedule, even when your computer is off. You can also pipe output into it, for example tail -200 app.log | claude -p "Slack me if you see any anomalies".
Safety tips
- Work on a branch and review every diff before you merge.
- Start in default or plan mode until you trust what Claude does.
- Keep secrets out of prompts and files Claude can read.
- Use
bypassPermissionsonly in an isolated container or virtual machine.
To see how Claude Code compares with Codex, GitHub Copilot, Cursor and others, read our guide to the best AI coding assistants. For the same approach applied to everyday work, see What is Claude Cowork?, and for plans and models, see Claude Pro vs Max, Claude models explained and the Claude profile.
Frequently asked questions
Is Claude Code free?
No. Claude Code needs a Claude Pro, Max, Team or Enterprise plan, a Claude Console account with pre-paid API credits, or access through a supported cloud provider. Claude Pro costs $20 a month in the US, or $17 a month billed annually, and Max starts at $100 a month.
How do I install Claude Code on Windows?
In PowerShell, run irm https://claude.ai/install.ps1 | iex. In Command Prompt, run curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd. You can also use WinGet with winget install Anthropic.ClaudeCode. Anthropic recommends Git for Windows so Claude Code can use the Bash tool.
What is a CLAUDE.md file?
It is a markdown file that Claude Code reads at the start of every session, where you put project instructions such as coding standards, architecture decisions, build and test commands and preferred libraries. Run /init to generate a starting file automatically, and /memory to see and edit the files Claude has loaded.
Which permission mode should I use?
Use the default mode, which asks before edits and commands, for sensitive work. Use acceptEdits while you iterate on code you are reviewing, plan to explore before changing anything, and auto for long tasks on plans that offer it. Reserve bypassPermissions for isolated containers and virtual machines. Press Shift+Tab to switch modes.
Can I use Claude Code inside VS Code or JetBrains?
Yes. There is a VS Code extension, which also installs in Cursor, and a plugin for IntelliJ IDEA, PyCharm, WebStorm and other JetBrains IDEs. The JetBrains plugin needs the Claude Code CLI installed separately. There are also a desktop app, a web version at claude.ai/code and a Slack integration.
How do I update Claude Code?
Native installations update themselves in the background. Homebrew and WinGet installations don't, so run brew upgrade claude-code (or claude-code@latest) or winget upgrade Anthropic.ClaudeCode to get new versions.
Sources
Product facts are checked against the vendor's own announcements and documentation.
- Claude Code overview — Anthropichttps://code.claude.com/docs/en/overview
- Claude Code quickstart — Anthropichttps://code.claude.com/docs/en/quickstart
- How Claude remembers your project — Anthropichttps://code.claude.com/docs/en/memory
- Configure permissions — Anthropichttps://code.claude.com/docs/en/permissions
- Choose a permission mode — Anthropichttps://code.claude.com/docs/en/permission-modes
- Claude plans & pricing — Anthropichttps://claude.com/pricing