Skip to content
codewithanjum
Claude

How to use Claude Code: a beginner's guide from install on

How to use Claude Code from scratch: install it, run a first session, write a CLAUDE.md, use plan mode and learn the slash commands worth knowing.

By Md Anjum Kamali · · 6 min read

Painting of a desk calendar with seven days crossed out under a sunburst symbol, on an orange background
On this page
  1. What is Claude Code?
  2. What do you need before you start?
  3. How to install Claude Code
  4. Your first session
  5. How to set up CLAUDE.md
  6. Plan mode and permissions
  7. Which slash commands should a beginner learn?
  8. Good habits that save the most time
  9. Where to go next
  10. Questions people ask

To use Claude Code, install it with one command, open a terminal in your project folder, type claude, log in, and then describe what you want in plain English. It reads your files and makes edits, asking permission depending on the mode you pick. The habits that make it good are a short CLAUDE.md file, plan mode for anything bigger than a one-line fix, and clearing context between unrelated tasks.

I use Claude Code every day, mostly on NestJS and React projects, plus the Astro site you're reading this on. Here's the setup I'd give a friend on day one.

What is Claude Code?

Claude Code is Anthropic's coding agent: a tool that runs in your terminal (and in VS Code, JetBrains, a desktop app and the web) and can read your codebase, edit files, run shell commands and use git on your behalf.

The difference from a chat window is that it acts. You say "add input validation to the signup form" and it finds the form, writes the change, runs the tests if you ask, and shows you the diff.

What do you need before you start?

From Anthropic's Claude Code quickstart:

  • A terminal and a project folder to work in
  • One of: a Claude Pro, Max, Team or Enterprise subscription, a Claude Console account with prepaid API credits, or access through Amazon Bedrock, Google Cloud or Microsoft Foundry

Plan prices are on Claude's pricing page. The subscription route is simpler for most people because you aren't watching per-token costs.

How to install Claude Code

The native installer is the recommended route. Pick the line for your system.

macOS, Linux or 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

If you prefer a package manager, there's brew install --cask claude-code on Mac and winget install Anthropic.ClaudeCode on Windows. The native install updates itself in the background. Homebrew and WinGet don't, so you'll need to run their upgrade commands now and then.

Open a new terminal and check it worked:

claude --version

If the shell says claude isn't found, the install folder isn't on your PATH yet. The docs have a troubleshooting page for exactly that.

On native Windows, install Git for Windows too. Without it, Claude Code falls back to PowerShell instead of Bash.

Your first session

1. Start it in a project

cd /path/to/your/project
claude

The first run asks you to log in through your browser. After that your credentials are saved.

2. Ask about the code before changing it

Good first prompts:

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

You don't need to paste files in. Claude Code reads what it needs.

3. Make one small change

add a hello world function to the main file

It shows you the edit. Depending on your permission mode, it either asks before applying it or applies it and tells you. Read the diff either way.

4. Use git through it

what files have I changed?
commit my changes with a descriptive message

That's the whole loop. Everything after this is about doing it with less friction and fewer mistakes.

How to set up CLAUDE.md

CLAUDE.md is a markdown file Claude reads at the start of every session. It's where you put things it can't guess from the code: the test command, the package manager, the rule that migrations are never edited by hand.

Run /init inside a session and Claude will generate a first draft from your codebase. Then trim it. Anthropic's memory docs suggest keeping each CLAUDE.md under 200 lines, because longer files eat context and get followed less reliably.

Where the files can live:

File Scope Commit it?
./CLAUDE.md or ./.claude/CLAUDE.md This project, shared with your team Yes
./CLAUDE.local.md This project, only you No, add it to .gitignore
~/.claude/CLAUDE.md Every project on your machine Not applicable

I keep a CLAUDE.md in every project. A short one for a NestJS API might look like this:

# Commands
- Install: pnpm install
- Dev server: pnpm start:dev
- Tests: pnpm test (run single files with pnpm test -- path/to/file)

# Rules
- Database access goes through Drizzle. Never write raw SQL in services.
- Background jobs use BullMQ queues in src/queues. Don't run slow work inside a request.
- Generate migrations with drizzle-kit. Never edit a migration that's already merged.

