Claude Code Cheat Sheet

A quick reference for working with Claude Code and prompt engineering.

💡 Your system is detected automatically — Mac- and Windows-specific commands are filtered to it. Switch above if you need the other.


⌨️ Hotkeys

KeyAction
Ctrl+CInterrupt the current generation
Ctrl+DExit Claude Code (EOF)
Ctrl+LClear the screen (history kept)
Ctrl+OOpen the multi-line editor
Ctrl+RSearch prompt history
Ctrl+GFuzzy-find files in the project (like fzf)
Ctrl+BPick from changed git files
Ctrl+FSearch the current conversation
Shift+TabToggle mode: Plan → Normal → Auto-accept
\+Enter / Ctrl+JNew line without sending
Esc+EscCancel current input
/ at line startOpen slash-command autocomplete
! at line startRun a bash command from the prompt
@filenameAdd a file/folder to context

Mac-specific keys:

KeyAction
Option+PQuick-switch to Plan mode
Option+TEnable ultrathink (deep analysis)
Cmd+VPaste (supports images)

Windows-specific keys:

KeyAction
Alt+PQuick-switch to Plan mode
Alt+TEnable ultrathink (deep analysis)
Ctrl+VPaste (supports images)

🖥️ CLI: launch and flags

claude                          # Interactive mode
claude "request"                # Launch with an initial request
claude -p 'request'             # Pipe mode: response to stdout and exit
claude -c                       # Resume the last session
claude -r <id>                  # Resume session by ID
claude update                   # Update Claude Code

# Useful flags
--model <model>                 # Specify model at launch
--permission-mode plan          # Launch in read-only mode
--worktree / -w                 # Isolated git worktree
--no-auto-compact / -n          # Disable auto context compaction
--add-dir <path>                # Add a folder to context
--output-format json|text|stream-json
--max-turns <N>                 # Turn limit in auto mode
--max-budget-usd <N>            # Session budget in dollars
--bare                          # Without CLAUDE.md and MCP (clean start)

# Pipe mode — handy for scripts:
cat error.log | claude -p 'explain the error'

📋 Session management

/clear                  # Full context wipe
/compact [topic]        # Compress context, keep the essentials
/context                # Show context fill
/resume                 # List recent sessions to resume
/rename <name>          # Rename the session (handy for /resume)
/branch                 # Create a session branch
/cost                   # Current session cost ($, tokens)
/diff                   # All file changes this session
/copy                   # Copy the last response
/export                 # Export the conversation to Markdown

Decision tree /clear vs /compact:

SituationCommand
Context <70%, same task/compact — compress, keep history
Context >85%, same task/compact — time to compress
New task, different topic/clear — start fresh
Claude is looping, getting confused/clear — reset
Context >85% + new task/clear — no question

💡 CLAUDE.md is auto-reloaded after /compact and auto-compact — instructions aren't lost.


⚙️ Settings

/config                         # Open settings.json in the editor
/model <model>                  # Switch model in the session
/fast                           # Switch to Haiku (fast/cheap)
/effort low|medium|high         # Analysis depth (NEW)
/permissions                    # View and configure permissions
/vim                            # Enable vim editing mode
/theme                          # Change color theme

Permission modes:

ModeBehavior
defaultAsks for files and bash
acceptEditsAuto-accepts file edits, asks for bash
planRead-only, no changes
dontAskDoesn't ask for allowed tools
bypassPermissions⚠️ Full access without confirmation

🔧 Tools and extensions

/init               # Create CLAUDE.md for the project
/memory             # Open CLAUDE.md for editing
/mcp                # Manage MCP servers
/hooks              # Manage hooks
/skills             # Manage skills
/agents             # Manage agents
/chrome             # Browser tools via MCP
/reload-plugins     # Reload plugins without a restart

🧩 Slash commands

/btw <text>         # Add context without interrupting work
/plan               # Create a markdown task plan
/loop               # Iterative loop until a condition is met
/voice              # Voice input (Space = push-to-talk)
/doctor             # Diagnostics: API keys, MCP, configs
/rc                 # Open ~/.claude/rc.ts (launch settings)
/remote-control     # Control via API (NEW)
/pr-comments        # Load PR comments into context
/stickers           # 🥚

🧩 Plugins and skills

