Class 01 — Claude Code

The Command

From bash prompt to API call — every part of a claude invocation, and the two modes that split them all.

Key concept
Interactive mode
Drop into a persistent REPL. Type back and forth. Sessions are saved.
Print mode  -p
Query once, get output, exit. The foundation of scripting and automation.

Most flags only work in one mode. Knowing which you're in is always step one.

Dissecting a Command

cat logs.txt | claude -p "Summarize errors" --model sonnet --output-format json --verbose --max-turns 5
stdin pipe base cmd print mode query string model select output format verbose log turn limit cat file | … claude -p flag "…" string --model alias text / json / stream-json full turn output --max-turns N

Core Commands

show mode:
interactive
claude

Start the interactive REPL. Drops you into a conversational session in your current working directory.

$ claude
interactive
claude "query"

Start the REPL with an initial prompt pre-loaded. Claude processes the query and continues interactively.

$ claude "explain this project"
print / SDK
claude -p "query"

Query Claude and exit immediately. The foundation of scripting — every automation flag requires this.

$ claude -p "explain this function"
print / SDK
cat file | claude -p "query"

Process piped stdin content. Claude reads from the pipe and responds to the query about it.

$ cat logs.txt | claude -p "summarize errors"
interactive
claude -c

Continue the most recent conversation in the current directory. Resumes context from your last session.

$ claude -c
interactive + print
claude -r "session" "query"

Resume a session by its ID or saved name, with an optional follow-up query to immediately continue.

$ claude -r "auth-refactor" "Finish this PR"
utility
claude update

Update Claude Code to the latest version. Checks for and installs available updates.

$ claude update
utility
claude mcp

Configure Model Context Protocol servers. Manage MCP server integrations and connections.

$ claude mcp
1 of 5 Class 02: The Exchange →