Little Might

Mar 24, 2026

5 min read

The Claude Code Cheat Sheet

Every Claude Code command, shortcut, and flag I actually use — slash commands, CLI flags, context management, and workflow tools in one printable reference.

The Claude Code Cheat Sheet

TL;DR: Every slash command, CLI flag, context trick, and workflow shortcut I actually use in Claude Code — organized into tables you can bookmark or print. Not a tutorial, just the reference I wish existed when I started.

I’ve been using Claude Code daily for months. Still look up commands. So I made this.

Not a tutorial. Not a think piece. Just the reference I wish existed when I started.


Slash Commands

Session Management

CommandWhat it does
/clearWipe conversation, start fresh
/compact [focus]Compress context window — add a focus keyword to keep the relevant stuff
/resumeResume or switch to a previous session
/rename [name]Name the session so you can find it later
/branch [name]Fork the conversation (alias: /fork)
/rewindRoll back conversation and code to a checkpoint
/exportExport the full conversation
/copy [N]Copy the last (or Nth) response to clipboard

Context and Files

CommandWhat it does
/initCreate a CLAUDE.md — Claude reads this automatically every session
/memoryEdit CLAUDE.md files across your workspace
/add-dir <path>Give Claude access to another directory
/contextVisualize your context window as a grid
/mcpManage MCP server connections

Workflow

CommandWhat it does
/plan [desc]Enter plan mode — think before building
/loop [interval]Schedule a recurring task in the session
/scheduleCloud-scheduled tasks that run when you’re away
/hooksAutomate actions on events
/skillsList available skills
/agentsManage agents

Review

CommandWhat it does
/diffInteractive diff viewer
/security-reviewAnalyze changes for vulnerabilities
/pr-comments [PR]Pull in GitHub PR feedback

Model and Config

CommandWhat it does
/model [model]Switch models mid-session
/effort [level]Set reasoning effort: low / med / high / max / auto
/fast [on|off]Toggle fast mode
/configOpen settings
/permissionsView or update what Claude can access
/vimToggle vim keybindings
/themeChange color theme

Utilities

CommandWhat it does
/costToken usage for this session
/statsUsage streaks and preferences
/insightsAnalyze session patterns
/btw <question>Side question that doesn’t pollute your main context
/doctorDiagnose installation issues
/voicePush-to-talk (supports 20 languages)
/usagePlan limits and rate status
/helpFull command reference

CLI Flags

The stuff you type before Claude starts.

# Start a new session
claude

# Resume your last session
claude --resume

# One-shot: run a task and print the result
claude --print "Fix all TypeScript errors in src/"

# Full auto mode — no confirmation prompts
claude --dangerously-skip-permissions "Run tests and fix failures"

# Continue from a specific session
claude --resume --session-id <id>

CLAUDE.md — The File That Changes Everything

Claude reads CLAUDE.md at the start of every session. Automatically. No prompting required.

This is where you write the things you’re tired of repeating.

# My Project

## What this is
SaaS billing dashboard built with Next.js and Stripe.

## Stack
Next.js 14, TypeScript, Supabase, Stripe, Tailwind v4, Vercel.

## Rules
- Always write tests before implementation
- Use pnpm, not npm
- Never modify the database schema directly — use migrations
- Components go in components/ui/

## Key files
- src/app/api/ — API routes
- supabase/migrations/ — schema changes go here
- src/lib/stripe.ts — Stripe integration

## Gotchas
- Auth uses httpOnly cookies, not JWT. Don't replace it.
- The analytics endpoint is rate-limited to 10 req/s.
- We're on Tailwind v4 — no arbitrary values.

The Multi-File Trick

CLAUDE.md files stack:

  • Root CLAUDE.md — global rules for the whole repo
  • Subfolder CLAUDE.md — rules for that module only
  • Claude inherits parent files automatically

This is how I keep different agents working on the same codebase without stepping on each other.


Keyboard Shortcuts

ShortcutAction
Recall last message
Shift + EnterNew line without sending
EscCancel current generation
Cmd + KClear input

Customize everything: /keybindings


MCP Servers — Give Claude Real Tools

MCP (Model Context Protocol) lets Claude talk to your actual infrastructure. Database, GitHub, file system — live data, not copy-paste.

The ones I use:

ServerWhat it does
@modelcontextprotocol/server-filesystemFile access beyond the project directory
@modelcontextprotocol/server-postgresLive database queries
@modelcontextprotocol/server-githubIssues, PRs, repos — all from inside the session
@modelcontextprotocol/server-brave-searchWeb search without leaving Claude
Supabase MCPDirect access to tables, auth, and storage

Set up: /mcp → add server → restart.


Prompt Patterns That Actually Work

After hundreds of sessions, these are the patterns that consistently get better results.

Be the PM, Not the Coder

“The checkout page shows a blank screen after clicking ‘Pay’. Look at the error logs, find the root cause, fix it, and write a regression test.”

Better than: “Fix the checkout page.”

Scope Hard

“Only touch src/checkout/PaymentForm.tsx. Don’t refactor anything else.”

Claude will refactor your entire codebase if you let it. Set boundaries.

Give Context It Can’t See

“The Stripe webhook is failing. Here’s the error from our logs: [paste]. Here’s our current handler: [paste]. Fix it.”

Claude can’t read your server logs. Bring the context to it.

Plan Before You Build

/plan Build a usage-based billing feature using Stripe metered billing

Plan mode forces Claude to think before coding. Use it for anything complex.

Enforce Standards

“We use Tailwind v4. No arbitrary values. All components go in components/ui/. Use cn() for class merging.”


Agentic Mode — Letting Claude Run

When you trust the guardrails:

# Fully automated
claude --dangerously-skip-permissions "Run the test suite, fix any failures, and commit"

Make it safe:

  1. Set limits in CLAUDE.md (“never delete files”, “never force push”, “never modify production env”)
  2. Scope the task — vague prompts get unpredictable results
  3. Run in a branch
  4. Check /diff before you merge

Quick Reference

claude                              Start new session
claude --resume                     Resume last session
claude --print "task"               One-shot (no interactive)
claude --dangerously-skip-permissions  Full auto mode

/init                               Create CLAUDE.md
/compact                            Compress context
/plan                               Plan before coding
/diff                               See what changed
/rewind                             Undo changes
/btw                                Side question
/cost                               Token usage
/effort high                        Crank up reasoning
/doctor                             Fix setup issues

Three Rules I Follow

1. Write CLAUDE.md first. Before you prompt anything on a new project, write the context file. It compounds over every session.

2. Scope every task. “Fix the login bug” gets worse results than “The JWT is expiring too early in src/auth/session.ts — fix the expiry logic and add a test.”

3. Review the diff. Always. /diff before you accept. No exceptions.


Cathryn Lavery

Written by

Cathryn Lavery

Cathryn built and sold BestSelf, bought it back from private equity, and still runs it. She writes Little Might so she doesn't have to keep these lessons in her head.

Related reading