/plugin marketplace add <name>  # Install from the marketplace
/plugin list                    # List installed
/plugin enable/disable <name>   # Enable/disable a plugin
/simplify                       # Simplify code
/debug                          # Debug: error analysis
/batch                          # Bulk file changes

Skill locations:

Skill frontmatter:

---
description: "What the skill does"
allowed-tools: [Bash, Read, Write, mcp__github__*]
model: claude-sonnet-4-20250514
effort: medium          # low | medium | high (NEW)
context: fork           # isolated context
---
# Skill body
Task: $ARGUMENTS        # arguments are substituted here

🤖 Agent parameters

permissionMode: default|acceptEdits|plan|dontAsk|bypassPermissions
isolation: none|worktree    # worktree = separate git worktree
memory: path/to/MEMORY.md   # memory across runs
background: true            # background run
maxTurns: 10                # turn limit

Which agent when:

AgentFor what
ExploreUnderstand a codebase
PlanComplex task → plan first
GeneralDelegate a subtask
BashShell scripts and CLI

🌀 Ultrathink

Activate deep thinking — trigger words in the prompt:

think → think hard → think harder → ultrathink

Or the Alt+T key. Useful for: architectural decisions, tough bugs, ambiguous specs.

Pattern Plan → Normal → Auto:

1. Plan mode   → recon only, no changes
2. Normal mode → implementation with confirmation
3. Auto-accept → routine without confirmation (Shift+Tab)

🔄 A typical day with Claude Code

9:00  [You] Thinking about strategy
      └─→ 30 min of thinking, planning

9:30  [Agent] Makes the first draft
      └─→ Claude Code writes code/text

10:00 [You] Reviewing the result
      └─→ Review, feedback, clarifications

10:15 [Agent] Refines based on feedback
      └─→ Polished result

10:30 [You] Publish/deploy
      └─→ Final decision

🏃 Quick start (5 minutes)

# 1. Create and enter a project
mkdir my-project && cd my-project

# 2. Create context files
touch CLAUDE.md TODO.md AGENTS.md

# 3. Initialize CLAUDE.md
claude
/init       # ← inside Claude Code

# 4. Or fill in manually:
# Stack, how to run, agent instructions

# 5. Give it the first task
# 1. Create and enter a project
mkdir my-project; cd my-project

# 2. Create context files (PowerShell)
ni CLAUDE.md, TODO.md, AGENTS.md -ItemType File

# 3. Initialize CLAUDE.md
claude
/init       # ← inside Claude Code

# 4. Or fill in manually:
# Stack, how to run, agent instructions

# 5. Give it the first task

💡 Alternative via WSL/Git Bash: mkdir my-project && cd my-project && touch CLAUDE.md TODO.md AGENTS.md


📝 Four shifts (Quick Ref)

BeforeNow
❌ "Install X"✅ "I need Y, the result is Z"
❌ First result is perfect✅ First result is a draft
❌ Commands✅ Specifications (briefs)
❌ I do everything✅ I manage attention

📋 Structure of a good prompt

Anatomy of a prompt
You are a senior Python developer I have a FastAPI project where the /report endpoint takes 4 seconds find the bottlenecks and suggest how to speed it up without switching the database answer as a numbered list with code examples
Role

Who answers: you give the AI expertise and tone.

Context

The inputs: the situation and data.

Task

What to do — one action.

Constraints

The limits: what's off-limits.

Format

The shape of the result: output structure.

## Role
You are — [description + expertise]

## Task
[Specific task]

## Input
[Input data]

## Output
[Expected result]

## Constraints
[Constraints]

🎯 Delegation matrix

✅ Delegate:

🧠 Decide yourself:


📄 Required project files

CLAUDE.md

Quick start:

/init  # Auto-generates CLAUDE.md from an existing project

Where to put it:

Limit: ~200 lines (important for context)

Minimal structure:

# Project Context
## My role
## Project
## Stack
## How to run
## Instructions for Claude Code

TODO.md

# Tasks
## 🔴 CRITICAL
## 🟡 IMPORTANT
## 🟢 LATER
## ⏸️ BLOCKED
## ✅ DONE

AGENTS.md

# Agent Instructions
## For any work
## For /explore
## For /plan
## For /code
## What to avoid

⚠️ Common mistakes

