Join our Discord Server

Claude Code Cheatsheet

Claude Code Cheatsheet [2026 Updated] – Collabnix

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

General Controls

ShortcutDescription
Ctrl CCancel current input or generation
Ctrl DExit the Claude Code session
Ctrl LClear the screen
Ctrl OToggle verbose output (see thinking)
Ctrl RReverse search through history
Ctrl GOpen current prompt in external editor
Ctrl X Ctrl E NEWOpen in editor (alias for Ctrl G)
Ctrl BBackground the running task
Ctrl TToggle the task list
Ctrl VPaste an image into the prompt
Ctrl X Ctrl K NEWKill all background agents
Esc EscRewind / undo last action

General Controls

Mode Switching & Input

ShortcutDescription
Shift TabCycle through permission modes (Normal โ†’ Auto-Accept โ†’ Plan)
Alt PSwitch the active model
Alt TToggle thinking on / off
\ EnterInsert a newline (quick method)
Ctrl JInsert 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

CommandDescription
/clearClear the current conversation
/compact [focus]Compress context window with optional focus hint
/resumeResume or switch to a previous session
/rename [name]Name the current session
/branch [name]Branch the conversation (alias: /fork)
/costShow token usage and cost statistics
/contextVisualize context usage (grid view)
/diffOpen interactive diff viewer
/copy [N]Copy the last (or Nth) response to clipboard
/rewindRewind conversation / restore code checkpoint
/exportExport 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
/voiceEnable push-to-talk voice input (20 languages)
/remote-control NEWBridge session to claude.ai/code (alias: /rc)
/pr-comments [PR]Fetch GitHub PR comments into context
/security-reviewRun a security analysis of recent changes
/insightsAnalyze session history and generate a report
/desktopContinue the session in the Desktop app
/doctorDiagnose installation issues
/feedbackSubmit feedback or bug report (alias: /bug)

Session Slash Commands


๐Ÿ”ง

Config Slash Commands

CommandDescription
/configOpen the settings UI
/model [model]Switch the active model (use โ† โ†’ to adjust effort)
/effort [level] NEWSet effort level: low / med / high / max / auto
/fast [on|off]Toggle fast mode
/vimToggle vim keybindings
/themeChange the color theme
/permissionsView and update tool permissions
/color [color]Set the prompt bar color
/keybindingsCustomize keyboard shortcuts
/terminal-setupConfigure terminal keybindings
/initCreate a CLAUDE.md file for the project
/memoryEdit CLAUDE.md memory files
/mcpManage MCP servers (interactive UI)
/hooksManage hooks
/skillsList available skills
/agentsManage agents
/add-dir <path>Add an additional working directory
/reload-pluginsHot-reload plugins without restarting
/usageShow plan limits and rate status
/scheduleManage cloud scheduled tasks

Config & Tool Slash Commands


๐Ÿ–ฅ๏ธ

CLI Commands & Flags

Core Commands

CommandDescription
claudeStart an interactive session
claude "query"Start a session with an initial prompt
claude -p "query"Headless / non-interactive mode
claude -cContinue the last conversation
claude -r "name"Resume a named session
claude updateUpdate Claude Code to the latest version
cat file | claude -pPipe file content as input (headless)

Core CLI Commands

Key Flags

FlagDescription
--modelSet the model to use
--worktree / -wRun in a git worktree
--name / -nName the session
--add-dirAdd an additional working directory
--agentUse a specific agent
--allowedToolsPre-approve a list of tools
--output-format jsonReturn structured JSON output
--json-schemaConstrain output to a JSON schema
--max-turnsLimit the number of agentic turns
--max-budget-usdSet a cost cap for the session
--effortSet effort: low / med / high / max
--permission-modeSet permission mode at startup
--verboseEnable verbose output
--bare NEWMinimal headless mode (no hooks / LSP)
--remoteOpen as a web session on claude.ai
--channels NEWPermission relay / MCP push
--consoleAuthenticate via Anthropic Console
--dangerously-skip-permissionsโš ๏ธ Skip all permission prompts

Key CLI Flags


๐Ÿ“

Memory & Files

CLAUDE.md Locations

PathScope
./CLAUDE.mdProject โ€” team-shared, checked into VCS
~/.claude/CLAUDE.mdPersonal โ€” applies to all projects
/etc/claude-code/Managed โ€” org-wide policy

CLAUDE.md Locations

Rules & Import

