Claude Code Tutorial for Beginners (2026 September): Install, First Session, CLAUDE.md

Step-by-step Claude Code tutorial: npm install, first login, permission modes, plan mode, CLAUDE.md, first real task, /compact, skills and error fixes.

Claude Code Tutorial for Beginners (2026 September): Install, First Session, CLAUDE.md

If you have used a chat assistant to write code, Claude Code feels different from the first minute. You do not paste files into a chat box. You open a terminal inside your project, type what you want, and the agent reads your files, runs commands, edits code and reports back. It asks for permission before it touches anything that matters. This guide has 9 sections, 3 copy-paste blocks of prompts or commands, a 6-question Q&A, and takes about 22 minutes to read.

This Claude Code tutorial is written for beginners. You need a terminal, a project folder and about thirty minutes. If you want the big picture first, read what Claude Code is and who it is for, then come back for the hands-on part. Everything below reflects Claude Code in late 2026; when something looks different on your screen, run /help inside the tool and trust that over any article.

One warning before you start. Claude Code is fast, and speed is seductive. The beginners who get the most out of it are the ones who slow down for the first few sessions, read every plan and every diff, and build an accurate sense of what the agent is good at and where it needs a hint. That habit takes an hour to form and saves days later.

What Claude Code Actually Is

Claude Code is Anthropic's terminal agent. You run it with the command claude inside a project directory. It has tools: read a file, edit a file, run a shell command, search the codebase. When you give it a task, it plans, uses those tools, looks at the result and keeps going until the task is done or it needs your input. That plan, act, observe, repeat loop is what makes it an agent rather than a chat window.

Three things make it beginner friendly. It works in any project you already have, in any language. It asks before doing anything risky. And it reads a plain text file called CLAUDE.md at the start of every session, so you write your project's rules once. It also runs through VS Code and JetBrains extensions and a web version, but the terminal is where the concepts are easiest to see. If you have tried the closest alternatives, our Gemini CLI tutorial and Codex CLI tutorial show how much transfers.

What it is not: it is not an IDE, it does not replace git, and it is not magic. It is a very capable assistant that follows instructions literally. Vague instructions produce vague results. Clear instructions, a good CLAUDE.md and a test suite it can run turn it into something closer to a reliable junior developer who never gets tired of reading your codebase.

Claude Code Tutorial for Beginners - Artificial Intelligence certification study resource

This Tutorial at a Glance

๐Ÿ“ฆ2 optionsInstall methodsnpm global install or native installer
๐Ÿ›ก๏ธ4 modesPermission modesdefault, accept edits, plan, bypass
๐Ÿ› ๏ธ7 stepsFirst task walkthroughFrom prompt to committed change
๐Ÿงน2 commandsContext commands/compact and /clear
โšก3 layersWays to extendSlash commands, skills, MCP servers

Install Claude Code with npm

You need Node.js 18 or newer. Check with node -v. If it is missing or old, install the current LTS release from nodejs.org or use nvm. Then install Claude Code globally:

npm install -g @anthropic-ai/claude-code

Do not run this with sudo. If npm complains about permissions, fix your npm prefix instead (see the errors section). Confirm with claude --version. There is also a native installer on the official docs that does not depend on npm; either method gives you the same tool, and Claude Code tells you when a newer version exists.

Before you continue, pick a small real project where a mistake costs nothing. If you have none, create a folder, run git init and add a short script. Git is your undo button while you learn.

On Windows, recent releases run natively through PowerShell and the native installer, and many people have no trouble at all. If you hit odd path or shell errors, WSL (Windows Subsystem for Linux) with Windows Terminal is the most predictable environment, and it is what most Windows developers use for Node projects anyway. On macOS, the built-in Terminal and iTerm2 both work well.

First Run and Login

Change into your project folder and run:

cd my-project
claude

On first launch, Claude Code opens a browser window to sign in with your Claude account. A Claude Pro or Max subscription covers Claude Code usage; pay-per-use through a Claude Console account also works. Check the current pricing page for what each option includes.

