Claude Code Cheat Sheet — Commands, Shortcuts & Flags

Claude Code slash commands, CLI flags, keyboard shortcuts, CLAUDE.md and settings locations, hooks and MCP commands on one page.

Claude Code cheat sheet — freetoolsforweb.com

Verified against Claude Code docs on (latest release v2.1.302 (October 16, 2026)). Claude Code ships several releases a week, so check the changelog or run claude --help and /help for anything newer.

169 entries in 8 tables

Built-in slash commands#

Type / in a session to see every command available to you, including skills and commands from plugins and MCP servers. Some depend on your plan or platform.

CommandWhat it doesCopy
/helpShow help and the available commands.
/clearStart a new conversation with empty context. Aliases /reset and /new. The old one stays in /resume.
/compact [instructions]Summarize the conversation so far to free context; optional focus instructions for the summary.
/contextShow context-window usage as a colored grid, with suggestions for what is using space.
/initCreate a CLAUDE.md guide for the project.
/memoryEdit CLAUDE.md files, turn auto memory on or off, and view auto memory entries.
/model [model]Switch model and save it as your default; with no argument opens a picker (left/right arrows adjust effort).
/effort [level|auto|status]Set the effort level (low to xhigh, max, or auto); status prints the current one.
/fast [on|off]Toggle fast mode.
/config [key=value]Open Settings (theme, model, output style...) or set a value directly, e.g. /config theme=dark.
/statusShow version, model, account and connectivity.
/usageSession cost, plan usage limits and activity stats. Aliases /cost and /stats.
/permissionsManage allow, ask and deny rules for tools, and working directories.
/plan [description]Enter plan mode, optionally starting on a task: /plan fix the auth bug.
/resume [session]Resume a conversation by ID or name, or open the session picker.
/rename [name]Rename the current session (shown on the prompt bar and in /resume).
/branch [name]Branch the conversation here to try another direction; the original stays available in /resume.
/fork [prompt]Copy the conversation into a new background session and keep working here.
/background [prompt]Detach this session to run as a background agent (alias /bg); monitor with claude agents.
/rewindRewind the conversation and/or code to an earlier point. Aliases /checkpoint and /undo.
/btw [question]Ask a side question without adding it to the conversation.
/diffReview the changes in your working tree, including Claude’s edits.
/review [level] [pr|branch|path]Alias of /code-review: review the current diff or a PR for bugs.
/security-reviewReview the changes on your branch for security vulnerabilities (needs an origin remote).
/simplify [target]Skill: review changed code for reuse, simplification and efficiency, then apply the fixes.
/copy [N]Copy the last (or Nth-latest) response to the clipboard; pick single code blocks.
/export [filename]Export the conversation as plain text to a file or the clipboard.
/add-dir <path>Give Claude access to another working directory for this session.
/cd <path>Move the session to a new working directory, keeping the conversation.
/agentsReminder for creating subagents: ask Claude, or edit .claude/agents/ or ~/.claude/agents/.
/tasksView and manage background work (shells and subagents). Also /bashes.
/skillsList available skills; filter, sort by token cost, and show or hide them.
/mcpManage MCP server connections and OAuth; /mcp reconnect all retries failed servers.
/hooksView your hook configurations.
/plugin [subcommand]Manage plugins: list, install, enable, disable.
/keybindingsOpen your keyboard shortcuts file (~/.claude/keybindings.json).
/output-style [style]List output styles or switch to one.
/themeChange the color theme (auto, light, dark, colorblind-friendly, ANSI).
/statuslineConfigure the status line, or auto-configure it from your shell prompt.
/terminal-setupInstall a Shift+Enter newline binding for your terminal or editor.
/ideManage IDE integrations and show their status.
/doctorSkill: check installation, settings, extensions and CLAUDE.md and propose fixes. Alias /checkup.
/loop [interval] [prompt]Skill: run a prompt repeatedly while the session stays open, e.g. /loop 5m check the deploy.
/schedule [description]Create, update, list or run routines that execute in the cloud.
/goal [condition|clear]Set a goal Claude keeps working toward across turns until it is met.
/install-github-appInstall the Claude GitHub App and optionally set up GitHub Actions.
/sandboxToggle sandbox mode (supported platforms only).
/loginSign in to your Anthropic account.
/logoutSign out.
/bug [report]Report a bug or share the conversation, after a consent screen.
/release-notesBrowse the changelog by version.
/exitExit the CLI. Alias /quit.
/vim (removed)Removed in v2.1.92. Switch Vim editing mode in /config > Editor mode instead.

