Claude Code cheat sheet
Every command, flag and slash command for claude — Anthropic's agentic coder — a terminal REPL that reads, edits and runs your repo. 21+ commands, verified July 2026.
curl -fsSL https://claude.ai/install.sh | bash # macOS / Linux / WSL
irm https://claude.ai/install.ps1 | iex # Windows (PowerShell)
brew install --cask claude-code # Homebrew
npm install -g @anthropic-ai/claude-code # npm (needs Node 22+)
claude --version · claude doctor · claude update
Needs a Claude Pro / Max / Team / Enterprise or Console account (the free plan does not include Claude Code). Native installs auto-update; brew/npm do not.
claude # interactive REPL in the current dir
claude "explain this repo" # REPL seeded with a prompt
claude -p "query" # headless: print the answer and exit
claude -c # continue the most recent conversation here
claude -r "<session>" "…" # resume a specific session by id or name
cat file | claude -p "…" # pipe content in, headless
Key flags
| Flag | What it does |
|---|---|
-p, --print | Non-interactive: print the response and exit (scripting / CI) |
-c, --continue | Load the most recent conversation in this directory |
-r, --resume | Resume a specific session by id or name |
--model <m> | Alias sonnet / opus / haiku / fable, or a full model id |
--permission-mode <m> | default, acceptEdits, plan, or bypassPermissions |
--dangerously-skip-permissions | Skip every permission prompt (= bypassPermissions) |
--output-format <fmt> | text (default), json, or stream-json |
--add-dir <path> | Grant read/edit access to extra working directories |
--append-system-prompt <text> | Append text to the default system prompt |
In-session slash commands
| Command | What it does |
|---|---|
/clear | Start a new conversation with empty context |
/compact | Summarize the conversation to free up context |
/context | Visualize current context-window usage |
/model | Switch model and save it as the default |
/init | Generate a CLAUDE.md project guide |
/memory | Edit CLAUDE.md memory files |
/review [PR] | Fast single-pass review of a GitHub PR |
/agents | Manage subagents (edit .claude/agents/) |
/mcp | Manage MCP server connections |
/plan | Enter plan mode for large changes |
/permissions | Manage allow / ask / deny tool rules |
/cost · /status · /help | Usage & cost · session status · help |
~/.claude/settings.json # user, all projects
.claude/settings.json # project (git-shared)
.claude/settings.local.json # local overrides (gitignored)
~/.claude/CLAUDE.md · ./CLAUDE.md # user / project memory
.mcp.json # MCP servers (project)
# env: ANTHROPIC_API_KEY · ANTHROPIC_MODEL · DISABLE_AUTOUPDATER=1
# backends: Amazon Bedrock · Google Vertex AI · Microsoft Foundry
claude -p "summarize what this service does"
git diff | claude -p "review these changes for bugs"
claude -c # resume last session
claude --model opus -p "refactor utils.py for readability"
More CLI cheat sheets
Stop memorizing flags
Run Claude Code — and every other agent — from one app
TheVibeFather orchestrates Claude Code alongside every other coding CLI in one native macOS app. Bring the models you already pay for; keep your keys.
Gemini CLI
Aider
Goose
Qwen Code
Crush
Grok CLI
OpenHands CLI
Cline CLI
Roo Code CLI
Continue CLI