Keep this page bookmarked. Everything you need to use Claude Code efficiently, organized for quick lookup.
Keyboard Shortcuts
Essential Shortcuts
| Shortcut | Action |
|---|
Escape | Cancel current generation |
Ctrl+C | Interrupt Claude / Exit |
Ctrl+L | Clear screen |
Up/Down | Navigate command history |
Tab | Autocomplete commands |
Shift+Enter | Multi-line input |
macOS Specific
| Shortcut | Action |
|---|
Opt+P | Switch model |
Cmd+K | Clear conversation |
Windows/Linux Specific
| Shortcut | Action |
|---|
Alt+P | Switch model |
Ctrl+K | Clear conversation |
Slash Commands
Built-in Commands
| Command | Description |
|---|
/help | Show all available commands |
/clear | Clear conversation history |
/compact | Compact conversation (reduce tokens) |
/init | Initialize CLAUDE.md for project |
/model | Show or change current model |
/memory | Show memory status |
/cost | Show session cost |
/doctor | Diagnose configuration issues |
/config | Open configuration |
/bug | Report a bug |
File Commands
| Command | Description |
|---|
/add <path> | Add file to context |
/add-dir <path> | Add directory to context |
Review & Version Control
| Command | Description |
|---|
/review | Review staged changes |
/pr-comments | Review PR comments |
CLI Flags
Starting Claude Code
# Basic
claude # Start interactive session
claude "prompt" # Run single prompt
claude -c # Continue last session
claude --resume # Resume from specific session
# Model Selection
claude --model sonnet # Use Claude Sonnet
claude --model opus # Use Claude Opus
claude --model haiku # Use Claude Haiku
# Output Control
claude -p "prompt" # Print mode (no interactive)
claude --output-format json # JSON output
claude --verbose # Verbose logging
claude --quiet # Minimal output
# Session Management
claude --no-memory # Disable memory for session
claude --dangerously-skip-permissions # Skip all permission prompts
MCP Management
# List and manage MCP servers
claude mcp list # List all MCP servers
claude mcp add <name> <command> # Add MCP server
claude mcp remove <name> # Remove MCP server
claude mcp reset-project-choices # Reset MCP permissions
# Scoped MCP
claude mcp add --scope project <name> <command>
claude mcp add --scope user <name> <command>
Configuration
# Settings
claude config list # Show all settings
claude config set <key> # Set configuration
claude config get <key> # Get configuration value
# Login/Auth
claude login # Authenticate
claude logout # Log out
Common File Patterns
@ References
# In prompts or CLAUDE.md
See @README.md for project overview.
Check @src/lib/auth.ts for auth utilities.
Reference @package.json for dependencies.
CLAUDE.md Templates
# Minimal CLAUDE.md
## Project
[Brief description]
## Commands
- npm run dev
- npm test
## Standards
- TypeScript strict mode
- Tests required for features
# Full CLAUDE.md
## Overview
[Project description]
## Tech Stack
- [Framework]
- [Language]
- [Database]
## Directory Structure
src/
├── [folder]/ # [purpose]
└── [folder]/ # [purpose]
## Commands
- [command] - [description]
## Autonomous Operations
- [allowed actions]
## Requires Confirmation
- [restricted actions]
Permission Patterns
settings.json
{
"permissions": {
"allow": [
"Read",
"Write",
"Edit",
"Bash(npm:*)",
"Bash(git:*)"
],
"deny": [
"Read(.env*)",
"Write(.env*)",
"Bash(rm -rf:*)"
]
}
}
Pattern Syntax
| Pattern | Matches |
|---|
Read | All read operations |
Write(src/**) | Write in src/ and subdirs |
Bash(npm:*) | All npm commands |
Bash(git diff:*) | git diff with any args |
Read(.env*) | Any .env file |
Model Comparison
| Model | Best For | Speed | Context |
|---|
| Opus 4.5 | Complex reasoning, critical tasks | Slower | 200K |
| Sonnet 4.5 | General coding, balanced | Fast | 200K |
| Haiku 4.5 | Quick tasks, exploration | Fastest | 200K |
When to Use Each
- Opus: Architecture decisions, security reviews, complex refactoring
- Sonnet: Day-to-day development, feature implementation
- Haiku: Quick questions, file exploration, simple edits
Memory System
Memory Files
| Location | Scope | Use Case |
|---|
~/.claude/CLAUDE.md | Global | Personal preferences |
./CLAUDE.md | Project | Team standards |
./.claude/CLAUDE.md | Project | Team standards (hidden) |
./CLAUDE.local.md | Personal | Individual overrides |
Priority Order
1. CLAUDE.local.md (highest)
2. ./CLAUDE.md
3. ~/.claude/CLAUDE.md (lowest)
Common Workflows
Start New Feature
claude
> Implement [feature description]
> Follow TDD - write tests first
Debug Issue
claude
> Debug: [error message]
> Check logs at [path]
Code Review
claude
> Review changes in [files]
> Focus on: security, performance, maintainability
Refactor
claude
> Refactor [component] to [pattern]
> Maintain backward compatibility
Troubleshooting Quick Fixes
| Problem | Solution |
|---|
| CLAUDE.md ignored | Check file location (./CLAUDE.md or ./.claude/CLAUDE.md) |
| MCP not loading | claude mcp reset-project-choices |
| Permission denied | Add to settings.json allow list |
| High token usage | Use /compact or start new session |
| Wrong model | Option+P (Mac) or Alt+P (Win/Linux) |
| Config not applied | Restart Claude Code |
Environment Variables
# API Configuration
ANTHROPIC_API_KEY=sk-...
# Proxy (if needed)
HTTP_PROXY=http://...
HTTPS_PROXY=https://...
# Debug
CLAUDE_CODE_DEBUG=1
Print-Friendly Summary
CLAUDE CODE QUICK REFERENCE
===========================
SHORTCUTS
---------
Escape Cancel generation
Ctrl+C Interrupt / Exit
Ctrl+L Clear screen
Opt/Alt+P Switch model
COMMANDS
--------
/help Show commands
/clear Clear history
/init Create CLAUDE.md
/doctor Diagnose issues
CLI
---
claude Start session
claude "prompt" Single prompt
claude -c Continue session
claude --model X Use model X
FILES
-----
./CLAUDE.md Project config
~/.claude/CLAUDE.md Global config
CLAUDE.local.md Personal overrides
.claude/settings.json Permissions
MCP
---
claude mcp list Show servers
claude mcp add Add server
claude mcp remove Remove server
Bookmark this page and keep it handy. You’ll reference it more than you think.
Sources: Claude Code Documentation, Claude Code GitHub