Claude Code Cheat Sheet

crackr.dev

1Slash Commands

Session

/clear/resetWipe conversation, free context
/compactCompress context with focus instructions
/resume/continueResume session by ID or name
/branch/forkFork conversation
/rewindUndo to previous checkpoint
/btwSide question, no context pollution

Tools & Config

/planRead-only exploration mode
/diffInteractive diff viewer
/initInitialize project with CLAUDE.md
/config/settingsOpen settings
/memoryEdit CLAUDE.md, toggle auto memory
/mcpManage MCP servers
/permissionsView/update tool permissions
/security-reviewScan changes for vulnerabilities

Model & Output

/modelSwitch model (sonnet, opus)
/fastToggle fast mode
/effortReasoning level (low to max)
/contextVisualize context window
/costToken usage and cost stats
/copyCopy last N responses to clipboard
/exportExport conversation as text
/doctorDiagnose installation

2Keyboard Shortcuts

Control

Ctrl+CCancel current generation
Ctrl+DExit Claude Code
Ctrl+LClear terminal screen
Ctrl+OToggle verbose transcript
Ctrl+TToggle task list
Ctrl+BBackground running task
Ctrl+GOpen in external editor

Mode & Model

Shift+TabCycle permission modes
Esc EscRewind to checkpoint
Option+PSwitch model
Option+TToggle extended thinking
Option+OToggle fast mode
Hold SpacePush-to-talk voice input

Multiline Input

\ + EnterAll terminals
Option+EntermacOS default
Shift+EnteriTerm2, WezTerm, Ghostty, Kitty
Ctrl+JLine feed character

3Permission Modes

default

Asks for everything except reads

safe
acceptEdits

Auto-approves file edits, asks for commands

safe
plan

Read-only. No edits, no commands

safe
auto

AI classifier approves safe actions

moderate
dontAsk

Only pre-approved tools. For CI/CD

moderate
bypass

Approves everything. Isolated VMs only

risky
safestriskiest

Switch: Shift+Tab or --permission-mode

4CLI Flags

Session

-cResume most recent conversation
-r IDResume session by ID or name
-pPrint mode (non-interactive)
-w NAMEStart in isolated git worktree
-n NAMESet display name for session
--remoteCreate web session on claude.ai
--teleportResume web session locally

Model & Limits

--modelSet model (sonnet, opus)
--effortReasoning level (low to max)
--max-turns NLimit agentic turns
--max-budget-usd NMaximum spend limit
--fallback-modelFallback when overloaded

Prompt & Output

--system-promptReplace system prompt
--append-system-promptAdd to system prompt
--output-formattext, json, stream-json
--json-schemaValidated JSON output

Tools & Config

--tools LISTRestrict available tools
--allowedToolsAuto-approve specific tools
--mcp-config PATHLoad MCP servers from file
--agent NAMEUse custom agent definition
--add-dir PATHAdd working directories
--bareMinimal mode, skip discovery
--debug FILTERDebug logging

5Configuration Files

LocalProjectUser(priority order)

Settings

.claude/settings.local.jsonLocal only (gitignored)
.claude/settings.jsonProject (shared via git)
~/.claude/settings.jsonUser (all projects)

Instructions

