Welcome aboard the final module, @name! Captain Redbeard saved the most powerful compass in the whole fleet for last: Claude Code - the official CLI tool from Anthropic that turns your terminal into an agentic coding crewmate.
Claude Code is an agentic command-line tool (CLI - Command Line Interface) built by Anthropic. It is not an ordinary chat window - Claude Code can read and edit the files in your project on its own, run commands in your terminal and carry out complex tasks across many files at once.
That is worth saying plainly, because tutorials muddle it: Claude Code is not a browser extension, not a frontend library for building interfaces, and certainly not an operating system for servers. It is a program you launch from the command line, and it works on your real codebase.
Think of the difference between a treasure map and a living navigator who actually sails the ship where it needs to go.
Both crews sail the same AI sea, but each one steers differently:
Cursor:
Claude Code:
These are not the same tool, and neither replaces the other - they complement each other, so you can sail with BOTH at once!
node --version)Claude Code ships as an npm package, so one command puts it on your PATH. Watch the package name closely - it is scoped,
@anthropic-ai/claude-code, never a bare claude or claude-code. And because it is a Node package, npm installs it - pip belongs to a different ocean entirely:1# Install with npm (recommended)
2npm install -g @anthropic-ai/claude-code
3
4# Then start Claude Code inside your project directory
5claudeThe
-g flag is what makes the install global: the claude command becomes available in every directory, not just this one. From then on, you start your first mate by typing a single word in the project you want to work on.You can also run Claude Code without installing anything globally, straight through
npx:1npx @anthropic-ai/claude-codeThis downloads and runs the latest version on demand - handy when you are testing the tool on a borrowed machine, or on a CI runner where you do not want a permanent global install.
The first time you launch it, Claude Code asks you to sign in. Type this command inside the session:
1/loginThat opens an OAuth flow in your browser - sign in with a Claude Pro/Max subscription, or with an Anthropic Console account backed by API credits. Note what
/login does not do: it does not create a GitHub account for you, it does not log you out of your operating system, and it installs no dependencies. It signs you in to Claude, nothing more.If you would rather authenticate with an API key, put the key in the ANTHROPIC_API_KEY environment variable (or in your project's .env file):
1# Linux/Mac - add to ~/.bashrc or ~/.zshrc
2export ANTHROPIC_API_KEY="sk-ant-..."The key belongs in the environment - never in
package.json, never in some committed config.json. Those files sail straight into your repository, and a leaked key is a leaked treasure chest.With the install done and the articles signed, you are ready to call your first mate for real:
1# Start an interactive session (REPL) in the terminal
2claude
3
4# Or jump straight in with an opening prompt
5claude "Explain what TypeScript is"Both lines start Claude Code in the current directory, which becomes the project it can see. The second form simply saves you a step by handing over the first question immediately.
Claude Code runs on the Claude family of models, and each one suits a different kind of voyage:
You switch models with the
/model command inside a session, or with the --model flag when you launch:1# Launch with a specific model
2claude --model sonnetThose two - the
/model command and the --model flag - are the only ways to change models. There is no /temperature command and no temperature setting to tune here: picking the model is the dial you turn.Claude Code has two main modes: interactive mode (
claude) and one-shot mode (claude "question"), where you hand it the prompt right on the command line. There is no GUI mode in Claude Code - the graphical deck belongs to Cursor.This is the default: a genuine conversation in the terminal, where Claude remembers everything said so far.
1# Start a session in the terminal
2claude
3
4# Or with an opening prompt
5claude "Help me build a login form"Inside this session Claude keeps the context of the whole conversation, so you can refine your request step by step - "now add validation", "now write the tests" - without repeating yourself.
The
-p flag (or its full name, --print) makes Claude print the answer and exit - exactly what you want in scripts and pipes. The "p" stands for printing to the terminal, not for a paper printer, and nothing gets deleted along the way:1# Ask a question, get the answer, done
2claude -p "Explain what React hooks are"
3
4# The same thing with the full flag name
5claude --print "Summarize how useEffect works"Because the process ends as soon as the answer is out, you can put these commands in a shell script, a Makefile or a CI pipeline and treat Claude like any other command-line tool.
Sessions are saved automatically - there is no
--save flag to remember and nothing to restore by hand:1# Continue the most recent conversation in this directory
2claude -c
3
4# Pick an earlier conversation to resume
5claude -rUse
-c when you closed the terminal mid-task and want to pick the thread straight back up, and -r when you want to browse the list of past sessions and choose one.Here is a truth worth tattooing on your forearm, @name: Claude Code has no separate flag for attaching files. You point at a file inside the prompt itself, with the
@ symbol, and Claude reads it on its own:1# Claude reads src/auth.ts and reviews it
2claude -p "Review @src/auth.ts"
3
4# You can point at several files at once
5claude -p "Compare @src/old-api.ts and @src/new-api.ts"Notice how the
@ sits right in the prompt text, as part of the sentence you are writing. Claude can also search and read files by itself using its own tools, so you rarely need to list them all - name the ones that matter and let it find the rest. To give it access to a directory outside the project, use the --add-dir flag:1claude --add-dir ../shared-library "Review the shared code"Now the shared library is part of the map: Claude may read and edit files there too, which is exactly what you need in a monorepo or when two projects share a package.
Because Claude Code lives in the terminal, you can chain it to any other command with a pipe (
|), letting the output of one program become Claude's input:1# Pipe a file in for review
2cat src/index.ts | claude -p "Review this code"
3
4# Pipe a Git diff in for a summary
5git diff | claude -p "Summarize these changes"This is the replacement for a fake flag that haunts old tutorials: instead of the nonexistent
claude --file X "Y", write cat X | claude -p "Y" or claude -p "Y @X". It is also how an automated code review works in practice - a small code-review.sh script pipes the staged files into claude -p and reports bugs, security issues and best-practice violations before the commit ever lands.A handful of flags cover almost everything you will do from the command line, and they are worth learning as a set:
1# Pick the model
2claude --model sonnet
3
4# Add a directory to the context
5claude --add-dir ./packages
6
7# Control how permissions are granted
8claude --permission-mode plan
9
10# Restrict which tools Claude may use
11claude --allowedTools "Read,Edit"
12
13# Change the output format (great for scripts and CI)
14claude -p "review @src/app.ts" --output-format jsonThose are genuine. Beware the kraken of invented flags: guides on the web cheerfully show a "file" flag, a "temperature" flag, a "max-tokens" flag or an "output" flag - none of them exist. If a tutorial sails by that map, it will run you aground.
Once you are inside an interactive session (
claude), you steer with slash commands - commands that begin with /. These are the real ones:/help - the list of available commands and help/clear - wipe the context and start fresh/compact - summarize the conversation so far and carry on, saving context/init - generate a CLAUDE.md file for the project/model - switch the Claude model/config - settings/login - sign in/cost - show token usage and the cost of the session/review - review a Pull Request/agents - manage subagents/mcp - manage MCP servers/memory - edit the CLAUDE.md fileYour own skills appear here too, as
/<skill-name> - a skill called deploy runs as /deploy.Watch out: the
,/fileand/savecommands do not exist in Claude Code - if you met them in an older guide, someone made them up. You point at files with/context, and you manage context with@and/clear./compact
CLAUDE.md is a markdown file in the root of your project, where you write down your conventions, your architecture and the commands the crew uses daily. Claude Code loads it automatically in every session, so your first mate knows the ship from the very first message instead of asking the same questions again.1# Generate CLAUDE.md automatically
2# (type this command inside a claude session)
3/initThe
/init command inspects the project and drafts the file for you - then you edit it by hand to add the rules only you know. You can also keep a global ~/.claude/CLAUDE.md that applies to every project, plus nested CLAUDE.md files inside subdirectories for rules that are local to one part of the codebase.Claude Code - an agentic CLI from Anthropic (reads and edits files, runs commands) Install -
npm install -g @anthropic-ai/claude-code, then claude
Sign in - /login (Claude Pro/Max or Console) or the ANTHROPIC_API_KEY variable
Modes - interactive (claude) vs one-shot and non-interactive (claude -p "...")
Files - point with @file, chain with a pipe (cat file | claude -p "...")
Slash commands - /help, /clear, /compact, /init, /model, /review
CLAUDE.md - the project memory, generated by /initOpen the editor below and study the example commands - every one of them is a real form you have just learned. In the next exercise you will put a genuine Claude Code workflow to sea!
See you on deck, sailor!