Skip to content
Academy ofAI Learning

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.

CommandWhat it does
claudeStart a session in the current folder
claude "fix the failing test"Start a session with a first prompt
claude -cContinue the most recent conversation in this folder
claude -rPick 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 opusChoose the model for this session
claude --permission-mode planStart in plan mode
claude updateUpdate to the latest version
claude -vShow the installed version

Slash commands

Type these inside a session. Type / on its own to see every command, including your own skills.

CommandWhat it does
/initCreate a starter CLAUDE.md for the project
/memoryEdit your CLAUDE.md files
/planSwitch to plan mode
/clearStart a fresh conversation
/compactSummarise the conversation so far to free up space
/contextSee how much of the context window is used
/modelSwitch model
/permissionsManage which tools run without asking
/rewindRoll back the conversation, the code, or both
/resumeReturn to an earlier conversation
/reviewReview the current changes or a pull request
/security-reviewCheck your changes for security problems
/mcpManage MCP connections
/hooksSee the hooks you have set up
/usageSee cost, plan limits and activity
/statusShow version, model and account
/doctorDiagnose and fix setup problems
/helpList commands

Keyboard shortcuts

Press ? in an empty prompt box to see the full list on your own setup.

KeyWhat it does
EscStop Claude. It keeps the work done so far
Esc twiceClear your draft, or open the rewind menu if the box is empty
Shift+TabCycle permission modes, including plan mode (Alt+M on some Windows setups)
Ctrl+CStop a task; with nothing running, press twice to exit
Ctrl+RSearch your earlier prompts
Ctrl+OShow the full transcript
Ctrl+BSend a running task to the background
Ctrl+GOpen your prompt, or the plan, in your text editor
Ctrl+VPaste an image (Alt+V on Windows)
\ then Enter, or Ctrl+JNew line without sending
! at the startRun 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.

FileApplies to
~/.claude/CLAUDE.mdYou, in every project
./CLAUDE.md or ./.claude/CLAUDE.mdThis project, shared with your team in git
./CLAUDE.local.mdYou, in this project only (add it to .gitignore)
CLAUDE.md
# 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.

ModeWhat Claude can do without asking
default (shown as Manual)Read files. It asks before edits and commands
acceptEditsRead and edit files, and run common file commands
planExplore only; no changes
autoEverything, with background safety checks
dontAskOnly tools you have approved in advance; everything else is refused
bypassPermissionsEverything 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.

EventRuns
SessionStartWhen a session starts or resumes
UserPromptSubmitWhen you send a prompt
PreToolUseBefore Claude uses a tool, and can block it
PostToolUseAfter a tool succeeds
NotificationWhen Claude Code sends you a notification
StopWhen Claude finishes its reply
SubagentStopWhen a subagent finishes
PreCompactBefore the conversation is compacted
SessionEndWhen a session ends
.claude/settings.json: format files after every edit
{
  "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.

.claude/agents/code-reviewer.md
---
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.

Sources