Claude Code Cheat Sheet
The Claude Code commands, flags, shortcuts and slash commands you'll use every day, on one page.
Start and resume sessions
| Command | What it does |
|---|---|
claude | Start 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 -c | Continue the most recent conversation in this folder |
claude -r "auth-refactor" "Finish this PR" | Resume a session by ID or name |
claude update | Update to the latest version |
claude doctor | Print installation and settings diagnostics |
claude auth status | Show whether you're signed in |
claude agents | Open the view of background sessions |
Flags worth remembering
| Flag | Use it to |
|---|---|
--model sonnet (or opus, haiku, a full model name) | Pick the model for this session |
--permission-mode plan | Start 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 ../lib | Give access to another folder |
--append-system-prompt "Always use TypeScript" | Add to the system prompt |
-p --output-format json | Machine-readable output in print mode (text, json, stream-json) |
-p --max-turns 3 | Cap the agent loop in print mode |
--mcp-config ./mcp.json --strict-mcp-config | Use only the MCP servers in that file |
-w feature-auth | Work in an isolated git worktree |
-n "my-feature" | Name the session so you can resume it by name |
--effort high | Set effort: low, medium, high, xhigh, max |
--safe-mode | Start with CLAUDE.md, skills, plugins, hooks and MCP disabled, to debug a broken setup |
--debug=mcp | Debug logging for one area |
--dangerously-skip-permissions skips every permission prompt. Use it only in a sandbox or container.
Keyboard shortcuts
| Keys | Action |
|---|---|
Esc | Stop Claude mid-turn; work so far is kept |
Esc Esc | Clear the draft, or with an empty prompt open the rewind menu |
Shift+Tab | Cycle permission modes (Manual, accept edits, plan, ...) |
Ctrl+C | Interrupt; on an empty prompt, press twice to exit |
Ctrl+R | Search command history |
Ctrl+B | Send a running command or agent to the background |
Ctrl+O | Toggle the transcript viewer |
Ctrl+T | Show or hide the task checklist |
Ctrl+G | Edit the prompt in your text editor |
Ctrl+V (Alt+V on Windows) | Paste an image |
Option+P / Alt+P | Switch model without clearing the prompt |
Option+T / Alt+T | Toggle extended thinking |
\ then Enter, or Shift+Enter | New 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
| Command | What it does |
|---|---|
/init | Create a CLAUDE.md for the project |
/memory | Edit CLAUDE.md files and auto memory |
/clear | Start a new conversation with empty context |
/compact [focus] | Summarize the conversation to free context |
/context | Show context usage as a grid |
/model | Switch model |
/permissions | Manage allow, ask and deny rules |
/plan [task] | Enter plan mode |
/rewind | Roll back conversation and code to an earlier point |
/resume | Pick a past session |
/review | Review the current diff or a PR (alias of /code-review) |
/security-review | Check the branch for security issues |
/mcp | MCP servers: status, OAuth sign-in, enable and disable |
/hooks | View hook configuration |
/skills | List available skills |
/plugin | Install and manage plugins |
/usage | Session cost and plan limits (also /cost) |
/status | Version, model, account and connectivity |
/config | Settings: theme, model, editor mode and more |
MCP commands
# 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 claudeGo deeper: Claude Code plan mode, skills, hooks and the hooks cheat sheet.