Claude Code cheat sheet: commands, shortcuts, CLAUDE.md, plan mode, hooks and subagents
Every Claude Code command and shortcut you need on one page: starting and resuming, slash commands, keyboard shortcuts, CLAUDE.md, plan mode, permission modes, hooks and subagents. Checked against Anthropic's docs.
Last checked 18 November 2026
Start, resume and update
Type these in your terminal. Every command and shortcut on this page was checked against Anthropic's Claude Code documentation on 18 November 2026.
| Command | What it does |
|---|---|
| claude | Start a session in the current folder |
| claude "fix the failing test" | Start a session with a first prompt |
| claude -c | Continue the most recent conversation in this folder |
| claude -r | Pick an earlier session to resume |
| claude -p "summarise this repo" | Answer once and exit, handy in scripts |
| cat log.txt | claude -p "explain this error" | Send a file or command output to Claude |
| claude --model opus | Choose the model for this session |
| claude --permission-mode plan | Start in plan mode |
| claude update | Update to the latest version |
| claude -v | Show the installed version |
Slash commands
Type these inside a session. Type / on its own to see every command, including your own skills.
| Command | What it does |
|---|---|
| /init | Create a starter CLAUDE.md for the project |
| /memory | Edit your CLAUDE.md files |
| /plan | Switch to plan mode |
| /clear | Start a fresh conversation |
| /compact | Summarise the conversation so far to free up space |
| /context | See how much of the context window is used |
| /model | Switch model |
| /permissions | Manage which tools run without asking |
| /rewind | Roll back the conversation, the code, or both |
| /resume | Return to an earlier conversation |
| /review | Review the current changes or a pull request |
| /security-review | Check your changes for security problems |
| /mcp | Manage MCP connections |
| /hooks | See the hooks you have set up |
| /usage | See cost, plan limits and activity |
| /status | Show version, model and account |
| /doctor | Diagnose and fix setup problems |
| /help | List commands |
Keyboard shortcuts
Press ? in an empty prompt box to see the full list on your own setup.
| Key | What it does |
|---|---|
| Esc | Stop Claude. It keeps the work done so far |
| Esc twice | Clear your draft, or open the rewind menu if the box is empty |
| Shift+Tab | Cycle permission modes, including plan mode (Alt+M on some Windows setups) |
| Ctrl+C | Stop a task; with nothing running, press twice to exit |
| Ctrl+R | Search your earlier prompts |
| Ctrl+O | Show the full transcript |
| Ctrl+B | Send a running task to the background |
| Ctrl+G | Open your prompt, or the plan, in your text editor |
| Ctrl+V | Paste an image (Alt+V on Windows) |
| \ then Enter, or Ctrl+J | New line without sending |
| ! at the start | Run a shell command directly |
| @ | Pick a file to mention |
CLAUDE.md: tell Claude how your project works
CLAUDE.md is a plain text file of instructions that Claude reads at the start of every session: how to build and test, your coding style, things never to touch. Run /init and Claude writes a starter file from your project. Keep it short and specific, and add to it when Claude repeats a mistake.
Claude reads every CLAUDE.md that applies and combines them, broadest first, so the file closest to your project folder is read last. You can pull in another file with @ and its path.
| File | Applies to |
|---|---|
| ~/.claude/CLAUDE.md | You, in every project |
| ./CLAUDE.md or ./.claude/CLAUDE.md | This project, shared with your team in git |
| ./CLAUDE.local.md | You, in this project only (add it to .gitignore) |
# Project notes for Claude ## Commands - Install: npm install - Test: npm test - Run locally: npm run dev ## Rules - Use TypeScript, never plain JavaScript. - Run the tests before saying a change is done. - Never edit files in /generated. See @docs/architecture.md for how the app fits together.
Plan mode: look before it leaps
In plan mode Claude reads your files and proposes a plan, but cannot change anything until you approve it. Use it for anything bigger than a small fix.
Turn it on: press Shift+Tab until the mode shows plan, type /plan, or start with claude --permission-mode plan. Edit the plan: press Ctrl+G. Leave without approving: press Esc at the approval prompt, because Shift+Tab there approves the plan.
Permission modes
Claude Code v2.1.283 and later start in auto mode; Manual (config value default) asks before every edit and command. Shift+Tab moves between the modes you have available. Settings live in ~/.claude/settings.json for you, .claude/settings.json for the project, and .claude/settings.local.json for you in this project only.
| Mode | What Claude can do without asking |
|---|---|
| default (shown as Manual) | Read files. It asks before edits and commands |
| acceptEdits | Read and edit files, and run common file commands |
| plan | Explore only; no changes |
| auto | Everything, with background safety checks |
| dontAsk | Only tools you have approved in advance; everything else is refused |
| bypassPermissions | Everything with no checks. Anthropic says only in isolated containers or virtual machines |
Hooks: run your own command at set moments
Hooks run something automatically at a set point in Claude Code's work, for example formatting every file Claude edits, or blocking a command you never want run. You set them in the hooks section of a settings file, and /hooks shows what is set up. A PreToolUse hook that exits with code 2 blocks the action.
| Event | Runs |
|---|---|
| SessionStart | When a session starts or resumes |
| UserPromptSubmit | When you send a prompt |
| PreToolUse | Before Claude uses a tool, and can block it |
| PostToolUse | After a tool succeeds |
| Notification | When Claude Code sends you a notification |
| Stop | When Claude finishes its reply |
| SubagentStop | When a subagent finishes |
| PreCompact | Before the conversation is compacted |
| SessionEnd | When a session ends |
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{ "type": "command", "command": "npx prettier --write ." }
]
}
]
}
}Subagents: hand off a focused job
A subagent is a specialist helper with its own context window, instructions and tools. Claude hands it a job, such as reviewing code or searching a large codebase, and gets the result back without filling the main conversation. Claude Code includes Explore, Plan and a general-purpose subagent.
To make your own, add a Markdown file to .claude/agents/ in the project, or to ~/.claude/agents/ for every project. The name and description are required; tools and model are optional.
--- name: code-reviewer description: Reviews changed code for bugs and unclear names. Use after any change. tools: Read, Grep, Glob model: sonnet --- You review code. List real bugs first, then naming problems. Quote the file and line for each one. Do not edit files.