MistakeFix
Context overflowingOnly feed relevant files
Agent asks everythingAdd the info to CLAUDE.md
Wrong resultSpecify what exactly is off, iterate
DistractorsRemove extra files from context
"Lost in the Middle"Important stuff at the start or end, not middle

💡 Quick tips

What to use when

For analyzing a codebase:

/explore --thoroughness medium

For planning a big piece of work:

/plan

For quickly adding info:

/btw Update the context: [info]

For exploring a specific file:

/explore --thoroughness quick
"Which files are responsible for [X]?"

🎯 Prompt quality check

Before sending:


🔢 Tokens

1 token ≈ 4 characters
1000 tokens ≈ 750 words

Cost:
- Input token = cheaper
- Output token = pricier (2–3×)

Optimize:
- Compress context
- Strip the extra
- Structure your data

Advanced token tracking

After Meeting 2 you can set up the advanced status line (see 02-setup-guide.md → "Advanced setup"):


🌍 Prompt examples

Backend request

## Role
You are a seasoned backend developer with 10 years of experience.
You know Node.js, PostgreSQL, microservices.

## Task
Create a REST API endpoint for fetching the user list.

## Input
- Fields needed: id, name, email, created_at
- Pagination support (page, limit)
- Filtering by email

## Output
- Express route handler
- TypeScript types
- Example curl requests

## Constraints
- Use a PostgreSQL query builder (knex.js)
- Max 50 lines of code
- Add validation for query parameters

Frontend request

## Role
You are a frontend developer, an accessibility specialist.

## Task
Create a React component for a product filter.

## Input
- Filters: category (checkbox), price (range), rating (radio)
- Sample data in data.json

## Output
- React component Filter.tsx
- Tailwind CSS styles
- WCAG AA accessibility

## Constraints
- TypeScript
- No UI libraries (pure CSS)
- Keyboard navigation (Tab, Enter, Escape)

Research request

## Role
You are a UX researcher experienced in user interviews.

## Task
Analyze interview.txt and find the main user pain points.

## Input
- File interview.txt with the interview recording

## Output
- Top 5 user problems
- For each: description, quote, possible solution

## Constraints
- Max 1 page
- Direct quotes from the interview only
- Prioritize by frequency of mentions

🔐 Git commands (quick)

Same on both systems — Git is identical everywhere:

git status                          # Status
git add .                           # Stage all files
git commit -m "Description"         # Commit
git push origin main                # Push
git pull origin main                # Pull

🖥️ Mac / Windows differences

Where the commands actually diverge (everything else is identical):

NeedmacOS / LinuxWindows (PowerShell)
Create an empty filetouch file.mdni file.md -ItemType File
Create multipletouch a.md b.md c.mdni a.md, b.md, c.md -ItemType File
Chain commandscmd1 && cmd2cmd1; cmd2 (or && on pwsh 7+)
Pipe a file into Claudecat err.log | claude -p ...Get-Content err.log | claude -p ...
Env variableexport KEY=value$env:KEY = "value"
Hotkey: Plan modeOption+PAlt+P
Hotkey: ultrathinkOption+TAlt+T
PasteCmd+VCtrl+V
Home .claude path~/.claude/$env:USERPROFILE\.claude\

💡 Tip for Windows devs: install WSL2 + Git Bash so you can run bash commands from tutorials. PowerShell works too, but many AI blogs assume bash.

💡 Tip for Mac: use iTerm2 or Warp instead of the stock Terminal — they pair better with Claude Code (patterns, colors, hotkeys).


📊 Result check

# Result is good if:
- ✅ Code runs without fixes
- ✅ Structure is clear
- ✅ Usage examples included
- ✅ Edge cases covered
- ✅ Performance is acceptable

# Result is bad if:
- ❌ You have to finish by hand
- ❌ Details from the prompt are lost
- ❌ Hallucinations in the code
- ❌ Lots of unnecessary code

🎓 Going further

1. Run through all EXERCISES in EXERCISES.md
2. Create your own prompt template
3. Use it in real projects
4. Record good prompts
5. Share with your team

📞 Quick help

claude --help       # All CLI flags
/doctor             # Install diagnostics
/context            # Context fill
/cost               # Session cost
/btw                # Add context without interrupting
/plan               # Planning mode

Last updated: 2026-03-25

💡 Interactive version with 141 cards + quiz mode: tools/cheatsheet/index.html

Use this cheatsheet for a quick start and quick reference.