Catalog My learning Blog
Search courses and lessons
Cheat sheet

Claude Code Cheat Sheet

The Claude Code commands, flags, shortcuts and slash commands you'll use every day, on one page.

By Naveed Karimi · Checked November 7, 2026 · Print-friendly

Start and resume sessions

CommandWhat it does
claudeStart an interactive session
claude "explain this project"Start with a first prompt
claude -p "query"Run once and print the answer (print mode, for scripts)
cat logs.txt | claude -p "explain"Pipe content in
claude -cContinue the most recent conversation in this folder
claude -r "auth-refactor" "Finish this PR"Resume a session by ID or name
claude updateUpdate to the latest version
claude doctorPrint installation and settings diagnostics
claude auth statusShow whether you're signed in
claude agentsOpen the view of background sessions

Flags worth remembering

FlagUse it to
--model sonnet (or opus, haiku, a full model name)Pick the model for this session
--permission-mode planStart in a mode: default, acceptEdits, plan, auto, dontAsk, bypassPermissions
--allowedTools "Bash(git log *)" "Read"Let these tools run without asking
--disallowedTools "Edit"Remove or deny tools ("mcp__*" removes every MCP tool)
--add-dir ../libGive access to another folder
--append-system-prompt "Always use TypeScript"Add to the system prompt
-p --output-format jsonMachine-readable output in print mode (text, json, stream-json)
-p --max-turns 3Cap the agent loop in print mode
--mcp-config ./mcp.json --strict-mcp-configUse only the MCP servers in that file
-w feature-authWork in an isolated git worktree
-n "my-feature"Name the session so you can resume it by name
--effort highSet effort: low, medium, high, xhigh, max
--safe-modeStart with CLAUDE.md, skills, plugins, hooks and MCP disabled, to debug a broken setup
--debug=mcpDebug logging for one area

--dangerously-skip-permissions skips every permission prompt. Use it only in a sandbox or container.

Keyboard shortcuts

KeysAction
EscStop Claude mid-turn; work so far is kept
Esc EscClear the draft, or with an empty prompt open the rewind menu
Shift+TabCycle permission modes (Manual, accept edits, plan, ...)
Ctrl+CInterrupt; on an empty prompt, press twice to exit
Ctrl+RSearch command history
Ctrl+BSend a running command or agent to the background
Ctrl+OToggle the transcript viewer
Ctrl+TShow or hide the task checklist
Ctrl+GEdit the prompt in your text editor
Ctrl+V (Alt+V on Windows)Paste an image
Option+P / Alt+PSwitch model without clearing the prompt
Option+T / Alt+TToggle extended thinking
\ then Enter, or Shift+EnterNew line in the prompt

Prefixes: / for commands and skills, ! to run a shell command directly (! npm test), @ to mention a file, ? on an empty prompt for help.

Slash commands

CommandWhat it does
/initCreate a CLAUDE.md for the project
/memoryEdit CLAUDE.md files and auto memory
/clearStart a new conversation with empty context
/compact [focus]Summarize the conversation to free context
/contextShow context usage as a grid
/modelSwitch model
/permissionsManage allow, ask and deny rules
/plan [task]Enter plan mode
/rewindRoll back conversation and code to an earlier point
/resumePick a past session
/reviewReview the current diff or a PR (alias of /code-review)
/security-reviewCheck the branch for security issues
/mcpMCP servers: status, OAuth sign-in, enable and disable
/hooksView hook configuration
/skillsList available skills
/pluginInstall and manage plugins
/usageSession cost and plan limits (also /cost)
/statusVersion, model, account and connectivity
/configSettings: theme, model, editor mode and more

MCP commands

BASH
# add servers (scope: local is default; project writes .mcp.json; user = all projects)
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
claude mcp add --scope project --env API_KEY=xyz airtable -- npx -y airtable-mcp-server
claude mcp add-json github '{"type":"http","url":"https://api.githubcopilot.com/mcp"}'

# manage
claude mcp list
claude mcp get sentry
claude mcp remove sentry
claude mcp login sentry        # OAuth without opening /mcp
claude mcp reset-project-choices

# environment
MCP_TIMEOUT=30000 claude          # server startup timeout (ms)
MAX_MCP_OUTPUT_TOKENS=50000 claude

Go deeper: Claude Code plan mode, skills, hooks and the hooks cheat sheet.