Chapter 3
Your First Session & Basic Commands
Claude Code is installed and signed in. Now comes the fun part: in this chapter you'll start it for the first time, ask it to build a small web page, and learn to approve its actions safely.
Step 1: Create a project folder and go into it
Claude Code works inside a folder. Everything it reads and changes is in the folder where you started it. So the first habit: always go into the project folder before starting claude.
Three terminal commands worth knowing:
| Command | What it does | Example |
|---|---|---|
mkdir | Creates a new folder | mkdir my-project |
cd | Goes into a folder | cd my-project |
cd .. | Goes up one folder | cd .. |
Open a terminal and create a practice folder. The commands are the same on every operating system:
cd ~\Desktop
mkdir my-project
cd my-projectcd %USERPROFILE%\Desktop
mkdir my-project
cd my-projectcd ~/Desktop
mkdir my-project
cd my-projectThe first line goes to your desktop, the second creates a folder called my-project there, and the third goes into it. You'll see the new folder on your desktop.
Step 2: Start Claude Code
Once you're inside the folder, type:
claudeThe first time in each folder, Claude Code asks whether you trust the files in this folder. You just created this folder, so it's fine to approve.
Now the welcome screen appears. Above the input line you'll see the version, the model (which Claude is working with you) and the folder it's working in. Check that it's the right folder.
Step 3: The first question
You write to Claude the way you'd write to a friend. Let's start with a simple question:
What's in this folder?
Since the folder is empty, it'll tell you there's nothing in it. Now let's try something more interesting, a real task:
Create a web page in index.html with a birthday greeting for grandma. Colorful and cheerful design, with a big headline and a button that launches confetti
Claude will plan what to do and then, depending on the permission mode (explained in a moment), ask for your approval to create the file. Approve it, then open index.html from the folder in your browser (double-click it). You have a web page!
Step 4: Understanding approval prompts (permissions)
This is the most important part of the chapter. Claude Code can take three kinds of actions, each with a different level of risk:
| Kind of action | Example | Risk |
|---|---|---|
| Reading | Opening a file, searching the project | Low: nothing changes |
| Editing files | Creating a file, changing a line | Medium: can be undone |
| Running commands | Installing software, running a script, deleting | Highest: a command can do almost anything |
When Claude wants to do something that needs approval, it stops and shows an approval prompt with exactly what it intends to do. There are usually three options:
- Yes: approve this action.
- Yes, and don't ask again: approve, and don't ask again about similar actions. The exact wording depends on the kind of action.
- No: decline, and optionally tell Claude what to do instead. It'll continue based on your explanation.
How do you decide whether to approve?
For a file edit, Claude shows the change: removed lines in red, added lines in green. Ask yourself:
- Is this the file I expected to change?
- Is the change related to what I asked for?
For a command, read the command itself. Most commands are completely harmless: running the site, installing a package you asked for, a check. But there are a few red flags:
Permission modes: how much freedom to give Claude
Claude Code works in one of several permission modes. The current mode appears in the status line at the bottom of the screen. To switch modes, press Shift + Tab:
| Mode | Status line shows | What happens |
|---|---|---|
| Manual | manual mode on | Claude reads freely, and asks before every edit and every command |
| Accept edits | accept edits on | Edits files without asking, but asks before most commands |
| Plan | plan mode on | Only reads and plans, and changes nothing until you approve the plan |
| Auto | auto mode on | Works without asking, while a separate safety model checks every action in the background and blocks risky ones |
Made a mistake? You can go back
Esc(once): stops Claude mid-action. Then you can tell it what to do instead.Esctwice, or the/rewindcommand: opens a menu of earlier points in the conversation. You can restore the conversation, the files, or both.
Step 5: The basic commands
Inside Claude Code, anything starting with / (slash) is a command to Claude Code itself, not a message to Claude. Type / on its own to see a list of all commands.
/help: help
Shows the available commands with a short explanation of each. Whenever you're unsure, start here.
/help/clear: start a fresh conversation
Clears the current conversation from Claude's memory and starts with a clean slate. Your files aren't deleted, only the conversation.
/clearWhen to use it: when you move on to a new task unrelated to the previous one. For example, you're done with the birthday page and want to work on something else.
/compact: free up memory
To understand this command you need one concept: the context window.
Think of a whiteboard. Everything said in the conversation, every file Claude read and every command result is written on the board. That's how Claude "remembers" what's going on. But the board has a limited size, and in a long conversation it fills up.
/compact summarizes the conversation so far: it wipes the board and writes a short summary of the important points. You continue the same task, but with lots of free space.
/compactYou can also tell Claude what to focus on in the summary:
/compact keep the list of design changes we made and what's left to do/clear | /compact | |
|---|---|---|
| What happens to the conversation | Erased, start from scratch | Summarized, continue from the same point |
| When to use it | A new, unrelated task | Same task, but the conversation is very long |
/exit: leave
Closes Claude Code and returns you to the regular terminal.
/exitYou can also press Ctrl + D twice in a row.
More useful commands
| Command | What it does |
|---|---|
/context | Shows how much of the context window is in use |
/resume | Go back to an earlier conversation from a list |
/rewind | Go back to an earlier point in the conversation and files |
/usage | Shows usage and cost, and your plan limits |
/status | Shows version, model and the signed-in account |
/model | Switch Claude's model |
Keyboard shortcuts
| Shortcut | What it does |
|---|---|
Esc | Stops Claude mid-action |
Esc twice | Opens the rewind menu |
Shift + Tab | Switches permission mode |
↑ (up arrow) | Brings back messages you wrote earlier |
@ | Mention a specific file, e.g. @index.html |
! at the start of a line | Run a terminal command directly, without going through Claude |
Ctrl + C | Stops an action, or clears the line. Twice in a row exits |
Starting from the terminal: handy shortcuts
You type these in the regular terminal, before entering Claude Code:
# Start Claude Code with a task ready to go
claude "add a button to the page that plays music"
# Continue the last conversation in this folder
claude -c
# Pick an earlier conversation from a list
claude -rExercise: your first project
Time to work on your own. In the my-project folder:
- Switch to manual mode with
Shift + Tab. - Ask Claude to add a photo gallery to the birthday page (sample photos from the internet are fine).
- Read every approval prompt before you approve. Notice which files it touches.
- Ask for some design change, and at the approval prompt choose No and tell it to do something else.
- Try
Esctwice and go back to the previous version of the page. - Run
/context, then/compact, and see how much space was freed. - Leave with
/exit, and return to the conversation withclaude -c.
Summary
- Always go into the project folder (
cd) before startingclaude. - Write to Claude in plain language, and keep improving through conversation.
- Read approval prompts before approving, especially commands that delete, upload, or touch things outside the project.
Shift + Tabswitches permission modes, and beginners should start in manual./helpfor help,/clearfor a new conversation,/compactto free space,/exitto leave.
In the next chapter we'll learn how to ask well: how to write prompts that get good results the first time.
Check yourself
1. Claude asks you to approve a command with rm -rf. What do you do?
2. What's the difference between /clear and /compact?
Answering every quiz question marks the chapter as done automatically.