CLI commands (run in your shell)#

CommandWhat it doesCopy
claudeStart an interactive session.
claude "query"Start an interactive session with a first prompt.
claude -p "query"Answer once without the interactive UI, then exit (print / SDK mode).
cat file | claude -p "query"Process piped content, e.g. cat logs.txt | claude -p "explain".
claude -cContinue the most recent conversation in this directory.
claude -r "<session>" "query"Resume a session by ID or name, optionally with a new prompt.
claude updateUpdate to the latest version.
claude install [version]Install or reinstall the native binary: a version, stable or latest.
claude auth loginSign in (--console bills to the Anthropic Console instead of a subscription).
claude auth statusShow sign-in status as JSON (--text for plain text).
claude agentsOpen agent view to monitor and dispatch background sessions.
claude doctorPrint install and settings diagnostics without starting a session.
claude mcpConfigure MCP servers (see the MCP table below).
claude pluginManage plugins (alias claude plugins).
claude setup-tokenGenerate a long-lived OAuth token for CI and scripts (needs a subscription).
claude -vPrint the installed version.

CLI flags#

Flags go after claude, before the prompt. Several (-p only) apply to print mode.

FlagWhat it doesExampleCopy
--print, -pPrint the response without interactive mode.claude -p "query"
--continue, -cLoad the most recent conversation in the current directory.claude --continue
--resume, -rResume a session by ID or name, or show a picker.claude --resume auth-refactor
--fork-sessionWith --resume or --continue, start a new session ID instead of reusing the old one.claude --resume abc123 --fork-session
--name, -nName the session (shown in /resume and the terminal title).claude -n "my-feature-work"
--modelModel for this session: an alias (sonnet, opus, haiku, fable) or a full model name.claude --model sonnet
--fallback-modelFall back to these models, in order, when the main one is overloaded or unavailable.claude --fallback-model sonnet,haiku
--effortEffort level for this session: low, medium, high, xhigh, max or ultracode.claude --effort high
--permission-modeStart in a permission mode: default (manual), acceptEdits, plan, auto, dontAsk, bypassPermissions.claude --permission-mode plan
--dangerously-skip-permissionsSkip permission prompts (same as --permission-mode bypassPermissions). Use only in isolated containers or VMs.claude --dangerously-skip-permissions
--allowedToolsTools that run without asking, using permission rule syntax.claude --allowedTools "Bash(git log *)" "Read"
--disallowedToolsDeny rules: a bare tool name removes the tool; a scoped rule denies matching calls.claude --disallowedTools "Bash(rm *)" "Edit"
--toolsRestrict which built-in tools exist: "" for none, "default", or a list.claude --tools "Bash,Edit,Read"
--output-formatPrint-mode output: text, json or stream-json.claude -p "query" --output-format json
--input-formatPrint-mode input: text or stream-json.claude -p --output-format json --input-format stream-json
--json-schemaReturn validated JSON matching a schema when the run finishes (print mode).claude -p --json-schema '{"type":"object"}' "query"
--max-turnsCap the number of agentic turns (print mode).claude -p --max-turns 3 "query"
--max-budget-usdStop once estimated API spend reaches this amount (print mode).claude -p --max-budget-usd 5.00 "query"
--append-system-promptAppend text to the default system prompt.claude --append-system-prompt "Always use TypeScript"
--system-promptReplace the whole system prompt.claude --system-prompt "You are a Python expert"
--add-dirAdd more working directories Claude can read and edit.claude --add-dir ../apps ../lib
--mcp-configLoad MCP servers from JSON files or strings.claude --mcp-config ./mcp.json
--strict-mcp-configUse only the servers from --mcp-config.claude --strict-mcp-config --mcp-config ./mcp.json
--settingsLoad settings from a JSON file or string for this session.claude --settings ./settings.json
--setting-sourcesWhich settings files to load: user, project, local.claude --setting-sources user,project
--agentsDefine subagents inline as JSON.claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'
--agentRun the session as a specific agent.claude --agent my-custom-agent
--worktree, -wStart in an isolated git worktree under .claude/worktrees/.claude -w feature-auth
--bareMinimal mode: skip hooks, skills, plugins, MCP, auto memory and CLAUDE.md for fast scripted runs.claude --bare -p "query"
--safe-modeStart with all customizations off to troubleshoot a broken setup.claude --safe-mode
--verboseShow full turn-by-turn output.claude --verbose
--debugDebug mode, optionally filtered by category.claude --debug='mcp,startup'
--ideConnect to your IDE on startup if exactly one is available.claude --ide
--chromeEnable Claude in Chrome browser integration.claude --chrome
--version, -vPrint the version number.claude -v