Back in the terminal you get a prompt. Test it with something read-only:

What files are in this project and what does each one do?

It lists files, reads the important ones and summarises them. It changed nothing and needed no permission, because reading is safe. Ask a few questions like this first.

Keyboard basics: Escape interrupts, /help lists every command, /exit ends the session. To return to the same conversation later, run claude --continue, or claude --resume to pick from recent sessions. To switch accounts, /logout then /login.

Two more habits are worth forming in your first session. First, keep prompts about one thing. "Explain the auth flow" gets a better answer than "explain the auth flow and also fix the login bug and update the README." Second, answer its questions. When Claude Code asks which of two approaches you prefer, it is not stalling; it has found a genuine fork and your answer saves it from guessing wrong.

Permission Modes and Plan Mode

Claude Code reads files freely but asks before every edit and every shell command that could change something. You see the exact diff or command, then choose yes, yes for the rest of the session, or no. Start here. Saying no is free, and watching what it wants to do teaches you how it thinks. Pre-approve safe commands with /permissions, adding patterns such as Bash(npm test); the same lists live in .claude/settings.json.

CLAUDE.md: Teaching It Your Project

CLAUDE.md is a Markdown file at the root of your project. Claude Code reads it at the start of every session and treats it as standing instructions. It turns "explain the project again" into a one-time job.

Do not write it from scratch. Inside a session, type /init. Claude Code scans the project and drafts a CLAUDE.md describing the stack, folder layout and how to run tests. Correct anything wrong, then add the rules only you know. A good beginner file is short and specific:

# My Project ## Commands - Run tests: npm test - Start dev server: npm run dev ## Rules - Use TypeScript, never plain JS files - Do not edit files in /generated - Run the tests before telling me a task is done - Ask before adding a new dependency

Keep it under about a hundred lines.

Every line costs context on every session, so it should hold rules and facts, not documentation. When you catch yourself repeating an instruction in prompts, it belongs here. Start a prompt with #, for example # always use pnpm, not npm, and Claude Code offers to save it for you.

There are three levels: the project root file (shared through git), ~/.claude/CLAUDE.md in your home folder (applies to every project, right for personal style), and CLAUDE.local.md for private notes you do not commit. Type /memory to see which files are loaded.

Notebooklm Tutorial - Artificial Intelligence certification study resource

CLAUDE.md Lines That Pay Off on Day One

๐ŸงชThe test command

Write the exact command, for example npm test or pytest -q. Claude Code will run it after changes without being asked each time.

๐Ÿš€The start command

How to run the app locally, so it can reproduce a bug or check that a page still renders after an edit.

๐ŸšซFolders it must not touch

Generated code, vendored libraries, migrations that already ran. One line here prevents a whole class of accidents.

๐ŸงฐPackage manager and versions

pnpm not npm, Python 3.12, Node 22. Without this it guesses from lockfiles, and sometimes guesses wrong.

๐Ÿ™‹Ask before destructive actions

"Ask before deleting files or adding dependencies." Cheap to write, and it turns surprises into questions.

Your First Real Task, Step by Step

The example is adding input validation to an existing function, but the steps are the same for any small change.

  1. Commit your current state. Run git commit -am "before claude" so you have a clean point to return to.
  2. Start in plan mode. Launch with claude --permission-mode plan, or press Shift+Tab until the status line says plan.
  3. Describe the outcome, not the code. For example: The createUser function in src/users.ts accepts any string as an email. Add validation that rejects invalid emails with a clear error, and add a test for the invalid case. Follow the existing test style. A file path, the behaviour you want and a constraint: that is a good prompt.
  4. Read the plan. It lists the files it intends to change and how. If it wants to add a validation library and you would rather use a regular expression, say so now. Corrections here are cheap.
  5. Approve and watch. In default mode you confirm each diff. Read the first two or three carefully; after that you will know whether it understood the task.
  6. Let it run the tests. It will usually run npm test on its own, because CLAUDE.md told it to. If it loops more than twice on the same failure, press Escape and give it a hint.
  7. Review with git, then commit. Run git diff yourself. If you like it, ask Claude Code to commit this with a clear message. If not, git checkout . wipes the change and you try again with a better prompt.

