Skip to main content
Reference

Claude Code cheatsheet

Quick reference card for Claude Code: all commands, shortcuts, and tips in one page.

Slash commands

Type these commands directly in the Claude Code prompt (interactive session).

CommandDescription
/helpShow help and list available commands
/clearClear the current conversation history
/compactCompress context (automatic summary of previous exchanges)
/costShow the token cost of the current session
/doctorSystem diagnostics: network, MCP, permissions, version
/initGenerate a CLAUDE.md file in the current directory
/reviewRequest a code review on modified files
/memoryView or edit persistent memory (active CLAUDE.md file)
/modelView or change the current model (haiku, sonnet, opus)
/permissionsView and manage permissions granted to tools
/bugOpen a bug report to Anthropic
/configShow the active configuration (merged settings.json)
/loginAuthenticate via browser (Claude.ai Max)
/logoutLog out from your Claude.ai account
/statusShow account status, quotas, and connected MCPs
/mcpManage MCPs: list, enable, disable
/install-githubInstall the official GitHub MCP
/terminal-setupConfigure terminal integration (shell hooks)
/vimEnable vi/vim input mode in the terminal
/resumeResume the last interrupted session

Slash command autocompletion

In an interactive session, type / then press Tab to see all available commands with a short description.


Keyboard shortcuts

ShortcutAction
EscapeCancel the current generation (without quitting)
Ctrl+CInterrupt generation or exit the current prompt
Ctrl+DQuit Claude Code cleanly
Ctrl+LClear the terminal display (not the context)
Shift+TabInsert a line break in the prompt (multiline)
Alt+T / Option+TToggle Extended Thinking on/off
Ctrl+OShow reasoning details (verbose thinking)
Up ArrowRecall the previous command from history
Down ArrowMove forward through command history
TabAutocompletion (files, slash commands)

OS-specific shortcuts

Alt+T works on Windows/Linux. Option+T is the macOS equivalent. Both toggle Extended Thinking on or off.


Configuration files

Files are read in this order, from highest to lowest priority.

FileScopeDescription
.claude/settings.jsonProjectProject-local configuration (committed or not)
.claude/settings.local.jsonProject (local)Local overrides, not committed (gitignored)
~/.claude/settings.jsonUserGlobal configuration for all projects
CLAUDE.mdProjectNatural language instructions read at startup
.claude/CLAUDE.mdProject (hidden)Alternative variant of the CLAUDE.md file
~/.claude/CLAUDE.mdGlobalGlobal instructions applied to all projects
.claude/agents/Project.md files defining custom agents
~/.claude/agents/GlobalGlobal agents available across all projects
.claude/skills/ProjectCustom Skills (slash commands) for the project
~/.claude/skills/GlobalGlobal Skills available everywhere

3 execution modes

Interactive mode (default)

# Launch an interactive REPL session
claude
# Launch with a specific model
claude --model claude-sonnet-4-5

Used for day-to-day development. Claude maintains context between exchanges.

Print mode (--print / -p)

# Execute a task, display the result, then quit
claude --print "Explain what this file does"
# Short alias
claude -p "Summarize the contents of README.md"
# With JSON format
claude --print --output-format json "List the functions in src/utils.ts"
# Pipe mode (stdin -> stdout)
echo "Fix the typos in this text" | claude --print
cat file.ts | claude --print "Add JSDoc comments"

Headless / SDK mode

# For automation and CI/CD
claude --print --max-turns 1 --output-format stream-json "prompt"
# Environment variables for non-interactive mode
ANTHROPIC_API_KEY=sk-ant-... claude --print "prompt"

MCP commands

CommandDescription
claude mcp add <name> -- <cmd> <args>Add an MCP via stdio (global scope by default)
claude mcp add --scope project <name> -- <cmd>Add an MCP at project scope
claude mcp add --transport sse <name> <url>Add an MCP via SSE transport
claude mcp remove <name>Remove a configured MCP
claude mcp listList all configured MCPs with their status
claude mcp logs <name>Show logs for a specific MCP
claude mcp get <name>Show detailed configuration for an MCP
# Practical examples
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/projects
claude mcp add github -- npx -y @modelcontextprotocol/server-github
claude mcp add --scope project postgres -- npx -y @modelcontextprotocol/server-postgres $DATABASE_URL
claude mcp list
claude mcp logs github

Global vs project scope

The global scope (default) configures the MCP in ~/.claude/settings.json. The project scope adds it to .claude/settings.json in the current directory. Prefer project for sensitive access tokens.


claude config commands

CommandDescription
claude config listList all active configuration options
claude config get <key>Show the value of an option
claude config set <key> <value>Set a configuration option
claude config add <key> <value>Add a value to a list
claude config remove <key> <value>Remove a value from a list
# Examples
claude config set model claude-sonnet-4-5
claude config get model
claude config list

Next steps