Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Tutorial

Your first session with Claude Code

Install it, run it in a real repository, approve its first changes, commit a reviewed edit and learn the commands you will use daily.

By Updated Beginner30 min hands-on
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
Quiz at the end
On this page

Claude Code is Anthropic’s coding agent. It reads your repository, runs commands, edits files and explains what it is doing, from your terminal (and also from VS Code, JetBrains IDEs, a desktop app and the web). This tutorial gets you from installation to a reviewed, committed change in one sitting, and introduces the handful of commands that cover most daily use.

Use a repository you know well. The point of the first session is to learn how the agent works, and that is much easier when you can tell immediately whether what it says about your code is right.

1. Install and sign in

On macOS, Linux or WSL, the recommended native installer is:

curl -fsSL https://claude.ai/install.sh | bash

On Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Homebrew (brew install --cask claude-code) and WinGet (winget install Anthropic.ClaudeCode) also work, but they do not update automatically, whereas the native install does. Open a new terminal and check:

claude --version

Then go to your project and start a session:

cd ~/code/your-project
claude

The first run asks you to log in through your browser. Claude Code stores the credentials, so you only do this once.

2. Ask before you change anything

Start with questions. They cost little, change nothing and show you how the agent explores:

what does this project do, and how is it laid out?
how do I run the tests, and do they pass right now?

Watch the tool calls. Claude Code reads files and runs commands such as ls, grep or your test runner to answer. You will see it ask permission before running most commands. That is the default permission mode, which only allows reads without asking.

Check its answers against what you know. If it says the tests use Jest and you know they use Vitest, you have learned something about how much to trust its first impressions, and you can correct it.

3. Give it a project memory with /init

Claude Code starts every session with no memory of previous ones. A CLAUDE.md file at the root of the repository is how you give it standing instructions: build and test commands, conventions, things to avoid.

/init

/init analyses the codebase and writes a starter CLAUDE.md. Open it and edit it. Delete anything generic (“write clean code”) and anything Claude could discover by reading the code. Keep the commands and the conventions a new team member would need to be told. If your repository already has an AGENTS.md for other agents, Claude Code reads it when there is no CLAUDE.md; the CLAUDE.md and AGENTS.md tutorial explains how to share one file between tools.

4. Plan a small change

Pick a small, real task with a clear finish line: a bug you understand, a missing validation, a test that should exist. Then ask for a plan before any code. Press Shift+Tab until the mode indicator shows plan mode, or prefix your message with /plan:

/plan the signup form accepts an empty display name. Make it required,
show the same error style as the email field, and add a test.

In plan mode Claude reads and explores but cannot edit your files. It comes back with a plan: which files it will change, what it will change and how it will check the result. Read it as you would read a colleague’s proposal. If it missed something, say so (“also handle whitespace-only names”) and it will revise. When the plan is right, approve it and choose whether to approve each edit manually or let it proceed.

5. Review every edit

As Claude works, it shows each proposed edit as a diff and asks before applying it (unless you chose to auto-accept edits). It will usually run the tests itself. When it says it is done:

/diff

/diff shows every change in the working tree, including Claude’s edits. Read it the way you would review a pull request:

  • Does the change do what was asked and nothing else?
  • Are the tests testing the behaviour, or only that the code runs?
  • Did it touch files you did not expect? Ask why.
  • Run the tests yourself, in your own terminal, before trusting “all tests pass”.

If something is wrong, say so in plain words. If it went in the wrong direction entirely, /rewind lets you roll the conversation and the code back to an earlier point. Pressing Esc stops Claude mid-action, which is useful when you can see it heading the wrong way.

6. Commit

When you are happy, commit. You can ask Claude to do it:

commit this with a message that explains why the change was needed

Check the message before it goes in. Commit messages written by agents tend to describe what changed (which the diff already shows) rather than why.

Commands worth learning now

Command What it does
/init Generate or improve CLAUDE.md for the project
/plan or Shift+Tab Enter plan mode; Shift+Tab cycles permission modes
/diff Review all changes in the working tree
/rewind Roll the conversation and/or code back to an earlier point
/clear Start a fresh conversation (use between unrelated tasks)
/compact Summarise the conversation so far to free up context
/context See what is using the context window
/memory Edit your CLAUDE.md files
/mcp Manage connected MCP servers
/usage Session cost and plan limits
/resume Pick up an earlier conversation

From the shell, claude -c continues the most recent conversation in the current directory and claude -p "question" runs a single prompt and prints the answer, which is handy in scripts.

Permission modes in one minute

Claude Code’s permission mode decides what it can do without asking:

  • Default (manual): reads only. Everything else asks. Use it while you are learning.
  • Accept edits: file edits and common filesystem commands go through; other commands still ask.
  • Plan: explore and plan, no edits.
  • Auto: where available, actions run with background safety checks instead of prompts. For long tasks once you trust the setup.
  • Bypass permissions: everything runs. Only in isolated containers or VMs.

You can also pre-approve specific commands (your test runner, for example) with /permissions, which removes most of the prompt fatigue without opening everything up.

Pitfalls

One long conversation for everything. Context fills up and earlier details crowd out the current task. Use /clear when you switch tasks.

Vague tasks. “Improve the auth module” invites a large, hard-to-review diff. Name the problem, the boundary and how to check it.

Trusting “tests pass”. Run them yourself. Also check that new tests would fail without the change.

Approving commands you do not understand. If Claude wants to run something unfamiliar, ask what it does first. You are still the one responsible for what runs on your machine.

Secrets in the repository. Claude can read any file you can. Keep secrets out of the working tree, and use deny rules in /permissions for files such as .env if they must exist.

Next steps

Covers

Check your understanding

Claude Code first session quiz

Installing Claude Code, running it in a repository, approving changes and the everyday commands.

6 questions · pass mark 70%

Question 1 of 60 answered
  1. You start Claude Code in a repository for the first time. Which command creates a starting CLAUDE.md?
Back to top