Run /context to confirm the file loaded. You can also pull other files in with @path/to/file syntax.

Plan mode and permissions

Permission modes decide what Claude can do without asking. Press Shift+Tab during a session to cycle through them. The permission modes page lists all of them; these are the ones a beginner will touch:

Mode What runs without asking Use it when
Manual Reads only You want to approve every edit and command
Edit automatically (acceptEdits) Reads, file edits, basic file commands You're iterating and reviewing diffs
Plan Reads and exploration, no source edits You're about to change several files
Auto Most actions, checked by a classifier model Longer tasks where prompts get tiring

On recent versions, Anthropic's best practices page says interactive sessions start in auto mode. If you'd rather approve things yourself while learning, switch to Manual with Shift+Tab.

Plan mode is the one to build a habit around. Claude reads the code, asks questions, writes a plan, and doesn't touch your source until you approve. You can press Ctrl+G to edit the plan in your editor first. Start a session straight in it with:

claude --permission-mode plan

Or put /plan in front of a single prompt. If you could describe the change in one sentence, skip planning and just ask.

Which slash commands should a beginner learn?

Type / in a session to see everything. These are the ones I'd learn first:

Command What it does
/init Generates a starter CLAUDE.md for the project
/clear Starts a fresh conversation with empty context
/compact Summarizes the conversation so far to free up context
/context Shows what's using your context window
/rewind Restores earlier conversation or code state (also Esc twice)
/model Switches the model
/permissions Manages allow and deny rules for tools
/usage Shows session cost and plan usage limits
/resume Picks up an older conversation

From the shell, claude -c continues your last conversation in that folder and claude -p "question" runs one query and exits, which is handy in scripts.

Good habits that save the most time

Give it a way to check its own work. "Write the function, then run the tests and fix failures" gets a far better result than "write the function". Tests, a build, a linter, a screenshot to compare: anything that returns pass or fail.

Clear context between unrelated tasks. Claude's context window fills up as it reads files and runs commands, and answers get worse as it fills. If you've corrected it twice on the same thing, run /clear and write a better first prompt.

Be specific. "Fix the bug" is weak. "Login shows a blank screen after a wrong password, check src/auth, write a failing test first" is strong.

Stop it early. Press Esc the moment it heads the wrong way. Context is kept, so you can redirect.

Don't treat checkpoints as git. Rewind restores edits made through Claude's file tools, not changes made by shell commands. Commit often.

Turn repeated instructions into skills. Once you've typed the same multi-step request a few times, put it in a SKILL.md. My Claude skills guide walks through writing one.

Where to go next

Once the basics feel normal, look at MCP servers for connecting outside tools, subagents for research that would clutter your main session, and hooks for things that must happen every time. I wrote up what a week of building with Claude looks like in practice, and if you're weighing editors, there's a fair Claude Code vs Cursor comparison too.

Your first real task: open a project you know well, run /init, cut the generated CLAUDE.md down to the ten lines that matter, and ask Claude to explain one part of the code you've never fully understood.

Questions people ask

Is Claude Code free?

No. The official quickstart says you need a Claude subscription (Pro, Max, Team or Enterprise), a Claude Console account with API credits, or access through a supported cloud provider. The free Claude plan doesn't include it.

Do I need to know how to code to use Claude Code?

It helps a lot. Claude Code writes and runs code for you, but you still have to judge whether each change is right and decide what to ask next. Beginners can learn with it, as long as they read the diffs instead of approving everything.

What is CLAUDE.md in Claude Code?

CLAUDE.md is a markdown file Claude Code reads at the start of every session. You put build commands, code style rules and project quirks in it so you don't repeat them. Run /init to generate a first version.

What does plan mode do in Claude Code?

In plan mode Claude reads files and explores your project but doesn't edit source code. It writes a plan, and edits stay blocked until you approve it. Press Shift+Tab to switch into it or start with claude --permission-mode plan.

Can I use Claude Code in VS Code?

Yes. Besides the terminal, Claude Code runs in VS Code, JetBrains IDEs, a desktop app, on the web and in Slack. The terminal version is what most guides, including this one, start with.

Keep reading