A cheat-sheet is a concise summary of important information meant to be used as a quick reference. In the context of Claude Code, this cheatsheet covers all commonly used keyboard shortcuts, slash commands, CLI flags, MCP server management, agent frontmatter, environment variables, and productivity workflows โ so you can move fast without digging through docs.
๐ Table of Contents
- โจ๏ธ Keyboard Shortcuts
- โก Session Slash Commands
- ๐ง Config Slash Commands
- ๐ฅ๏ธ CLI Commands & Flags
- ๐ Memory & Files
- ๐ MCP Servers
- ๐ค Skills & Agents
- โ๏ธ Environment Variables
- ๐ Permission Modes
- ๐ง Workflows & Pro Tips
- ๐ฃ Community
- ๐ References
Keyboard Shortcuts
General Controls
| Shortcut | Description |
|---|---|
Ctrl C | Cancel current input or generation |
Ctrl D | Exit the Claude Code session |
Ctrl L | Clear the screen |
Ctrl O | Toggle verbose output (see thinking) |
Ctrl R | Reverse search through history |
Ctrl G | Open current prompt in external editor |
Ctrl X Ctrl E NEW | Open in editor (alias for Ctrl G) |
Ctrl B | Background the running task |
Ctrl T | Toggle the task list |
Ctrl V | Paste an image into the prompt |
Ctrl X Ctrl K NEW | Kill all background agents |
Esc Esc | Rewind / undo last action |
General Controls
Mode Switching & Input
| Shortcut | Description |
|---|---|
Shift Tab | Cycle through permission modes (Normal โ Auto-Accept โ Plan) |
Alt P | Switch the active model |
Alt T | Toggle thinking on / off |
\ Enter | Insert a newline (quick method) |
Ctrl J | Insert a newline (control sequence) |
/ | Start a slash command |
! | Run a direct bash command |
@ | Mention a file with autocomplete |
Mode Switching & Input Prefixes
Session Slash Commands
| Command | Description |
|---|---|
/clear | Clear the current conversation |
/compact [focus] | Compress context window with optional focus hint |
/resume | Resume or switch to a previous session |
/rename [name] | Name the current session |
/branch [name] | Branch the conversation (alias: /fork) |
/cost | Show token usage and cost statistics |
/context | Visualize context usage (grid view) |
/diff | Open interactive diff viewer |
/copy [N] | Copy the last (or Nth) response to clipboard |
/rewind | Rewind conversation / restore code checkpoint |
/export | Export the full conversation |
/btw <question> | Ask a side question without consuming context |
/plan [desc] | Enter plan mode (+ optional auto-start) |
/loop [interval] | Schedule a recurring task |
/voice | Enable push-to-talk voice input (20 languages) |
/remote-control NEW | Bridge session to claude.ai/code (alias: /rc) |
/pr-comments [PR] | Fetch GitHub PR comments into context |
/security-review | Run a security analysis of recent changes |
/insights | Analyze session history and generate a report |
/desktop | Continue the session in the Desktop app |
/doctor | Diagnose installation issues |
/feedback | Submit feedback or bug report (alias: /bug) |
Session Slash Commands
Config Slash Commands
| Command | Description |
|---|---|
/config | Open the settings UI |
/model [model] | Switch the active model (use โ โ to adjust effort) |
/effort [level] NEW | Set effort level: low / med / high / max / auto |
/fast [on|off] | Toggle fast mode |
/vim | Toggle vim keybindings |
/theme | Change the color theme |
/permissions | View and update tool permissions |
/color [color] | Set the prompt bar color |
/keybindings | Customize keyboard shortcuts |
/terminal-setup | Configure terminal keybindings |
/init | Create a CLAUDE.md file for the project |
/memory | Edit CLAUDE.md memory files |
/mcp | Manage MCP servers (interactive UI) |
/hooks | Manage hooks |
/skills | List available skills |
/agents | Manage agents |
/add-dir <path> | Add an additional working directory |
/reload-plugins | Hot-reload plugins without restarting |
/usage | Show plan limits and rate status |
/schedule | Manage cloud scheduled tasks |
Config & Tool Slash Commands
CLI Commands & Flags
Core Commands
| Command | Description |
|---|---|
claude | Start an interactive session |
claude "query" | Start a session with an initial prompt |
claude -p "query" | Headless / non-interactive mode |
claude -c | Continue the last conversation |
claude -r "name" | Resume a named session |
claude update | Update Claude Code to the latest version |
cat file | claude -p | Pipe file content as input (headless) |
Core CLI Commands
Key Flags
| Flag | Description |
|---|---|
--model | Set the model to use |
--worktree / -w | Run in a git worktree |
--name / -n | Name the session |
--add-dir | Add an additional working directory |
--agent | Use a specific agent |
--allowedTools | Pre-approve a list of tools |
--output-format json | Return structured JSON output |
--json-schema | Constrain output to a JSON schema |
--max-turns | Limit the number of agentic turns |
--max-budget-usd | Set a cost cap for the session |
--effort | Set effort: low / med / high / max |
--permission-mode | Set permission mode at startup |
--verbose | Enable verbose output |
--bare NEW | Minimal headless mode (no hooks / LSP) |
--remote | Open as a web session on claude.ai |
--channels NEW | Permission relay / MCP push |
--console | Authenticate via Anthropic Console |
--dangerously-skip-permissions | โ ๏ธ Skip all permission prompts |
Key CLI Flags
Memory & Files
CLAUDE.md Locations
| Path | Scope |
|---|---|
./CLAUDE.md | Project โ team-shared, checked into VCS |
~/.claude/CLAUDE.md | Personal โ applies to all projects |
/etc/claude-code/ | Managed โ org-wide policy |
CLAUDE.md Locations
Rules & Import
| Path / Syntax | Description |
|---|---|
.claude/rules/*.md | Project-level rules (loaded automatically) |
~/.claude/rules/*.md | User-level rules (loaded globally) |
paths: frontmatter | Apply rules only to matching file paths |
@path/to/file | Import another file inside CLAUDE.md |
~/.claude/projects/<proj>/memory/ | Auto-loaded MEMORY.md + topic files |
Rules & Auto Memory
/compact. Put your most important project context here.
MCP Servers
Add Servers (–transport)
| Transport | Description |
|---|---|
--transport http | Remote HTTP server (recommended for production) |
--transport stdio | Local process over stdin/stdout |
--transport sse | Remote Server-Sent Events stream |
MCP Server Transports
Scopes & Config Files
| File | Scope |
|---|---|
.claude/settings.local.json | Local only โ not committed to VCS |
.mcp.json | Project โ shared via VCS |
~/.claude.json | User global โ OAuth, MCP state |
MCP Configuration Scopes
Management Commands
| Command | Description |
|---|---|
/mcp | Open the interactive MCP management UI |
claude mcp list | List all registered MCP servers |
claude mcp serve | Run Claude Code itself as an MCP server |
MCP Management
Skills & Agents
Built-in Skills
| Command | Description |
|---|---|
/simplify | Code review using 3 parallel agents |
/batch | Large parallel changes with 5โ30 git worktrees |
/debug [desc] | Troubleshoot issues from a debug log |
/loop [interval] | Schedule a recurring task |
/claude-api | Load the Anthropic API + SDK reference into context |
Built-in Skills
Built-in Agents
| Agent | Description |
|---|---|
Explore | Fast read-only agent (runs on Haiku for speed) |
Plan | Research-focused agent for plan mode |
General | Full tool access for complex multi-step tasks |
Bash | Terminal operations in a separate context |
Built-in Agents
Custom Skill Locations
| Path | Scope |
|---|---|
.claude/skills/<name>/ | Project-specific skills |
~/.claude/skills/<name>/ | Personal skills (all projects) |
Custom Skill Locations
Agent Frontmatter Keys
| Key | Description |
|---|---|
permissionMode: | default / acceptEdits / plan / dontAsk / bypass |
isolation: worktree | Run the agent in its own git worktree |
memory: user|project | Enable persistent memory across sessions |
background: true | Run as a background task |
maxTurns: | Limit the number of agentic turns |
model: | Override the model for this agent |
effort: NEW | Override effort level for this agent |
initialPrompt: NEW | Set the opening prompt for the agent |
SendMessage NEW | Resume agents (replaces the old resume key) |
Agent Frontmatter Keys
Skill Frontmatter
| Key | Description |
|---|---|
description: | Trigger phrase for auto-invocation |
allowed-tools: | Pre-approved tools (skip permission prompts) |
model: | Override the model for this skill |
effort: NEW | Override the effort level for this skill |
context: fork | Run the skill in a subagent context |
$ARGUMENTS | Placeholder for user-supplied input |
${CLAUDE_SKILL_DIR} | Reference the skill’s own directory |
!`cmd` | Dynamic context injection via shell command |
Skill Frontmatter
Environment Variables
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key |
ANTHROPIC_MODEL | Override the default model |
CLAUDE_CODE_EFFORT_LEVEL | Default effort: low / med / high |
MAX_THINKING_TOKENS | Max tokens for thinking; 0 = disabled |
ANTHROPIC_CUSTOM_MODEL_OPTION | Add a custom entry to the /model picker |
CLAUDE_CODE_MAX_OUTPUT_TOKENS | Override max output tokens (default 32K) |
CLAUDE_CODE_PLUGIN_SEED_DIR | Load plugins from multiple directories |
CLAUDECODE | Set to 1 to signal you are inside a CC shell |
IS_DEMO | Demo mode โ hides email and org info |
CLAUDE_CODE_DISABLE_CRON | Disable the built-in task scheduler |
Key Environment Variables
Config Files
| File | Scope |
|---|---|
~/.claude/settings.json | User settings (global) |
.claude/settings.json | Project settings (shared via VCS) |
.claude/settings.local.json | Local overrides (not committed) |
~/.claude.json | OAuth tokens, MCP state, session data |
.mcp.json | Project MCP server definitions |
Configuration Files
Permission Modes
| Mode | Description |
|---|---|
default | Prompts for approval before each action |
acceptEdits | Automatically accepts all file edits |
plan | Read-only โ agent can only plan, not execute |
dontAsk | Denies actions unless explicitly pre-allowed |
bypassPermissions | Skips all permission prompts |
--dangerously-skip-permissions | โ ๏ธ CLI flag to bypass all prompts |
Permission Modes
Shift Tab to cycle through Normal โ Auto-Accept โ Plan modes interactively during a session. Or start a session in a specific mode with --permission-mode plan.
Hook Events
| Event | Description |
|---|---|
CwdChanged NEW | Fires when the working directory changes |
FileChanged NEW | Fires when a file is modified by the agent |
New Hook Events in v2.1.83
Workflows & Pro Tips
Plan Mode
| Action | How |
|---|---|
| Enter plan mode interactively | Press Shift Tab twice |
| Start session in plan mode | claude --permission-mode plan |
| Max effort for one turn | Type ultrathink in your prompt |
Plan Mode Tips
Git Worktrees
| Command / Key | Description |
|---|---|
claude --worktree name | Start an isolated branch per feature |
isolation: worktree | Run an agent in its own worktree (frontmatter) |
sparsePaths NEW | Checkout only the directories you need |
/batch | Automatically creates and manages worktrees |
Git Worktree Workflow
Context Management
| Command / Feature | Description |
|---|---|
/context | View context usage and optimization tips |
/compact [focus] | Compress context; focus hint keeps important parts |
| Auto-compact | Triggers automatically at ~95% context capacity |
| 1M context window | Available on Claude Opus (Max / Team / Enterprise plans) |
| CLAUDE.md | Always survives compaction โ put key context here โ |
Context Management
SDK / Headless
| Command | Description |
|---|---|
claude -p "query" | Non-interactive single query |
--output-format json | Return structured JSON output |
--max-budget-usd 5 | Hard cost cap for the session |
cat file | claude -p | Pipe file content as stdin input |
/loop 5m msg | Run a recurring task every 5 minutes |
SDK & Headless Usage