Claude Academy
Reference

Claude Code Cheatsheet

Every command, shortcut, configuration option, and syntax pattern in one searchable reference. 96 items across 12 categories.

Core CLI Commands

11
claudeStart an interactive REPL session
claude -p "prompt"Run a one-shot prompt without interactive mode
claude -cContinue the most recent conversation
claude -r idResume a specific conversation by session ID
claude -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 version
claude doctorRun diagnostics to check your setup
claude mcp add nameAdd a new MCP server by name
claude mcp listList all configured MCP servers
claude mcp remove nameRemove an MCP server

CLI 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 URL

Essential 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 commands

Keyboard Shortcuts

9
Ctrl + CCancel current generation or tool execution
Ctrl + DExit the REPL / end session
TabAutocomplete file paths and commands
Alt + TToggle tool output visibility
Ctrl + OOpen a file in your editor from the session
Esc EscDouble-tap Escape to cancel and edit your last message
Shift + EnterInsert a newline in multi-line input
Ctrl + BBackground the current session
Shift + Up/DownScroll through message history

CLAUDE.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 below
Auto-memory (~/.claude/user_memory.md)Claude learns preferences over time and saves them here

Configuration 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 tweaks

Hook Events

11
PreToolUseFires before Claude runs any tool — validate, block, or modify
PostToolUseFires after a tool completes — transform output, trigger side effects
UserPromptSubmitFires when the user sends a message — preprocess, validate input
SessionStartFires when a new session begins — setup environment, load context
NotificationFires when Claude sends a notification — route to Slack, email, etc.
TeammateIdleFires when an agent teammate goes idle — reassign work, alert user
TaskCompletedFires when an agent finishes a task — log results, chain next task
ElicitationFires when Claude asks the user a question — auto-answer, log
ElicitationResultFires when the user responds to an elicitation
WorktreeCreateFires when a git worktree is created — setup hooks, install deps
WorktreeRemoveFires when a git worktree is removed — cleanup

MCP Transports

5
stdioLocal process communication — best for local tools and scripts
HTTP (Streamable HTTP)Remote server — for cloud-hosted MCP servers
SSE (Server-Sent Events)Legacy streaming transport — still supported but prefer HTTP
Scope: user (~/.claude/)User-scoped MCP server — available in all your projects
Scope: project (.claude/)Project-scoped MCP server — shared with team

Effort Levels

5
lowQuick answers, minimal reasoning — for simple lookups and yes/no questions
mediumBalanced — default level, good for most tasks
highThorough reasoning — for complex code reviews, architecture decisions
maxMaximum reasoning depth — for the hardest problems, multi-step analysis
ultrathinkKeyword in prompt to trigger extended thinking budget beyond max

Environment Variables

5
ANTHROPIC_API_KEYYour API key — required for direct API usage
ENABLE_LSP_TOOLEnable the LSP (Language Server Protocol) tool for code intelligence
MAX_THINKING_TOKENSOverride the maximum tokens allocated to extended thinking
CLAUDE_CODE_EFFORT_LEVELSet default effort level via environment variable
ENABLE_SESSION_BACKGROUNDINGAllow backgrounding sessions with Ctrl+B

Permission Patterns

8
ReadAllow reading all files
Read(src/**)Allow reading only files under src/
WriteAllow writing to all files
Write(src/**)Allow writing only to files under src/
Bash(git *)Allow git commands only
Bash(npm test)Allow only npm test command
mcp__*Allow all MCP tools
mcp__server__toolAllow a specific MCP server tool

In-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