That loop, plan, approve, watch, test, review with git, is the whole skill. The AI Mastery course spends several lessons on exactly this loop, with recorded sessions where you watch the prompts and the plans side by side.

Prompts That Work Better Than "Fix This"

๐Ÿ“Name the file

"In src/api/orders.ts" saves a search and removes guesswork about which of three similar files you meant.

๐ŸŽฏState the outcome

Describe what should be true when it is done, such as "the endpoint returns 404 for missing ids".

๐ŸงชAsk for a test

"Add a test that would have caught this" gives the agent a way to check its own work before reporting back.

๐ŸšซSet the limits

"Do not change the public API" or "no new dependencies" prevents the most common over-eager changes.

/compact and /clear

Every message, file read and command output goes into the model's context window. Long sessions fill it, and Claude Code gets slower and forgets early instructions. Two commands manage this.

/compact summarises the conversation so far and replaces the full history with that summary. You keep the decisions and lose the noise. You can steer it: /compact focus on the database changes and the open test failure. Claude Code auto-compacts near the limit, but doing it yourself after finishing a task gives a cleaner result.

/clear throws the conversation away and starts fresh in the same project. CLAUDE.md is reloaded, so your rules survive. Use it whenever you switch to an unrelated task.

A simple rule: one task per session, /clear between tasks, /compact when a single task runs long. /cost shows what the session used and /context shows what is taking up space.

You will know it is time to compact when answers start ignoring something you said twenty minutes ago, or when the tool warns you directly. Do not wait for the warning if you have just finished a chunk of work. Compacting at a clean boundary means the summary describes a finished state rather than a half-done edit, and the next task starts from solid ground.

Context Hygiene Habits

  • โœ“Run /clear before starting an unrelated task
  • โœ“Run /compact after finishing a task that took many steps
  • โœ“Steer the summary: /compact focus on <what matters next>
  • โœ“Ask it to grep for lines instead of pasting whole logs
  • โœ“Check /context when responses start ignoring earlier instructions
  • โœ“Use /cost once a day to see how sessions add up
What is Claude Code - Artificial Intelligence certification study resource

Slash Commands and Skills

Slash commands start with /. The built-ins you will use most: /help (every command), /init (draft a CLAUDE.md), /model (switch models for the session), /permissions, /review (code review of current changes), /doctor (check the install) and /mcp, which shows connected MCP servers, the way Claude Code talks to external tools like databases and browsers. Our guide to the Model Context Protocol explains that layer.

You can write your own. Create a Markdown file in .claude/commands/, for example fix-issue.md containing a prompt template, and it becomes /fix-issue. Use $ARGUMENTS inside the file to accept text after the command name. A custom command is a saved prompt.

Skills go further. A skill is a folder under .claude/skills/ with a SKILL.md: a short frontmatter block (name and one-line description) followed by procedural instructions, plus optional helper scripts. Claude Code reads only the descriptions and loads the full instructions when a task matches, so many skills cost nothing on unrelated prompts.

A practical example is a deploy skill. Its SKILL.md first runs a few read-only shell commands to gather state (service status, uncommitted changes, recent commits), then lists the rules: never rebuild during peak traffic, use the project's own restart script, verify the site returns 200 afterwards, report the result.

Everything the team learned about deploying lives in one file, and /deploy runs the checklist. The Claude Code skills guide walks through writing your first one. A slash command is a prompt; a skill is a procedure with guardrails. Start with commands, and graduate one into a skill when it grows pre-checks and rules.