Path / SyntaxDescription
.claude/rules/*.mdProject-level rules (loaded automatically)
~/.claude/rules/*.mdUser-level rules (loaded globally)
paths: frontmatterApply rules only to matching file paths
@path/to/fileImport another file inside CLAUDE.md
~/.claude/projects/<proj>/memory/Auto-loaded MEMORY.md + topic files

Rules & Auto Memory

๐Ÿ’ก Tip: CLAUDE.md survives context compaction โ€” it’s always re-injected after a /compact. Put your most important project context here.

๐Ÿ”Œ

MCP Servers

Add Servers (–transport)

TransportDescription
--transport httpRemote HTTP server (recommended for production)
--transport stdioLocal process over stdin/stdout
--transport sseRemote Server-Sent Events stream

MCP Server Transports

Scopes & Config Files

FileScope
.claude/settings.local.jsonLocal only โ€” not committed to VCS
.mcp.jsonProject โ€” shared via VCS
~/.claude.jsonUser global โ€” OAuth, MCP state

MCP Configuration Scopes

Management Commands

CommandDescription
/mcpOpen the interactive MCP management UI
claude mcp listList all registered MCP servers
claude mcp serveRun Claude Code itself as an MCP server

MCP Management

๐Ÿ†• Elicitation: MCP servers can now request input from the user mid-task using the Elicitation API โ€” great for interactive workflows.

๐Ÿค–

Skills & Agents

Built-in Skills

CommandDescription
/simplifyCode review using 3 parallel agents
/batchLarge parallel changes with 5โ€“30 git worktrees
/debug [desc]Troubleshoot issues from a debug log
/loop [interval]Schedule a recurring task
/claude-apiLoad the Anthropic API + SDK reference into context

Built-in Skills

Built-in Agents

AgentDescription
ExploreFast read-only agent (runs on Haiku for speed)
PlanResearch-focused agent for plan mode
GeneralFull tool access for complex multi-step tasks
BashTerminal operations in a separate context

Built-in Agents

Custom Skill Locations

PathScope
.claude/skills/<name>/Project-specific skills
~/.claude/skills/<name>/Personal skills (all projects)

Custom Skill Locations

Agent Frontmatter Keys

KeyDescription
permissionMode:default / acceptEdits / plan / dontAsk / bypass
isolation: worktreeRun the agent in its own git worktree
memory: user|projectEnable persistent memory across sessions
background: trueRun as a background task
maxTurns:Limit the number of agentic turns
model:Override the model for this agent
effort: NEWOverride effort level for this agent
initialPrompt: NEWSet the opening prompt for the agent
SendMessage NEWResume agents (replaces the old resume key)

Agent Frontmatter Keys

Skill Frontmatter

KeyDescription
description:Trigger phrase for auto-invocation
allowed-tools:Pre-approved tools (skip permission prompts)
model:Override the model for this skill
effort: NEWOverride the effort level for this skill
context: forkRun the skill in a subagent context
$ARGUMENTSPlaceholder for user-supplied input
${CLAUDE_SKILL_DIR}Reference the skill’s own directory
!`cmd`Dynamic context injection via shell command

Skill Frontmatter


โš™๏ธ

Environment Variables

VariableDescription
ANTHROPIC_API_KEYYour Anthropic API key
ANTHROPIC_MODELOverride the default model
CLAUDE_CODE_EFFORT_LEVELDefault effort: low / med / high
MAX_THINKING_TOKENSMax tokens for thinking; 0 = disabled
ANTHROPIC_CUSTOM_MODEL_OPTIONAdd a custom entry to the /model picker
CLAUDE_CODE_MAX_OUTPUT_TOKENSOverride max output tokens (default 32K)
CLAUDE_CODE_PLUGIN_SEED_DIRLoad plugins from multiple directories
CLAUDECODESet to 1 to signal you are inside a CC shell
IS_DEMODemo mode โ€” hides email and org info
CLAUDE_CODE_DISABLE_CRONDisable the built-in task scheduler

Key Environment Variables

Config Files

FileScope
~/.claude/settings.jsonUser settings (global)
.claude/settings.jsonProject settings (shared via VCS)
.claude/settings.local.jsonLocal overrides (not committed)
~/.claude.jsonOAuth tokens, MCP state, session data
.mcp.jsonProject MCP server definitions

Configuration Files


๐Ÿ”

Permission Modes

ModeDescription
defaultPrompts for approval before each action
acceptEditsAutomatically accepts all file edits
planRead-only โ€” agent can only plan, not execute
dontAskDenies actions unless explicitly pre-allowed
bypassPermissionsSkips all permission prompts
--dangerously-skip-permissionsโš ๏ธ CLI flag to bypass all prompts

Permission Modes

๐Ÿ’ก Tip: Use 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

EventDescription
CwdChanged NEWFires when the working directory changes
FileChanged NEWFires when a file is modified by the agent

New Hook Events in v2.1.83


๐Ÿง 

Workflows & Pro Tips

Plan Mode

ActionHow
Enter plan mode interactivelyPress Shift Tab twice
Start session in plan modeclaude --permission-mode plan
Max effort for one turnType ultrathink in your prompt

Plan Mode Tips

Git Worktrees

Command / KeyDescription
claude --worktree nameStart an isolated branch per feature
isolation: worktreeRun an agent in its own worktree (frontmatter)
sparsePaths NEWCheckout only the directories you need
/batchAutomatically creates and manages worktrees

Git Worktree Workflow

Context Management

Command / FeatureDescription
/contextView context usage and optimization tips
/compact [focus]Compress context; focus hint keeps important parts
Auto-compactTriggers automatically at ~95% context capacity
1M context windowAvailable on Claude Opus (Max / Team / Enterprise plans)
CLAUDE.mdAlways survives compaction โ€” put key context here โœ“

Context Management

SDK / Headless

CommandDescription
claude -p "query"Non-interactive single query
--output-format jsonReturn structured JSON output
--max-budget-usd 5Hard cost cap for the session
cat file | claude -pPipe file content as stdin input
/loop 5m msgRun a recurring task every 5 minutes

SDK & Headless Usage


ยฉ 2026 Collabnix ยท Built with โค๏ธ by @ajeetraina ยท Claude Code v2.1.83
Join our Discord Server