Skip to main content
TellaDev
Cheatsheets Claude Code

55 entries

Claude Code

Claude Code CLI commands, keyboard shortcuts, slash commands, and configuration reference

55 commands

npm install -g @anthropic-ai/claude-code
Install Claude Code globally via npm (requires Node.js 18+)
npm install -g @anthropic-ai/claude-code
brew install --cask claude-code
Install Claude Code via Homebrew on macOS
brew install --cask claude-code
claude
Start Claude Code in the current project directory
cd your-project && claude
claude 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
\ + Enter
Esc
Interrupt Claude mid-response
Esc
Esc + Esc
Open the rewind menu to restore prior conversation or code state
Esc + Esc
Ctrl+R
View full output and context
Ctrl+R
Ctrl+V
Paste an image into the conversation
Ctrl+V
Shift+Tab
Auto-accept mode (yolo mode) — accept all changes automatically
Shift+Tab
Shift+Tab+Tab
Enter plan mode — Claude plans before acting
Shift+Tab+Tab
Cmd+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_comments
claude -p "query"
Run Claude non-interactively (headless/print mode)
claude -p "summarize this file" < README.md
claude --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 abc123
claude -c
Continue the most recent conversation
claude -c
claude --verbose
Enable verbose debug logging
claude --verbose
claude config list
Display all current configuration settings
claude config list
claude config get <key>
Check the value of a specific configuration setting
claude config get model
claude 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.json
PreToolUse 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-server
claude mcp add --transport sse <name> <url>
Add an MCP server with SSE transport
claude mcp add --transport sse my-api https://api.example.com/mcp
claude mcp list
List all installed MCP servers
claude mcp list
claude mcp remove <name>
Remove an MCP server
claude mcp remove my-server
git 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 main
git worktree list
Show all active git worktrees
git worktree list
git worktree remove <path>
Delete a git worktree
git worktree remove ../feature-auth
git worktree prune
Clean up stale worktree references
git worktree prune