Claude Code for Beginners

Claude Code is Anthropic’s coding assistant that works inside your project: it reads files, proposes edits and runs commands after you approve them. To start, install it with one command, run claude in a project folder, and log in with a Claude Pro, Max, Team, Enterprise or Console account. In this tutorial you’ll build a small bill-splitting program, review every change Claude makes, and run tests to prove it works.

On this page
  1. Prerequisites and Setup
  2. Understand the Workspace and Permissions
  3. Build Your First Small Project
  4. Review Changes and Run Checks
  5. Exercises and Troubleshooting
  6. Sources

Course overview

  • About 60–90 minutes, one small Python project
  • You need: a computer (macOS 13+, Windows 10 1809+, or a recent Linux), Git, Python 3, and a paid Claude plan or Console account
  • You’ll learn the safe workflow: plan, approve, review the diff, test, commit

Prerequisites and Setup

Chat or Claude Code?

If you only need an explanation or a short snippet, the regular Claude chat is enough (see how to use Claude). Use Claude Code when you want the AI to work across real files in a project, run tests, and use Git. The free claude.ai plan does not include Claude Code.

Install Claude Code

Run the official installer for your system. These commands are copied from the Claude Code setup documentation (checked November 18, 2026). Always copy install commands from the official page.

macOS, Linux or WSL:

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

Windows PowerShell:

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

Homebrew (macOS) or WinGet (Windows):

brew install --cask claude-code
winget install Anthropic.ClaudeCode

Open a new terminal window and check that it worked:

claude --version

You should see a version number followed by “(Claude Code)”. If you get “command not found,” the install folder isn’t on your PATH yet; the documentation’s troubleshooting page explains how to fix it. Run claude doctor for a fuller diagnostic. Prefer not to use the terminal? Claude Code is also available in a desktop app and in VS Code and JetBrains IDEs.

Create a practice project

mkdir bill-splitter
cd bill-splitter
git init
echo "# Bill splitter" > README.md
git add README.md
git commit -m "Start project"

Starting from a Git commit means you can always see exactly what Claude changed and undo it.

Understand the Workspace and Permissions

Start Claude Code inside the project folder:

claude

On first use it opens your browser to log in. After that, you see a prompt with the current folder shown above it. Claude Code can read files in this folder as needed; you don’t have to paste code into the chat.

How approvals work

  • Permission prompts: before editing a file or running a command, Claude Code asks for approval unless your current permission mode allows it. Read each request before you select Yes.
  • Permission modes: press Shift+Tab to cycle modes. A planning mode lets Claude research and propose a plan without editing anything, which is ideal for beginners.
  • Useful commands: /help lists commands, /clear starts a fresh conversation, /exit quits.

Safety rules for this course: work only in the practice folder, don’t approve commands you don’t understand (ask Claude “what does this command do?” first), and never paste passwords or API keys into the chat or into files that get committed.

Build Your First Small Project

Goal: a command-line program that splits a restaurant bill with tip between several people, plus automated tests.

Step 1: Ask for a plan first

Prompt 1: plan, don’t code yet
I want a small Python program in this folder:
- a function split_bill(total, tip_percent, people) that returns what each person pays, rounded to cents
- it should reject 0 people and negative numbers with a clear error
- a simple command-line prompt that asks for total, tip % and people
- unit tests using Python's built-in unittest (no extra packages)
First, describe your plan and the files you'll create. Don't write any code yet.

What to look for

A plan with two files (for example, tip.py and test_tip.py) and the test cases it intends to write. If the plan adds things you didn’t ask for, such as a web interface, say no now.

Step 2: Approve the build

Prompt 2: build it
The plan looks good. Create the files. Include tests for:
an even split (100, 20%, 4 people = 30.00), a rounding case (85.50, 18%, 3 people = 33.63),
and zero people raising an error. Then run the tests and show me the result.

Claude Code will ask to create each file and to run the test command. Approve them one by one. A version of the finished code we tested looks like this:

def split_bill(total, tip_percent, people):
    """Return the amount each person pays, rounded to cents."""
    if people < 1:
        raise ValueError("people must be at least 1")
    if total < 0 or tip_percent < 0:
        raise ValueError("total and tip_percent must not be negative")
    with_tip = total * (1 + tip_percent / 100)
    return round(with_tip / people, 2)

Claude’s version may differ in details. That’s fine, as long as the tests pass and you understand it.

Review Changes and Run Checks

Accepting code is not the same as checking it. Do these four checks every time, even when the tests pass.

  1. See what changed. Ask “what files have I changed?” or run git status and git diff in a second terminal. Make sure nothing unexpected was created or deleted.
  2. Run the tests yourself.
    python3 -m unittest -v
    You should see three tests and “OK”. On Windows, use python instead of python3 if needed.
  3. Run the program by hand.
    python3 tip.py
    Enter 85.50, 18 and 3. Expected output: “Each person pays $33.63”.
  4. Ask Claude to explain. “Explain split_bill line by line, and tell me one input that could still cause a problem.” If you can’t explain the code to someone else, don’t commit it yet.

When everything checks out, commit:

git add .
git commit -m "Add bill splitter with tests"

You can also ask Claude Code to “commit my changes with a descriptive message” and approve the command.

If something goes wrong

Because you committed before starting, you can discard unwanted changes with git restore . (this deletes uncommitted edits to tracked files, so use it carefully) and try again with a clearer prompt.

Exercises and Troubleshooting

Exercises

  1. Add a feature with a test first: “Add an optional rounding-up mode where each person’s share rounds up to the next whole dollar. Write a failing test first, then make it pass.”
  2. Handle bad input: “If the user types letters instead of numbers, show a friendly message and ask again.” Test it by typing “abc”.
  3. Write documentation: “Update README.md with how to run the program and the tests.” Read it and correct anything inaccurate.
  4. Review mode: “Review this project like a senior developer. List 3 improvements, but don’t change anything.” Decide which ones to accept.

Troubleshooting

ProblemWhat to try
claude: command not foundOpen a new terminal; if it persists, follow “Fix your PATH” in the official troubleshooting guide.
Login fails or says no accessCheck you’re using a Pro, Max, Team, Enterprise or Console account; the free plan doesn’t include Claude Code.
Tests fail after a changePaste the error and ask: “Explain why this test fails before fixing anything.”
Claude changed files you didn’t expectCheck git diff, restore those files, and add “only change tip.py” to your prompt.
Conversation gets confusedUse /clear and restate the goal in one clear message.

Next, apply the same workflow to a bigger idea. Our AI coding tutorial for beginners covers planning a project and compares Cursor and GitHub Copilot. Want a structured class? Anthropic offers free Claude Code courses; see Claude courses and training.

Sources

Commands, account requirements and system requirements checked against the official documentation on November 18, 2026. The sample code and tests in this tutorial were run with Python 3 and passed.