Cheatsheets
Claude Code
55 entries
Claude Code
Claude Code CLI commands, keyboard shortcuts, slash commands, and configuration reference
55 commands
CommandDescriptionExample
npm install -g @anthropic-ai/claude-code
Install Claude Code globally via npm (requires Node.js 18+)
npm install -g @anthropic-ai/claude-codebrew install --cask claude-code
Install Claude Code via Homebrew on macOS
brew install --cask claude-codeclaude
Start Claude Code in the current project directory
cd your-project && claudeclaude update
Update Claude Code to the latest version
claude update! (prefix)
Enter bash mode to run a shell command directly
! git status@ (prefix)
Mention and attach a file or folder to the conversation
@src/components/Button.tsx\ + Enter
Insert a line break without submitting the prompt
\ + EnterEsc
Interrupt Claude mid-response
EscEsc + Esc
Open the rewind menu to restore prior conversation or code state
Esc + EscCtrl+R
View full output and context
Ctrl+RCtrl+V
Paste an image into the conversation
Ctrl+VShift+Tab
Auto-accept mode (yolo mode) — accept all changes automatically
Shift+TabShift+Tab+Tab
Enter plan mode — Claude plans before acting
Shift+Tab+TabCmd+Esc / Ctrl+Esc
Quick launch Claude Code from an IDE
Cmd+Esc/clear
Clear the current conversation history
/clear/compact
Condense the conversation to save context space
/compact/init
Initialize the project with a CLAUDE.md instructions file
/init/memory
Edit the CLAUDE.md memory/instructions file
/memory/model
Select the AI model to use (Opus, Sonnet, Haiku)
/model/review
Request a code review from Claude
/review/rewind
Open the rewind menu to restore prior state
/rewind/cost
Display token usage and cost statistics for the session
/cost/mcp
Manage MCP (Model Context Protocol) servers
/mcp/permissions
View or update tool permissions
/permissions/doctor
Check Claude Code installation health
/doctor/status
Show account and system status
/status/vim
Enter vim editing mode
/vim/add-dir <path>
Add an additional working directory
/add-dir ../shared-lib/pr_comments
View pull request comments in the current branch
/pr_commentsclaude -p "query"
Run Claude non-interactively (headless/print mode)
claude -p "summarize this file" < README.mdclaude --output-format json
Output structured JSON with metadata instead of plain text
claude -p --output-format json "list all TODOs"claude --output-format stream-json
Stream JSON messages as they are generated
claude -p --output-format stream-json "explain this"claude --max-turns <n>
Limit the number of agentic iterations in headless mode
claude -p --max-turns 3 "fix the lint errors"claude --resume <id>
Resume a specific previous session by ID
claude --resume abc123claude -c
Continue the most recent conversation
claude -cclaude --verbose
Enable verbose debug logging
claude --verboseclaude config list
Display all current configuration settings
claude config listclaude config get <key>
Check the value of a specific configuration setting
claude config get modelclaude config set <key> <value>
Modify a configuration setting
claude config set model claude-sonnet-4-6~/.claude/settings.json
User-global settings file (lowest priority)
~/.claude/settings.json.claude/settings.json
Project-level team settings file
.claude/settings.json.claude/settings.local.json
Project-local settings (git-ignored, personal overrides)
.claude/settings.local.jsonPreToolUse hook
Automation hook that fires before any tool call
"PreToolUse": [{"matcher": "Edit", "hooks": [...]}]PostToolUse hook
Automation hook that fires after a tool call completes
"PostToolUse": [{"matcher": "Edit|Write", "hooks": [...]}]UserPromptSubmit hook
Automation hook that fires when the user submits a prompt
"UserPromptSubmit": [{"hooks": [...]}]Stop hook
Automation hook that fires when the session ends
"Stop": [{"hooks": [...]}]SessionStart hook
Automation hook that fires when a new session begins
"SessionStart": [{"hooks": [...]}]claude mcp add <name> <command>
Add an MCP server with stdio transport
claude mcp add my-server npx my-mcp-serverclaude mcp add --transport sse <name> <url>
Add an MCP server with SSE transport
claude mcp add --transport sse my-api https://api.example.com/mcpclaude mcp list
List all installed MCP servers
claude mcp listclaude mcp remove <name>
Remove an MCP server
claude mcp remove my-servergit worktree add <path> -b <branch>
Create a new git worktree with a new branch for parallel Claude sessions
git worktree add ../feature-auth -b feature/auth maingit worktree list
Show all active git worktrees
git worktree listgit worktree remove <path>
Delete a git worktree
git worktree remove ../feature-authgit worktree prune
Clean up stale worktree references
git worktree prune