Beyond both sit MCP servers and hooks. MCP servers connect Claude Code to outside systems such as a database, a browser or a ticket tracker, so the agent can query and act on them directly. Hooks run your own shell commands automatically at set moments, for example a formatter after every edit or a notification when a task finishes. You do not need either in your first week, but it helps to know they exist so that you recognise the names when they appear in /help.

Claude Code for a Beginner: Strengths and Trade-offs

โœ…Pros
  • +Works in any existing project with no setup beyond install and login
  • +Asks permission before edits and commands, so mistakes stay small
  • +CLAUDE.md lets you state rules once instead of every session
  • +Plan mode shows the approach before any file changes
โŒCons
  • โˆ’Terminal workflows feel unfamiliar if you have never used a shell
  • โˆ’Long sessions degrade without /compact and /clear discipline
  • โˆ’Usage is metered, so careless prompting costs tokens
  • โˆ’Vague prompts produce vague changes; you still need to know what you want

Common Errors and Fixes

"claude: command not found" after installing. npm put the binary somewhere not on your PATH. Run npm config get prefix and add <that path>/bin to your PATH, then restart the terminal. With nvm, switching Node versions changes the prefix, so reinstall after switching.

EACCES permission denied during npm install -g. Your global npm folder is owned by root. Do not use sudo. Install Node through nvm, or set a user-owned prefix with npm config set prefix ~/.npm-global and add its bin folder to your PATH.

Unsupported Node version. Claude Code needs Node 18 or newer. node -v shows what you have; upgrade with nvm install --lts or reinstall from nodejs.org, then reinstall Claude Code.

Login opens the browser but the terminal never confirms. Copy the URL the terminal printed and open it manually, especially on remote machines or WSL. If it still fails, /logout then /login.

"Prompt is too long" or the session turns sluggish. Context is full. Run /compact, or /clear if the task is finished. Avoid pasting huge logs; ask it to grep for the relevant lines.

It keeps asking permission for the same command. Choose the "don't ask again this session" option, or add the pattern via /permissions.

It edited the wrong file or went too far. Press Escape, run git diff, and git checkout <file> to revert. Then add a rule to CLAUDE.md so it does not happen again.

Usage limit reached. Subscription plans have rolling limits that reset over time, and the message tells you when. Pay-per-use accounts need billing set up in the Console. Either way, /cost shows what the current session used so you can plan the rest of your day.

Broken colours, odd keys. Run /doctor. It checks the install, terminal capabilities and configuration, and points at the fix. For anything else, the official documentation at docs.claude.com has a troubleshooting page.

Your First Week With Claude Code

  • โœ“Install Node 18+ and run npm install -g @anthropic-ai/claude-code
  • โœ“Run claude in a small git project and complete the browser login
  • โœ“Run /init, then trim the CLAUDE.md to rules and commands only
  • โœ“Do one small task in plan mode and read the plan before approving
  • โœ“Pre-approve your test command in /permissions
  • โœ“Practice /compact at the end of a task and /clear before a new one

Claude Code Questions and Answers

Go deeper: the full AI Mastery course

This tutorial covers your first session. The AI Mastery course covers the rest: 60 lessons across 12 modules, from beginner to advanced, on Gemini, Claude Code, Codex, building AI agents, Seedance video generation and building websites with AI tools. Each module ends with a quiz, you get lifetime access, and you can preview 2 lessons free before deciding. Start with the AI Mastery course preview lessons and continue where this tutorial stops.

About the Author

Dr. Lisa Patel
Dr. Lisa PatelEdD, MA Education, Certified Test Prep Specialist

Educational Psychologist & Academic Test Preparation Expert

Columbia University Teachers College

Dr. Lisa Patel holds a Doctorate in Education from Columbia University Teachers College and has spent 17 years researching standardized test design and academic assessment. She has developed preparation programs for SAT, ACT, GRE, LSAT, UCAT, and numerous professional licensing exams, helping students of all backgrounds achieve their target scores.