46 46. Your First Claude Code Session
This page walks you through a complete first session: starting Claude Code in a project, asking about the code, making a change, reviewing it, committing it with Git, and coming back later. Along the way you learn the handful of keys you will use every day.
46.1 Before you start
As of Oct 6, 2026 · Official docs: Quickstart
You need Claude Code installed and logged in (Installing Claude Code) and a small project to work on. We use git-tutorial-project from Your First Repository: a tiny website with README.md, css/style.css, and src/index.html. It should be a Git repository with at least one commit, so Git can undo anything that goes wrong (What Is Version Control?).
Download the Git practice project (zip) (unzip it into your ~/projects folder, as described in Your First Repository).
46.2 Start a session
As of Oct 6, 2026 · Official docs: Quickstart · Choose a permission mode
Claude Code works on the folder you start it in, called its working directory. So first cd into the project, then start claude:
cd ~/projects/git-tutorial-project
claude --permission-mode manualWhy --permission-mode manual? Recent versions of Claude Code start in auto mode, where a separate safety model reviews actions instead of you, so Claude edits most files and runs most commands without asking. For your first session, Manual mode is better: Claude asks before every edit and every command that could change something, so you see each step. (You can also start with plain claude and press Shift+Tab once to switch from auto to Manual.) Modes are explained in Permissions, Modes, and Safety.
What you see:
- The trust question (first time in a folder only). Claude Code asks whether you trust this folder, because a project can contain settings that change what Claude Code does. Say yes for your own projects; look around first in a project you downloaded from a stranger. Don’t start Claude Code in your home directory: trust is never saved there, so you get asked every time.
- A header showing the Claude Code version, the model (with its effort level), and the working directory.
- The prompt box, where you type. Before you type, it may show a grayed-out example prompt.
- A status bar under the prompt box that shows the permission mode, for example
⏸ manual mode onor⏵⏵ auto mode on.
Type ? on an empty prompt to see the keyboard shortcuts. Want a guided tour? The /powerup command offers short interactive lessons.
46.3 Ask about the project
As of Oct 6, 2026 · Official docs: Common workflows
Start by asking questions in plain English. Claude reads the files it needs; you don’t have to paste anything:
what does this project do?
explain the folder structure, then tell me how the HTML page loads the CSS file
To point Claude at a specific file, type @ and start typing its name; a menu suggests matching paths (Tab or Enter accepts one). The file’s content is added to the conversation:
explain @src/index.html line by line for a beginner
Reading files inside the project doesn’t need your permission, even in Manual mode, so these answers come right away.
46.4 Make a first change
As of Oct 6, 2026 · Official docs: Configure permissions · Checkpointing
Now ask for a small, specific change:
in @src/index.html, replace "Under construction!" with one sentence introducing me: Maria, a business student learning web development
Claude shows the edit it wants to make as a diff (lines starting with - are removed, lines starting with + are added; see Viewing History and Undoing Changes) and, because you are in Manual mode, asks for permission. The prompt offers to approve this edit once, to allow edits for the rest of the session, or to say no. Choose Yes. If you choose No (or press Esc), you can tell Claude what to do differently.
Then review what changed:
- Type
/diffto see the changes in your working tree, file by file. - Or run Git yourself in shell mode: a message that starts with
!runs as a command in your shell, and its output is added to the conversation:
! git diff
Don’t like the result? Tell Claude what to change (“make it shorter and more formal”). Or press Esc twice on an empty prompt to open the rewind menu and restore the code to how it was before a message you sent (a checkpoint). Rewind has limits, covered on the safety page; Git is your real safety net.
46.5 Commit with Git
As of Oct 6, 2026 · Official docs: Quickstart · Common workflows
Claude Code can run Git for you. Ask it in plain English:
what files have I changed?
commit my changes with a short, descriptive message
Claude runs commands such as git status, git diff, git add, and git commit. Read-only commands like git status run without asking; in Manual mode it asks before git add and git commit. Read each command before you approve it. By default, Claude Code adds a Co-Authored-By line naming Claude to its commit messages. Check the result yourself:
! git log --oneline -3
46.6 Essential keys
As of Oct 6, 2026 · Official docs: Interactive mode
| Key | What it does |
|---|---|
Enter |
Send your message |
Shift+Enter |
New line without sending (works in most terminals, including Apple’s Terminal and Windows Terminal) |
\ then Enter, or Ctrl+J |
New line without sending, in any terminal |
Esc |
Stop Claude mid-response; it keeps the work done so far. On a permission prompt, Esc means “No” |
Esc Esc |
On an empty prompt: open the rewind menu. With text typed: clear it |
Shift+Tab |
Cycle through permission modes |
Ctrl+C |
Interrupt. If nothing is running, clears your input; a second press exits |
Ctrl+D twice |
Exit Claude Code |
Up arrow |
Recall earlier prompts |
@ |
Mention a file or folder, with path suggestions |
! at the start |
Shell mode: run a command yourself, for example ! git status |
/ at the start |
Open the menu of commands and skills (Essential Slash Commands) |
? on an empty prompt |
Show the keyboard shortcuts |
Ctrl+O |
Toggle the detailed transcript, which shows every tool call |
Ctrl+V (Mac) or Alt+V (Windows) |
Paste an image from the clipboard (in iTerm2 on a Mac: Cmd+V) |
You can also type while Claude is working: your message is queued, and Claude reads it as soon as its current step finishes. That is a gentle way to steer; Esc is the emergency brake.
Screenshots of error messages or web pages are often the fastest way to explain a problem. Copy a screenshot to the clipboard (Mac: Cmd+Ctrl+Shift+4, then drag; Windows: Win+Shift+S) and paste it into the Claude Code prompt with Ctrl+V on a Mac or Alt+V on Windows. It appears as [Image #1] in your message. You can also drag an image file into the terminal window, or just give Claude the image’s path (“look at ~/Desktop/error.png”).
46.7 Ending and coming back
As of Oct 6, 2026 · Official docs: Manage sessions
A conversation with Claude Code is a session. Claude Code saves every session automatically (as a file under ~/.claude/projects/), tied to the folder you started in.
| To… | Do this |
|---|---|
| Leave Claude Code | Type /exit (or press Ctrl+D twice) |
| Reopen the most recent session in this folder | claude --continue (short: claude -c) |
| Pick an older session from a list | claude --resume (short: claude -r) |
| Switch sessions without leaving Claude Code | /resume |
| Start a fresh conversation | /clear (the old one can still be resumed) |
| Give a session a name you can resume by | claude -n portfolio-intro, or /rename portfolio-intro inside |
Then claude --resume portfolio-intro brings that session back. A brand-new session starts with a fresh, empty conversation: Claude does not see your earlier conversations unless you resume one. Instructions you want in every session belong in a CLAUDE.md file (CLAUDE.md and Memory).
46.8 A sample first session
As of Oct 6, 2026 · Official docs: Quickstart
Here is a simplified version of the whole session. Lines starting with $ are typed in the shell, lines starting with > are typed in Claude Code, and square brackets describe what happens on screen (the exact wording varies by version).
$ cd ~/projects/git-tutorial-project
$ claude --permission-mode manual
> what does this project do?
[Claude lists the folder and reads a few files, then answers:]
This is a small personal portfolio website. src/index.html is the
page, css/style.css styles it, and README.md describes the project.
> in @src/index.html, replace "Under construction!" with one sentence
introducing me: Maria, a business student learning web development
[Claude shows the edit as a diff and asks permission. You choose Yes.]
- <p>Under construction!</p>
+ <p>Hi, I'm Maria, a business student learning web development.</p>
> /diff
[A list of changed files opens. You check index.html, then press Esc.]
> commit my changes with a short, descriptive message
[Claude runs git status and git diff, then asks permission to run
git add and git commit. You read the commands and choose Yes.]
Committed: "Replace placeholder text with a personal introduction"
> /exit
Practice Questions
Easy
Question 1 · Short answer
Why do you cd into a project folder before typing claude?
Question 2 · Matching
Match each key with what it does in Claude Code.
| Key | What it does | |
|---|---|---|
1. Esc |
A. Run a shell command yourself | |
2. Esc Esc (empty prompt) |
B. Cycle permission modes | |
3. Shift+Tab |
C. Mention a file | |
4. @ |
D. Stop Claude mid-response | |
5. ! at the start |
E. Open the commands menu | |
6. / at the start |
F. Open the rewind menu |
Question 3 · True or false
claude --continue shows you a list of all your old sessions to choose from.
Question 4 · Short answer
Give two ways to leave Claude Code.
Question 5 · Multiple choice
The first time you start Claude Code in a folder, it asks whether you trust the folder. Why?
- To check that you have a paid plan
- Because a project can contain settings that change what Claude Code does, so you should only trust folders whose contents you know
- To decide which model to use
- Because Claude Code can only read trusted files
Medium
Question 6 · Write the command
Write the two commands Maria types to start Claude Code in ~/projects/git-tutorial-project so that Claude asks before every edit and command.
Question 7 · Scenario
Halfway through a task you see Claude editing the wrong file. What do you press right away, and what do you do next?
Question 8 · Write the prompt
Write a prompt that asks Claude to explain the CSS file to a beginner, making sure Claude looks at exactly that file.
Question 9 · Predict the output
Inside Claude Code you type ! git status. What happens, and does Claude need your permission to run it?
Question 10 · Scenario
Sam wants to write a three-line prompt, but every time he presses Shift+Enter in his terminal, the message is sent. What can he do?
Question 11 · Write the command
Yesterday Maria named a session portfolio-intro. Write (a) the shell command that reopens it, and (b) what she types if she is already inside another Claude Code session.
Question 12 · True or false
After you type /clear, the previous conversation is deleted for good.
Question 13 · Short answer
Name two ways to show Claude Code a screenshot of an error message.
Hard
Question 14 · Explain why
Recent versions of Claude Code start in auto mode, where a safety model approves most actions. Why does this page suggest starting your first session in Manual mode anyway?
Question 15 · Scenario
Claude edited src/index.html with its edit tool, then ran mv css/style.css css/main.css in the shell. You open the rewind menu and restore the code to before that message. What gets restored, and what doesn’t? How can you undo the rest?
Question 16 · Scenario
In Manual mode, Claude runs git status and git diff without asking, but asks before git commit. Explain the difference.
Question 17 · Long answer
Describe, step by step, a complete first session that makes one small change to a project and commits it. At which steps are you, the human, responsible for checking Claude’s work?
Question 18 · Compare
Compare claude --continue with starting a fresh claude session. What does Claude know in each case?
Challenge
Question 19 · Hands-on
Do the whole sample session yourself on git-tutorial-project in Manual mode: ask what the project does, change the paragraph in src/index.html, check the change with /diff, have Claude commit it, and verify with ! git log --oneline -3. Then exit, run claude --continue, and ask Claude “what did we change last time?”. Write down every permission prompt you saw and which option you chose.