CLAUDE.mdProject instructions (root or .claude/)
~/.claude/CLAUDE.mdPersonal instructions (global)
.claude/rules/*.mdTopic rules with path: filters

MCP & Keys

.claude/mcp.jsonProject MCP servers (shared)
.claude/mcp.local.jsonLocal MCP servers (gitignored)
~/.claude/mcp.jsonUser MCP servers (global)
~/.claude/keybindings.jsonCustom keyboard bindings

Tip: keep CLAUDE.md under 200 lines for best adherence

6Hooks

UserPreToolPostStop

Events (can block marked with B)

PreToolUseBBefore tool runs
PostToolUseAfter tool succeeds
UserPromptSubmitBUser sends message
NotificationClaude needs attention
StopBClaude finishes response
SessionStartSession begins
SubagentStart/StopSubagent lifecycle
PreCompact/PostCompactContext compaction

Exit Codes

0Allow (stdout = context)
2Block (stderr = feedback)

Hook Types

commandhttppromptagent

7MCP Servers

claude mcp add NAME URLAdd HTTP or SSE server
--transport stdio NAME CMDAdd local stdio server
--mcp-config ./mcp.jsonLoad from JSON config
--strict-mcp-configOnly flag servers, ignore saved
/mcpManage connections interactively

Scopes

User~/.claude/
Project.claude/
Local.claude/*.local.json
Session--mcp-config

Permission pattern: mcp__SERVER__TOOL

8IDE Integration

VS Code

Cmd+EscFocus Claude Code input
Cmd+NNew conversation
Cmd+Shift+EscNew tab
Option+KInsert @-mention for file

JetBrains

Cmd+EscOpen Claude Code panel
Cmd+Option+KInsert file reference

Browser & Web

@browserReference Chrome browser
claude --chromeEnable Chrome integration
claude --remoteCreate web session
claude --teleportResume web session locally

9Quick Reference

/Open slash command menu
! commandRun shell directly (bash mode)
@ fileReference file with autocomplete
claude auth loginSign in to account
claude auth statusAuth status as JSON
claude updateUpdate to latest version
claude agentsList configured subagents

10Environment Variables

CLAUDE_CODE_SIMPLEEnable bare mode
CLAUDE_CODE_DISABLE_AUTO_MEMORYDisable auto memory
CLAUDE_CODE_TASK_LIST_IDNamed task list
CLAUDE_CODE_DISABLE_BACKGROUND_TASKSDisable backgrounding
CLAUDE_ENV_FILEPath to env file (hooks)
CLAUDE_PROJECT_DIRProject root (in hooks)

11Pro Tips

CLAUDE.md < 200 lines Better instruction adherence
.claude/rules/ with path: filters Topic-specific, reduce noise
claude -w feature Parallel work in git worktrees
Bash(npm test) not Bash(*) Narrow permission rules
/compact after big tasks Free context, keep progress
PostToolUse + prettier Auto-format after every edit
--max-budget-usd 5 Spend limits for automation
Esc Esc to rewind Undo last, fork from any point
/btw for side questions No context derailment
Name sessions with -n Easy /resume by name later

The Complete Claude Code Cheat Sheet

This Claude Code cheat sheet is a single-screen reference covering every command, shortcut, and configuration option for Anthropic's agentic coding CLI. Whether you are new to Claude Code or looking to master advanced features like hooks and MCP servers, everything is here in one view.

Our Claude Code reference covers slash commands (session management, tools, model switching), keyboard shortcuts (control, mode cycling, multiline input), all CLI flags (session, model, prompt, output, tools), six permission modes with safety ratings, the hooks system with all events and exit codes, MCP server configuration across four scopes, IDE integration for VS Code and JetBrains, environment variables, and pro tips from experienced users.

Unlike scattered documentation, this Claude Code cheatsheet is designed to fit your entire screen in one view. Every command, every shortcut, every flag visible at a glance for quick reference during your workflow.

Claude Code Cheat Sheet FAQ

What is a Claude Code cheat sheet?expand_more

A Claude Code cheat sheet is a quick-reference guide that lists every slash command, keyboard shortcut, CLI flag, permission mode, hook event, MCP configuration option, and IDE integration for Claude Code. This cheat sheet covers all 80+ commands and settings in one searchable view so you can find what you need at a glance.

What is Claude Code?expand_more

Claude Code is Anthropic's official agentic coding tool that runs directly in your terminal. It can read, edit, and create files, run shell commands, search entire codebases, manage git workflows, and connect to external services through MCP servers. It works as a standalone CLI, VS Code extension, JetBrains plugin, desktop app, and web app.

What are the permission modes in Claude Code?expand_more

There are 6 modes: 'default' asks for everything except reads, 'acceptEdits' auto-approves file edits, 'plan' is read-only exploration, 'auto' uses an AI classifier for safe actions, 'dontAsk' only runs pre-approved tools for CI/CD, and 'bypassPermissions' approves everything (only for isolated VMs). Switch with Shift+Tab or the --permission-mode flag.

What is CLAUDE.md and how do I use it?expand_more

CLAUDE.md is a markdown file in your project root (or ~/.claude/) that gives Claude Code persistent instructions about your project. Include coding standards, architecture notes, and workflow preferences. Keep it under 200 lines for best results. You can also use .claude/rules/*.md for topic-specific rules with path filters.

What are hooks in Claude Code?expand_more

Hooks are automated actions (shell commands, HTTP requests, or agent prompts) that run in response to events like tool use, session start, or notifications. Common uses include auto-formatting after edits with Prettier, blocking dangerous operations, and sending notifications when Claude needs attention. Configure them in settings.json.

What is MCP in Claude Code?expand_more

MCP (Model Context Protocol) lets Claude Code connect to external tools and services like databases, APIs, GitHub, Notion, and more. You can add servers with 'claude mcp add' or configure them in .claude/mcp.json. MCP servers can be scoped to user level (global), project level (shared via git), or local (gitignored).

How do I manage context in Claude Code?expand_more

Use '/context' to visualize your context window as a colored grid, '/compact' to compress it with optional focus instructions, and '/clear' to start fresh. Reference files with @ mentions instead of pasting content. Use .claude/rules/ to split instructions by topic. Set PostCompact hooks to re-inject critical context after compaction.

Master your coding workflow?

Practice coding interviews with an AI interviewer that gives real-time feedback on your code, complexity analysis, and approach.

Try Crackr freearrow_forward

Continue learning