Skip to content
Claude Code logo

Claude Code cheat sheet

$ claude Anthropic Official docs

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.

Install
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.

Start & run
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

FlagWhat it does
-p, --printNon-interactive: print the response and exit (scripting / CI)
-c, --continueLoad the most recent conversation in this directory
-r, --resumeResume 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-permissionsSkip 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

CommandWhat it does
/clearStart a new conversation with empty context
/compactSummarize the conversation to free up context
/contextVisualize current context-window usage
/modelSwitch model and save it as the default
/initGenerate a CLAUDE.md project guide
/memoryEdit CLAUDE.md memory files
/review [PR]Fast single-pass review of a GitHub PR
/agentsManage subagents (edit .claude/agents/)
/mcpManage MCP server connections
/planEnter plan mode for large changes
/permissionsManage allow / ask / deny tool rules
/cost · /status · /helpUsage & cost · session status · help
Config
~/.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
Common one-liners
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.