Reference
Claude Code Cheatsheet
Every command, shortcut, configuration option, and syntax pattern in one searchable reference. 96 items across 12 categories.
Core CLI Commands
11claudeStart an interactive REPL sessionclaude -p "prompt"Run a one-shot prompt without interactive modeclaude -cContinue the most recent conversationclaude -r idResume a specific conversation by session IDclaude -wStart a session in a new git worktree (parallel work)claude -nStart a new session explicitly (no resume prompt)claude updateUpdate Claude Code to the latest versionclaude doctorRun diagnostics to check your setupclaude mcp add nameAdd a new MCP server by nameclaude mcp listList all configured MCP serversclaude mcp remove nameRemove an MCP serverCLI Flags
11--model <name>Override the default model (e.g. claude-sonnet-4-20250514)--effort <level>Set reasoning effort: low, medium, high, or max--continueContinue the most recent conversation--resume <id>Resume a specific conversation by session ID--worktreeCreate a git worktree for parallel work--max-turns <n>Limit the number of agentic turns in non-interactive mode--output-format jsonOutput as JSON (for scripting/piping)--verboseEnable verbose logging output--add-dir <path>Add additional directory context--allowedTools <tools>Restrict available tools (comma-separated list)--from-pr <url>Start a session from a GitHub PR URLEssential Slash Commands
18/clearClear conversation history and start fresh/compactSummarize and compact the conversation context/contextShow the current context window usage/model <name>Switch to a different model mid-session/effort <level>Change reasoning effort level/planEnter plan mode — Claude drafts a plan before acting/executeExecute the current plan/forkFork the conversation into a parallel branch/rewindGo back to a previous message in the conversation/resumeList and resume a previous conversation/batchRun a prompt across multiple files/simplifyReview changed code for reuse, quality, and efficiency/loop <interval> <cmd>Run a slash command on a recurring interval/voiceToggle voice input mode/mcpManage MCP servers in-session/hooksView and manage lifecycle hooks/configView or modify configuration/helpShow all available commandsKeyboard Shortcuts
9Ctrl + CCancel current generation or tool executionCtrl + DExit the REPL / end sessionTabAutocomplete file paths and commandsAlt + TToggle tool output visibilityCtrl + OOpen a file in your editor from the sessionEsc EscDouble-tap Escape to cancel and edit your last messageShift + EnterInsert a newline in multi-line inputCtrl + BBackground the current sessionShift + Up/DownScroll through message historyCLAUDE.md Locations
5~/.claude/CLAUDE.mdUser-level — applies to all your sessions everywhere./CLAUDE.mdProject root — shared with the team via git./.claude/CLAUDE.mdProject root (hidden) — alternative location./src/CLAUDE.mdSubdirectory — scoped rules for that folder and belowAuto-memory (~/.claude/user_memory.md)Claude learns preferences over time and saves them hereConfiguration Files
3~/.claude/settings.jsonUser-level settings — permissions, model prefs, global tool config.claude/settings.jsonProject-level settings — shared with the team (committed).claude/settings.local.jsonProject-level local overrides — gitignored, personal tweaksHook Events
11PreToolUseFires before Claude runs any tool — validate, block, or modifyPostToolUseFires after a tool completes — transform output, trigger side effectsUserPromptSubmitFires when the user sends a message — preprocess, validate inputSessionStartFires when a new session begins — setup environment, load contextNotificationFires when Claude sends a notification — route to Slack, email, etc.TeammateIdleFires when an agent teammate goes idle — reassign work, alert userTaskCompletedFires when an agent finishes a task — log results, chain next taskElicitationFires when Claude asks the user a question — auto-answer, logElicitationResultFires when the user responds to an elicitationWorktreeCreateFires when a git worktree is created — setup hooks, install depsWorktreeRemoveFires when a git worktree is removed — cleanupMCP Transports
5stdioLocal process communication — best for local tools and scriptsHTTP (Streamable HTTP)Remote server — for cloud-hosted MCP serversSSE (Server-Sent Events)Legacy streaming transport — still supported but prefer HTTPScope: user (~/.claude/)User-scoped MCP server — available in all your projectsScope: project (.claude/)Project-scoped MCP server — shared with teamEffort Levels
5lowQuick answers, minimal reasoning — for simple lookups and yes/no questionsmediumBalanced — default level, good for most taskshighThorough reasoning — for complex code reviews, architecture decisionsmaxMaximum reasoning depth — for the hardest problems, multi-step analysisultrathinkKeyword in prompt to trigger extended thinking budget beyond maxEnvironment Variables
5ANTHROPIC_API_KEYYour API key — required for direct API usageENABLE_LSP_TOOLEnable the LSP (Language Server Protocol) tool for code intelligenceMAX_THINKING_TOKENSOverride the maximum tokens allocated to extended thinkingCLAUDE_CODE_EFFORT_LEVELSet default effort level via environment variableENABLE_SESSION_BACKGROUNDINGAllow backgrounding sessions with Ctrl+BPermission Patterns
8ReadAllow reading all filesRead(src/**)Allow reading only files under src/WriteAllow writing to all filesWrite(src/**)Allow writing only to files under src/Bash(git *)Allow git commands onlyBash(npm test)Allow only npm test commandmcp__*Allow all MCP toolsmcp__server__toolAllow a specific MCP server toolIn-Session Syntax
5@file.tsReference a specific file — adds it to context@src/components/Reference a directory — adds file listing to context@**/*.test.tsReference files via glob pattern!npm testRun a shell command and include its output in context@agent-nameMention a teammate agent by name in multi-agent setup