Your course progress0 of 14 chapters

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:

CommandWhat it doesExample
mkdirCreates a new foldermkdir my-project
cdGoes into a foldercd my-project
cd ..Goes up one foldercd ..

Open a terminal and create a practice folder. The commands are the same on every operating system:

Windows PowerShell
cd ~\Desktop
mkdir my-project
cd my-project

The 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:

Any operating system
claude

The 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 actionExampleRisk
ReadingOpening a file, searching the projectLow: nothing changes
Editing filesCreating a file, changing a lineMedium: can be undone
Running commandsInstalling software, running a script, deletingHighest: 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:

  1. Yes: approve this action.
  2. Yes, and don't ask again: approve, and don't ask again about similar actions. The exact wording depends on the kind of action.
  3. 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:

ModeStatus line showsWhat happens
Manualmanual mode onClaude reads freely, and asks before every edit and every command
Accept editsaccept edits onEdits files without asking, but asks before most commands
Planplan mode onOnly reads and plans, and changes nothing until you approve the plan
Autoauto mode onWorks 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.
  • Esc twice, or the /rewind command: 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.

Inside Claude Code
/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.

Inside Claude Code
/clear

When 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.

Inside Claude Code
/compact

You can also tell Claude what to focus on in the summary:

Inside Claude Code
/compact keep the list of design changes we made and what's left to do
/clear/compact
What happens to the conversationErased, start from scratchSummarized, continue from the same point
When to use itA new, unrelated taskSame task, but the conversation is very long

/exit: leave

Closes Claude Code and returns you to the regular terminal.

Inside Claude Code
/exit

You can also press Ctrl + D twice in a row.

More useful commands

CommandWhat it does
/contextShows how much of the context window is in use
/resumeGo back to an earlier conversation from a list
/rewindGo back to an earlier point in the conversation and files
/usageShows usage and cost, and your plan limits
/statusShows version, model and the signed-in account
/modelSwitch Claude's model

Keyboard shortcuts

ShortcutWhat it does
EscStops Claude mid-action
Esc twiceOpens the rewind menu
Shift + TabSwitches permission mode
↑ (up arrow)Brings back messages you wrote earlier
@Mention a specific file, e.g. @index.html
! at the start of a lineRun a terminal command directly, without going through Claude
Ctrl + CStops 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:

In the terminal
# 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 -r

Exercise: your first project

Time to work on your own. In the my-project folder:

  1. Switch to manual mode with Shift + Tab.
  2. Ask Claude to add a photo gallery to the birthday page (sample photos from the internet are fine).
  3. Read every approval prompt before you approve. Notice which files it touches.
  4. Ask for some design change, and at the approval prompt choose No and tell it to do something else.
  5. Try Esc twice and go back to the previous version of the page.
  6. Run /context, then /compact, and see how much space was freed.
  7. Leave with /exit, and return to the conversation with claude -c.

Summary

  • Always go into the project folder (cd) before starting claude.
  • 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 + Tab switches permission modes, and beginners should start in manual.
  • /help for help, /clear for a new conversation, /compact to free space, /exit to 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.