Reference· Updated 2026-11-03

Claude Code Cheat Sheet

The Claude Code commands, shortcuts, flags and files you use every day, on one page. Print it or save it as a PDF. For everything else, see the full lists of slash commands, shortcuts, CLI flags and env vars.

Start and resume

claudeStart interactive session
claude "query"Start interactive session with initial prompt
claude -p "query"Query via SDK, then exit
cat file | claude -p "query"Process piped content
claude -cContinue most recent conversation in current directory
claude -r "<session>" "query"Resume session by ID or name
claude updateUpdate to latest version
claude doctorPrint read-only installation and settings diagnostics from the terminal without starting a session, including install health, settings-file validation errors, and Remote Control eligibility
claude mcpConfigure Model Context Protocol (MCP) servers

Keyboard shortcuts

EscInterrupt Claude, or close a dialog
Esc + EscClear input draft, or rewind
Ctrl+CInterrupt, or clear input
Ctrl+OToggle transcript viewer
Ctrl+RReverse search command history
Ctrl+GOpen in default text editor
Ctrl+BBackground running tasks
Ctrl+TToggle syntax highlighting for code blocks
Ctrl+SStash or restore prompt
Option+PSwitch model
Ctrl+VPaste image from clipboard

Slash commands

/initInitialize project with a CLAUDE.md guide
/clear [name]Start a new conversation with empty context
/compact [instructions]Free up context by summarizing the conversation so far
/context [all]Visualize current context usage as a colored grid
/model [model]Switch the AI model and save it as your default for new sessions
/effort [level|auto|status|ultracode [on|off]]Set the effort level: low to xhigh, max, or auto; status prints it
/plan [description]Enter plan mode directly from the prompt
/resume [session]Resume a conversation by ID or name, or open the session picker
/rewindRewind the conversation and/or code to a previous point, or summarize from a selected message
/branch [name]Create a branch of the current conversation at this point, so you can try a different direction without losing the conversation as it stands
/btw [question]Ask a side question about the current session without adding to the conversation
/permissionsManage allow, ask, and deny rules for tool permissions
/hooksView hook configurations
/mcp [reconnect (<server>|all)|enable|disable [<server>|all]]Manage MCP server connections and OAuth authentication
/plugin [subcommand]Manage Claude Code plugins
/skillsList available skills
/memoryEdit CLAUDE.md files, enable or disable auto memory, and view auto memory entries
/review [low|medium|high|xhigh|max|ultra] [--fix] [--comment] [--max-findings n|all|default] [pr#|branch|path]Alias of /code-review: reviews the current diff, or a PR number, branch, or path you pass, such as /review 1234, and takes the same effort levels and flags
/security-reviewAnalyze the changes on your current branch for security vulnerabilities
/usageShow session cost, plan usage limits, and activity stats
/costAlias for /usage
/config [key=value ...]Open the Settings interface to adjust theme, model, output style, and other preferences
/doctor [prompt-audit [path]]Run a setup checkup that diagnoses installation, settings, extension, and CLAUDE.md problems and proposes fixes that Claude applies after you confirm
/statuslineConfigure Claude Code's status line

Prompt tricks

@path/to/fileMention a file or folder to pull it into context
! npm testShell mode: run a command and show Claude the output
/ at startOpen the command and skill menu
\ then Enter, or Ctrl+JNew line without sending
? on empty promptShow the shortcut help panel
ultrathinkAsk for deeper reasoning on one turn
Paste a screenshotCtrl+V adds images; describe what to fix

Useful flags

--modelSets the model for the current session with a model alias such as sonnet, opus, haiku, or fable, or a model's full name
--permission-modeBegin in a specified permission mode
--allowedToolsTools that execute without prompting for permission, apart from reads from network paths
--append-system-promptAppends to the default prompt
--output-formatSpecify output format for print mode (options: text, json, stream-json)
--max-turnsLimit the number of agentic turns (print mode only)
--add-dirAdd additional working directories for Claude to read and edit files
--worktreeStart Claude in an isolated git worktree at <repo>/.claude/worktrees/<name>
--dangerously-skip-permissionsSkip permission prompts

Files and where they live

CLAUDE.mdProject instructions Claude reads every session. Commit it.
CLAUDE.local.mdYour personal project notes. Keep it out of git.
~/.claude/CLAUDE.mdInstructions for every project on your machine
.claude/settings.jsonShared project settings: permissions, hooks, env, model
.claude/settings.local.jsonYour own overrides for this project, gitignored
~/.claude/settings.jsonUser settings for every project
.claude/agents/*.mdProject subagents (~/.claude/agents/ for yours)
.claude/skills/<name>/SKILL.mdProject skills and custom slash commands
.mcp.jsonProject MCP servers, shared with the team
~/.claude.jsonYour MCP servers, OAuth sessions and per-project state
~/.claude/keybindings.jsonCustom keyboard shortcuts

Generate these files instead of writing them by hand: CLAUDE.md, settings.json, subagents, .mcp.json.

Frequently asked questions

What are the most important Claude Code commands?

For daily work: /init to create a CLAUDE.md, /clear between unrelated tasks, /compact when context fills up, /model to switch models, /plan to plan before editing, /resume to reopen a session and /rewind to undo. claude -p runs Claude Code once from a script.

How do I undo what Claude Code just did?

Press Esc twice on an empty prompt, or run /rewind, to go back to an earlier checkpoint. You can restore the code, the conversation or both.

How do I give Claude Code project instructions?

Put them in CLAUDE.md at the root of the repo. Run /init to generate a first draft, or use the CLAUDE.md generator on this site, and keep it short: build and test commands, conventions and the gotchas Claude would not guess.

Is there a printable Claude Code cheat sheet?

Yes, this page. Use your browser's print or Save as PDF; the layout switches to a compact two-column sheet when printed.

Sources: Commands, CLI reference, Interactive mode. Claude Code Agents is an independent site, not affiliated with Anthropic.

More free Claude Code tools

All tools →