Ahoy @name, and welcome to the final module! Captain Redbeard here. Every great pirate captain needs a trusted first mate at the helm - and yours is Claude Code, the official command-line crewmate from Anthropic. 🏴☠️🤖
Claude Code is an agentic coding tool that lives in your terminal. Unlike a simple chatbot, it can read your files, search your codebase, edit code, run commands, and complete multi-step tasks - all from the command line. Think of it as a tireless first mate who knows every plank of your ship.
We sailed with Cursor through the earlier modules. Both tools are powered by AI, but they steer different ships:
Cursor - the AI-first IDE:
Tab autocomplete as you type@-mentions to pull files into contextClaude Code - the terminal-native first mate:
They are complementary. Cursor is your captain's wheel; Claude Code is the crew that works the whole deck. Many pirates use both.
node --version)1# Install globally with npm
2npm install -g @anthropic-ai/claude-code
3
4# Then launch it
5claude
6
7# No global install? Run it on demand with npx
8npx @anthropic-ai/claude-codeThe first time you run
claude, you sign the pirate's articles - you log in. Run:1# Inside the Claude Code REPL
2/loginThis opens an OAuth flow. You can sign in with:
If you prefer to authenticate with an API key instead of OAuth, set an environment variable:
1# Linux/Mac - add to ~/.zshrc or ~/.bashrc
2export ANTHROPIC_API_KEY="sk-ant-..."Claude Code can steer with different Claude models, each suited to a different voyage:
Switch models from inside the REPL with the
/model slash command, or pick one when you launch:1# Launch with a specific model
2claude \
3 --model sonnet1# Or switch mid-voyage, inside the REPL
2/modelThere are several ways to call your first mate:
1# 1) Interactive REPL - a full conversation in the terminal
2claude
3
4# 2) Interactive, but start with a prompt
5claude "Explain what TypeScript is"
6
7# 3) Non-interactive - print the answer and exit (for scripts and pipes)
8claude -p "List the npm scripts in this project"
9
10# 4) Continue your most recent session
11claude -c
12
13# 5) Resume a specific past session
14claude -rThe
-p (--print) flag is the secret to automation: Claude answers and exits, so you can use it in scripts and pipelines. You can even feed it data through a pipe:1# Pipe a file into Claude for review
2cat src/auth.ts | claude -p "review this for bugs"
3
4# Pipe a git diff for a summary
5git diff | claude -p "summarize these changes"Here is a crucial truth, matey - Claude Code has no separate file flag at all. It reads and searches your files on its own. To point it at a specific file in a prompt, use the
@ symbol:1# The @ symbol references a file right in the prompt
2claude -p "explain @src/auth.ts"Need Claude to see another directory? Add it with the
add-dir flag:1# Give Claude access to an extra directory
2claude \
3 --add-dir ../shared-libThese are the real flags Claude Code understands. Memorize this short list - there are no others to invent:
1# Pick the model
2claude \
3 --model sonnet
4
5# Add a directory to context
6claude \
7 --add-dir ./packages
8
9# Control how permissions are granted
10claude \
11 --permission-mode plan
12
13# Restrict which tools Claude may use
14claude \
15 --allowedTools "Read,Edit"
16
17# Change the output format (great for scripts/CI)
18claude -p "review @src/app.ts" --output-format json
19
20# Load extra MCP servers
21claude \
22 --mcp-config ./mcp.json
23
24# Append extra instructions to the system prompt
25claude \
26 --append-system-prompt "Always write TypeScript"Beware the kraken of made-up flags! Many tutorials invent flags that simply do not exist - a "file" flag, a "temperature" flag, a "max-tokens" flag, a "glob" flag, an "output" flag. None of these are real. If a guide shows them, it is sailing by a false map. The genuine flags are exactly the ones listed above.
Once you are inside the interactive REPL, slash commands steer the session. Here are the real ones:
1/help # show available commands
2/clear # clear the conversation history
3/compact # summarize the conversation to free up context
4/init # generate a CLAUDE.md for this project
5/model # switch the Claude model
6/config # open settings
7/login # authenticate
8/cost # show token usage and cost for the session
9/review # review code changes
10/agents # manage subagents
11/mcp # manage MCP servers
12/memory # edit memory / CLAUDE.md filesCustom skills also appear as slash commands - a skill named
deploy is invoked with /deploy.Some tutorials invent slash commands for attaching files, saving output, or managing context. Those do not exist. To reference a file, use
in your prompt. To save Claude's work, just ask it to write the file - it can edit files directly.@
CLAUDE.md is a markdown file in your project root that records your conventions, architecture, and common commands. Claude Code loads it automatically every session, so your first mate always knows the rules of the ship./init~/.claude/CLAUDE.md for rules across all your projectsCLAUDE.md files can live in subdirectoriesA good
CLAUDE.md is the single best way to make Claude Code feel like a crewmate who has sailed with you for years.Open the sandpack and study the example commands. Notice how every command is one of the real forms you just learned - the REPL,
-p for scripts, @ for files, and the genuine slash commands.✅ Claude Code - an agentic CLI + SDK from Anthropic that reads, edits, and runs code ✅ Install -
npm install -g @anthropic-ai/claude-code, then claude
✅ Auth - /login (Pro/Max or Console), or the ANTHROPIC_API_KEY env var
✅ Models - claude-opus-4-8, claude-sonnet-4-6 (default), claude-haiku-4-5; switch with /model
✅ Running - claude, claude "prompt", claude -p (non-interactive), -c/-r to continue/resume
✅ File context - @file in the prompt and the add-dir flag; there is no separate file flag
✅ Real flags - --model, --add-dir, --permission-mode, --allowedTools, --output-format
✅ Slash commands - /help, /clear, /compact, /init, /model, /review, /agents, /mcp, /memory
✅ CLAUDE.md - auto-loaded project memory; generate with /initIn the next exercise we hoist the sails on real vibecoding workflows!
See you on deck! 🚀