Skip to main content
Code Guide

Claude Code Cheatsheet

1 printable page: daily essentials for maximum productivity

By Florian BRUNIAUX Version 3.37.1 March 2026

How to Install Claude Code

npm install -g @anthropic-ai/claude-code

Requires Node.js 18+

Verify installwhich claude
Start sessionclaude
Health checkclaude doctor

Essential Commands

/helpContextual help
/clearReset conversation
/compactFree up context
/statusSession state + context usage
/contextDetailed token breakdown
/planEnter Plan Mode (no changes)
/executeExit Plan Mode (apply changes)
/modelSwitch model (sonnet/opus/opusplan)
/insightsUsage analytics + optimization
/teleportTeleport session from web
/tasksMonitor background tasks
/fastToggle fast mode (2.5x speed)
btw [question]Side question overlay — read-only ephemeral agent, no history pollution, no tools
/loop [interval] [prompt]Recurring scheduler — /loop 5m check the deploy (default 10m)
/statsUsage graph, favorite model, streak
/rename [name]Name or rename current session
/copyInteractive picker to copy a code block or full response
/debugSystematic troubleshooting
/remote-envConfigure cloud environment
/simplifyDetect over-engineering in changed code + auto-fix
/batchLarge-scale refactors via 5–30 parallel worktree agents
/exitQuit (or Ctrl+D)

Keyboard Shortcuts

Shift+TabCycle permission modes
Esc x 2Rewind (undo)
Ctrl+CInterrupt
Ctrl+RSearch command history
Ctrl+LClear screen (keeps context)
Ctrl+BBackground tasks
Ctrl+FKill all background agents (double press)
Alt+TToggle thinking on/off
TabAutocomplete
Shift+EnterNew line
Ctrl+DExit

IDE Shortcuts

VS CodeAlt+K
JetBrainsCmd+Option+K

File References

@path/to/file.ts    → Reference a file
@agent-name         → Call an agent
!shell-command      → Run shell command

Features Meconnues (But Official!)

FeatureSinceWhat It Does
Tasks APIv2.1.16Persistent task lists with dependencies
Background Agentsv2.0.60Sub-agents work while you code
Agent Teamsv2.1.32Multi-agent coordination (TeamCreate/SendMessage)
Auto-Memoriesv2.1.32Automatic cross-session context capture
Session Forkingv2.1.19Rewind + create parallel timeline
LSP Toolv2.0.74Code intelligence (go-to-def, refs)
/simplifyv2.1.63Architecture-level over-engineering detection + auto-fix
/batchv2.1.63Spawns 5–30 agents in isolated worktrees, each opens a PR
/loopv2.1.71Recurring scheduler: run any prompt or command on an interval (5m, 10m...) while you work
Pro tip: These aren't "secrets"--they're in the CHANGELOG. Read it!

Permission Modes

ModeEditingExecution
DefaultAsksAsks
Auto-acceptAutoAsks
Plan ModeNoneNone
Shift+Tab to switch modes

Memory & Settings

LevelPathScope
Project.claude/Team (git)
Personal~/.claude/You only

.claude/ Structure

.claude/
├── CLAUDE.md           # Local memory
├── settings.json       # Hooks (committed)
├── settings.local.json # Permissions
├── agents/             # Custom agents
├── commands/           # Slash commands
├── hooks/              # Event scripts
├── rules/              # Auto-loaded rules
└── skills/             # Knowledge modules

Context Management

0-50%
50-70%
70-90%
90%+
Work freely
Be selective
/compact NOW
/clear required
Model: Sonnet | Ctx: 89.5k | Ctx(u): 56.0%
Watch Ctx(u): >70% = /compact, >85% = /clear
SignAction
Short responses/compact
Frequent forgetting/clear
>70% context/compact
Task complete/clear

Plan Mode & Thinking

Shift+Tab x 2Enter Plan Mode
/model opusplanOpus planning, Sonnet execution

Thinking Mode (Opus 4.6)

DefaultThinking ON at max budget -- keywords are cosmetic only
Alt+TToggle thinking on/off (session)
/configConfigure thinking (permanent)
effortAPI only: low|medium|high|max

Typical Workflow

1. Start session      → claude
2. Check context      → /status
3. Plan Mode          → Shift+Tab x 2
4. Describe task      → Clear, specific prompt
5. Review changes     → Always read the diff!
6. Accept/Reject      → y/n
7. Verify             → Run tests
8. Commit             → When task complete
9. /compact           → When context >70%

Prompting Formula

WHAT: [Concrete deliverable]
WHERE: [File paths]
HOW: [Constraints, approach]
VERIFY: [Success criteria]

Example

Add input validation to the login form.
WHERE: src/components/LoginForm.tsx
HOW: Use Zod schema, show inline errors
VERIFY: Empty email shows error

Model Context Protocol (MCP) Servers

MCP extends Claude Code with external tools and data sources

SerenaIndexation + session memory
grepaiSemantic search + call graph
Context7Library documentation
SequentialStructured reasoning
PlaywrightBrowser automation
PostgresDatabase queries
doobidooSemantic memory + Knowledge Graph
Check status: /mcp

CLI Flags

-p "query"Non-interactive mode
-cContinue last session
-r <id>Resume specific session
--model sonnetChange model
--teleportTeleport session from web
--add-dir ../libAllow outside CWD
--allowedToolsWhitelist tools
--debugDebug output
--mcp-debugDebug MCP servers

Anti-patterns

Vague prompts
Specify file + line with @
Accept without reading
Read every diff
Ignore warnings
Use /compact at 70%
Skip permissions
Never in production

Cost Optimization

ModelUse ForCost
HaikuSimple fixes, reviews$
SonnetMost development$$
OpusArchitecture, complex bugs$$$
OpusPlanPlan + Execute$$

Quick Decision Tree

Simple task       → Just ask Claude
Complex task      → Tasks API to plan first
Risky change      → Plan Mode first
Repeating task    → Create agent/command
Context full      → /compact or /clear
Need docs         → Use Context7 MCP
Deep analysis     → Use Opus (thinking on by default)

The Golden Rules

  1. Always review diffs before accepting
  2. Use /compact before context >70%
  3. Be specific (WHAT, WHERE, HOW, VERIFY)
  4. Plan Mode first for complex/risky tasks
  5. Create CLAUDE.md for every project
  6. Commit frequently after each task
  7. Know what's sent to Anthropic

Quick Fixes

Command not foundCheck PATH, reinstall
Context >70%/compact immediately
Slow responses/compact or /clear
MCP not workingclaude mcp list
Permission deniedsettings.local.json

Health Check

which claude && claude doctor && claude mcp list