Permission modes#

Cycle with Shift+Tab, start with --permission-mode, or set defaultMode in settings. The mode named Manual in the UI is default in config.

ModeWhat runs without askingBest forCopy
default (Manual)Reads only.Reviewing every action, sensitive work
acceptEditsReads, file edits and common filesystem commands (mkdir, touch, mv, cp...).Iterating on code you are reviewing
planReads, plus classifier-approved commands when auto mode is available.Exploring a codebase before changing it
autoEverything, with background safety checks.Long tasks, fewer prompts
dontAskFile reads in your working directories and pre-approved tools; anything else is denied.Locked-down CI and scripts
bypassPermissionsEverything.Isolated containers and VMs only

Memory: CLAUDE.md files and where they live#

CLAUDE.md files load at the start of every session. Use @path/to/file inside one to import another file (up to four hops deep).

FileScope and useCopy
/Library/Application Support/ClaudeCode/CLAUDE.mdManaged policy (macOS): organization-wide instructions deployed by IT. Linux and WSL: /etc/claude-code/CLAUDE.md; Windows: C:\Program Files\ClaudeCode\CLAUDE.md.
~/.claude/CLAUDE.mdYour personal instructions for every project.
./CLAUDE.md or ./.claude/CLAUDE.mdProject instructions shared with the team through source control.
./CLAUDE.local.mdYour private notes for this project; add it to .gitignore.
.claude/rules/*.mdTopic files (testing.md, api-design.md); optional paths frontmatter loads a rule only for matching files.
~/.claude/projects/<project>/memory/Auto memory: a MEMORY.md index plus topic files Claude writes for itself; manage with /memory.
AGENTS.mdRead as project instructions too; the memory docs explain when it loads instead of or alongside CLAUDE.md.

Settings files (highest precedence first)#

Managed settings beat --settings, which beats project local, then shared project, then user settings. Lists such as permission rules merge across files.

FileScope and useCopy
managed-settings.jsonManaged: deployed by your organization (file, MDM or server-managed). Your own files and --settings can’t override its keys.
--settings <file-or-json>Command line: overrides the files below for one session.
.claude/settings.local.jsonProject local: you, in this project only; kept out of git.
.claude/settings.jsonShared project: commit it so the team gets the same permissions, hooks and plugins.
~/.claude/settings.jsonUser: your preferences in every project (theme, model, your permission rules).
~/.claude.jsonWritten by Claude Code itself: sign-in, MCP servers, per-project state. Not one of the precedence levels.
~/.claude/keybindings.jsonCustom keyboard shortcuts (open with /keybindings); changes apply without a restart.

Hook events#

Hooks are shell commands (or prompts) in the "hooks" key of a settings file. Exit code 2 blocks the action on events that can block, and stderr is shown to Claude.

EventWhen it firesCopy
SessionStartA session begins or resumes.
SetupClaude Code starts with --init-only, or --init / --maintenance in -p mode.
UserPromptSubmitA prompt is submitted, before Claude processes it.
UserPromptExpansionA typed command expands into a prompt; can block the expansion.
PreToolUseBefore a tool call runs; can block it.
PermissionRequestA tool call needs a permission decision.
PermissionDeniedAuto mode denies a tool call.
PostToolUseAfter a tool call succeeds.
PostToolUseFailureAfter a tool call fails.
PostToolBatchAfter a batch of parallel tool calls resolves, before the next model call.
NotificationClaude Code sends a notification (permission prompt, idle prompt...).
MessageDisplayWhile assistant message text is displayed.
SubagentStartA subagent is spawned.
SubagentStopA subagent finishes.
TaskCreatedA task is being created.
TaskCompletedA task is being marked completed.
StopClaude finishes responding.
StopFailureThe turn ends because of an API error.
TeammateIdleAn agent-team teammate is about to go idle.
InstructionsLoadedA CLAUDE.md or .claude/rules file loads into context.
ConfigChangeA configuration file changes during the session.
CwdChangedThe working directory changes (useful with direnv).
DirectoryAddedA working directory is added with /add-dir.
FileChangedA watched file changes on disk (matcher lists the filenames).
WorktreeCreateA worktree is being created; replaces the default git behavior.
WorktreeRemoveA worktree created by a WorktreeCreate hook is removed.
PreCompactBefore context compaction.
PostCompactAfter compaction completes.
PreModelSwitchBefore a model switch is applied; can block it.
PostModelSwitchAfter the session’s model changes.
ElicitationAn MCP server asks for user input during a tool call.
ElicitationResultAfter you answer an MCP elicitation, before the reply is sent.
SessionEndA session ends.

MCP server commands#

Scopes: local (default, this project, stored in ~/.claude.json), project (.mcp.json in the repo, shared with the team) and user (all your projects, ~/.claude.json).

CommandWhat it doesExampleCopy
claude mcp add --transport http <name> <url>Add a remote HTTP server.claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp add [options] <name> -- <command> [args...]Add a local stdio server; everything after -- runs the server.claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable -- npx -y airtable-mcp-server
claude mcp add --transport sse <name> <url>Add a server that only offers an SSE endpoint.claude mcp add --transport sse asana https://mcp.asana.com/sse
--scope local|project|userChoose where the server is saved (default local).claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic
claude mcp add-json <name> '<json>'Add a server from a JSON config object.claude mcp add-json example '{"command":"npx","args":["-y","@example/mcp-server"]}'
claude mcp listList servers with a health status (Connected, Needs authentication, Failed).
claude mcp get <name>Show one server’s details and any connection issue.claude mcp get notion
claude mcp remove <name>Remove a server.claude mcp remove notion
claude mcp login <name>Run a server’s OAuth flow without opening /mcp.
claude mcp add-from-claude-desktopImport servers configured in Claude Desktop.
claude mcp reset-project-choicesReset your approvals for project-scoped .mcp.json servers.
claude mcp serveRun Claude Code itself as a stdio MCP server for other apps.

Keyboard shortcuts

Last verified: against Claude Code v2.1.302 (October 16, 2026). 48 shortcuts.

Keyboard shortcuts in the Claude Code terminal

Most shortcuts are the same on every system and use Control, not Command, even on a Mac. The Option-key shortcuts on macOS (Option plus B, Option plus P...) need “Option as Meta” turned on in your terminal. You can rebind most actions in ~/.claude/keybindings.json (run /keybindings).

Showing all 48 shortcuts in 5 categories

General controls#

ActionmacOSWindows / LinuxCopy
Interrupt Claude or close a dialogStops the current response or tool call; work done so far is kept. On a permission prompt, Esc answers No.EscapeEscape
Clear the draft, or open the rewind menu (empty prompt)Escape then EscapeEscape then Escape
Interrupt; on an idle prompt clear it, press again to exitControl plus CControl plus C
Exit Claude Code (press twice)With text in the prompt, Ctrl+D deletes the character after the cursor instead.Control plus DControl plus D
Cycle permission modes (Manual, acceptEdits, plan, auto...)Shift plus TabShift plus Tabor Alt plus MAlt+M on Windows when the runtime doesn’t enable VT input mode.
Switch model without clearing the promptOption plus PmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).Alt plus P
Toggle extended thinkingNo effect on models that always think (Opus 5.5, Sonnet 5.5, Haiku 5.5, Fable).Option plus TAlt plus T
Toggle fast modeOption plus OAlt plus O
Edit the prompt in your text editorControl plus Gor Control plus X then Control plus EControl plus Gor Control plus X then Control plus E
Paste an image from the clipboardControl plus Vor Command plus VCmd+V in iTerm2.Control plus Vor Alt plus VAlt+V on Windows and WSL.
Previous / next prompt in historyIn a multi-row prompt the arrows move the cursor first.Up arrowor Down arrowor Control plus Por Control plus NUp arrowor Down arrowor Control plus Por Control plus N
Toggle the transcript viewer (tool calls in detail)Control plus OControl plus O
Send running Bash commands and agents to the backgroundIn tmux, press it twice.Control plus BControl plus B
Show or hide Claude’s to-do checklistControl plus TControl plus T
Stash the prompt (press again on an empty prompt to restore)Control plus SControl plus S
Send queued messages nowControl plus Enteror Control plus X then Control plus SControl plus Enteror Control plus X then Control plus S
Stop all background subagents (press twice within 3 s)Control plus X then Control plus KControl plus X then Control plus K
Redraw the screen (fix a garbled display)Control plus LControl plus L
Suspend Claude Code to the shell (run fg to resume)Control plus ZControl plus ZLinux only; Unix shells.
Accept an autocomplete suggestionTabTab
Show the shortcut help panel (empty prompt)question markquestion mark
Voice dictation: hold (or tap) SpaceOnly with /voice turned on.Space barSpace bar

Prompt text editing (readline style)#

ActionmacOSWindows / LinuxCopy
Move to the start of the lineControl plus AControl plus A
Move to the end of the lineControl plus EControl plus E
Delete to the end of the lineControl plus KControl plus K
Delete from the cursor to the line startControl plus Uor Command plus DeleteiTerm2 and Terminal.app send Ctrl+U for Cmd+Backspace.Control plus U
Delete back to the previous space (whole path or --flag)Control plus WControl plus W
Delete the previous wordOption plus DeleteControl plus BackspaceWindows.
Paste the text you last deletedControl plus YControl plus Y
Cycle through earlier deleted text (after Ctrl+Y)Option plus YmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).Alt plus Y
Move back one wordOption plus BmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).Alt plus B
Move forward one wordOption plus FmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).Alt plus F
Delete to the end of the wordOption plus DmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).Alt plus D
Undo the last edit to the promptControl plus underscoreor Control plus Shift plus hyphenControl plus underscoreor Control plus Shift plus hyphen

Multiline input#

ActionmacOSWindows / LinuxCopy
New line: type \ then press Enter (any terminal)backslash then Returnbackslash then Enter
New line with Shift+EnterWorks natively in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; /terminal-setup adds it to VS Code, Cursor, Alacritty and Zed.Shift plus ReturnShift plus Enter
New line with Ctrl+J (works without setup)Control plus JControl plus J
New line with Option+EnterOption plus ReturnmacOS: needs "Option as Meta" turned on in your terminal (see /terminal-setup or the docs).No default shortcut

Quick prefixes: /, !, @#

ActionmacOSWindows / LinuxCopy
Start a command or skillslashslash
Shell mode: run a command and add its outputexclamation pointexclamation point
Mention a file (path autocomplete)at signat sign
Emoji shortcode (:name:)coloncolon

Transcript viewer (Ctrl+O)#

ActionmacOSWindows / LinuxCopy
Leave the transcript viewerQor Control plus Cor EscapeQor Control plus Cor Escape
Show all content (classic renderer)Control plus EControl plus E
Jump to the previous / next prompt (fullscreen)left braceor right braceleft braceor right brace
Write the conversation to terminal scrollback (fullscreen)left bracketleft bracket
Open the conversation in $EDITOR (fullscreen)VV
Sources (1 official pages)

Everything runs in your browser; searches are not sent anywhere. Entries are checked against the official Claude Code documentation. Browse all free tools.

Found a problem, or something that could be better? We read every message and we fix things quickly.

This Claude Code cheat sheet puts the commands, keyboard shortcuts and CLI flags of Anthropic's coding agent on one searchable page: slash commands like /init, /compact, /context and /rewind, shortcuts like Shift+Tab to cycle permission modes and Esc twice to rewind, and flags like claude -p, --continue, --model and --permission-mode for scripts. It also lists where CLAUDE.md and settings files go, every hook event and the MCP commands, which are the things people most often have to look up mid-session.

Everything was checked on 2026-10-18 against the official documentation at code.claude.com, when the newest release was v2.1.302 (October 16, 2026). Claude Code ships several releases a week, so commands get added, renamed and occasionally removed; removed ones are marked rather than silently dropped. Type / in a session or run claude --help for what your installed version supports, and see the linked docs for the full option lists.

How to use

  1. Search the reference tables for a command, flag, file or hook event ("resume", "--model", "PreToolUse").
  2. Use the table links to jump to slash commands, CLI flags, memory files, settings, hooks or MCP.
  3. Click Copy to copy a command or flag; the # next to each heading or row links straight to it.
  4. Scroll down to the keyboard shortcuts, with macOS and Windows/Linux columns and their own search.
  5. Press "Print / Save as PDF" for a two-column printout.

Frequently asked questions

What are the most useful Claude Code slash commands?

/init creates a CLAUDE.md for the project, /clear starts fresh, /compact summarizes a long conversation to free context, and /context shows what is using the context window. /model switches models, /resume reopens an earlier conversation, /rewind rolls code and conversation back to a checkpoint, and /permissions manages which tools run without asking. /mcp, /memory and /usage cover servers, CLAUDE.md files and cost.

What is the difference between /clear and /compact?

/clear starts a new conversation with empty context; the old one is kept and can be reopened with /resume. /compact keeps the same conversation but replaces the history with a summary, so Claude remembers what you were doing while using less context. You can pass instructions to /compact, such as what the summary should focus on.

How do I add a new line in the Claude Code prompt?

Type a backslash and press Enter, which works in every terminal. Ctrl+J also works everywhere. Shift+Enter works natively in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; run /terminal-setup to add it to VS Code, Cursor, Alacritty or Zed. On macOS, Option+Enter works once Option is set to act as Meta.

How do I continue or resume a previous Claude Code session?

Run claude -c (or --continue) to reopen the most recent conversation in the current directory, or claude -r with a session ID or name to resume a specific one. Inside a session, /resume opens a picker. Name sessions with claude -n or /rename so they are easy to find later.

Where do CLAUDE.md and settings.json go?

Personal instructions for every project go in ~/.claude/CLAUDE.md; project instructions shared with the team go in ./CLAUDE.md or ./.claude/CLAUDE.md, and private project notes in ./CLAUDE.local.md. Settings follow the same pattern: ~/.claude/settings.json for you, .claude/settings.json for the team, .claude/settings.local.json for your private overrides. Managed settings from an organization take precedence over all of them.

How do I stop Claude Code asking for permission every time?

Press Shift+Tab to cycle permission modes: acceptEdits lets Claude edit files without asking, and auto runs everything with background safety checks. Use /permissions or --allowedTools to pre-approve specific tools, such as Bash(git diff *). --dangerously-skip-permissions (bypassPermissions mode) turns all checks off and is meant only for isolated containers or VMs.

Print mode: Claude Code in scripts and CI

claude -p "prompt" runs one task and prints the answer without the interactive interface, which is what you want in shell scripts, git hooks and CI. You can pipe input in (cat error.log | claude -p "explain this") and combine it with flags that only make sense there:

• --output-format json or stream-json for machine-readable output; --json-schema for validated structured output

• --max-turns and --max-budget-usd to cap how long it runs and how much it spends

• --allowedTools / --disallowedTools or --permission-mode dontAsk so it never waits for a prompt nobody will answer

• --bare to skip loading hooks, plugins, MCP servers and CLAUDE.md for faster, predictable runs

• -c or --resume to continue an earlier print-mode conversation

Hooks in one minute

Hooks are commands Claude Code runs at fixed points: PreToolUse before a tool call, PostToolUse after one, Stop when Claude finishes, Notification when it needs you, SessionStart when a session begins, and about 30 events in all (listed above). They live under the "hooks" key of a settings file, grouped by event, with an optional matcher such as "Bash" or "Edit|Write".

A PostToolUse hook on Edit that runs your formatter keeps every file Claude touches formatted. A PreToolUse hook on Bash can inspect the command and exit with code 2 to block it; whatever the script prints to stderr is shown to Claude as the reason. Run /hooks to see which hooks are active.

How this sheet stays current

Claude Code's command set changes quickly: /vim, /pr-comments and /ultraplan have all been removed in recent versions, and new commands arrive most weeks. Every entry here comes from the official docs on the date shown at the top, summarized in plain words, and the page links each source table.

If a command here doesn't exist in your session, check your version with claude -v and update with claude update. If one exists that isn't listed, it is probably newer than the last check or is a skill, plugin or MCP command specific to your setup; /help and the / menu always show what your installation supports.

Related free tools

  • MCP Config Generator — Define an MCP server once and get the exact config file or command for Claude Desktop, Claude Code, Cursor, VS Code, Windsurf and Codex.
  • Token Counter — Count tokens exactly for OpenAI models, estimate them for Claude, Gemini and Llama, see the cost, and watch the text split into tokens.
  • LLM API Cost Calculator — Compare the cost of your workload across 40+ models, with caching, batch discounts, long-context tiers and reasoning tokens. Prices sourced and dated.
  • VS Code Shortcuts — Every default Visual Studio Code shortcut for Windows and Mac, with Linux differences: multi-cursor, search, refactoring, terminal.
  • Git Cheat Sheet — Git commands organised by what you want to do: undo the last commit, rename a branch, delete a remote branch. Modern switch/restore with classic equivalents and danger badges.