Day 2
Essential Commands
Learn the core ways to invoke Claude — REPL mode, one-shot, piping, and flags.
0 / 6 tasks
Three main modes
Claude CLI has three key invocation patterns: interactive REPL (`claude`), one-shot (`claude -p "…"`), and piped input (`cat file | claude -p "explain"`). Knowing when to use each makes you dramatically more efficient.
One-shot vs REPL
bash
# One-shot: great for scripting
claude -p "Write a bash function to find duplicate files"
# REPL: great for iterative work
claude
> Scaffold a FastAPI app with user auth
> Now add a password reset endpoint
> Generate tests for both endpoints
Piping content
bash
# Explain a file
cat main.py | claude -p "Summarize what this does"
# Fix a bug from stderr
python app.py 2>&1 | claude -p "What is causing this error?"
# Review a git diff
git diff | claude -p "Review this change for issues"
Useful flags
bash
# Continue last conversation
claude --continue
# JSON output for scripting
claude -p "List 5 Python tips" --output-format json
# Choose a model
claude --model claude-opus-4-8
# Non-interactive (for scripts)
claude --no-interactive -p "Generate changelog"