Skip to content

Keyboard

Shortcuts

Everyone learns Esc. These are the rest — all checked against Claude Code itself, not copied off a blog.

The three to learn first

If you remember nothing else.

  • Esc Esc
    Stop Claude mid-action The moment Claude starts doing something you did not intend.
  • Esc thenEsc Esc thenEsc
    Clear the input box Your half-written prompt has turned into a mess and you want a clean line.
  • Shift +Tab Shift +Tab
    Cycle permission mode Starting an exploration (plan) or letting an agreed plan run (accept edits). On older Windows setups without VT mode, this is Meta+M instead.

Writing the prompt

Composing, searching, pasting.

  • Ctrl +J Ctrl +J
    Start a new line without sending Any prompt longer than one sentence.
  • Ctrl +R Ctrl +R
    Search your prompt history "What did I type last week that worked?" Inside the search, Ctrl+S cycles the scope: this session → this project → everywhere.
  • Ctrl +S Ctrl +S
    Park the half-written prompt You are three sentences into a prompt and need to go check something.
  • Ctrl +G Ctrl +G
    Edit the prompt in your real editor Writing anything long or carefully structured.
  • Ctrl +V Alt +V
    Paste an image Anything visual. Annotate the screenshot first and it works even better. Ctrl+V, not Cmd+V — macOS keeps Cmd+V for its own paste. Windows and WSL use Alt+V. On WSL both Ctrl+V and Alt+V work.
  • Option +T Alt +T
    Toggle thinking for the next turn One hard question in the middle of otherwise simple work.
  • Ctrl +_ Ctrl +_
    Undo in the input box You deleted half a prompt by accident.

Seeing what happened

What Claude did and what it plans to do.

  • Ctrl +O Ctrl +O
    Toggle the full transcript You want to know what it actually did, not the summary.
  • Ctrl +T Ctrl +T
    Toggle the task checklist Any multi-step task, before it gets far.

Running the session

Long jobs, models, the terminal.

  • Ctrl +B Ctrl +B
    Send the running job to the background A long build, test run, or search you do not want to sit and watch.
  • Option +P Alt +P
    Switch model Between tasks — rarely a good idea mid-task.
  • Option +O Alt +O
    Toggle fast mode Straightforward work where you would rather have speed than depth.
  • Ctrl +Z Ctrl +Z
    Step out to the shell without quitting You need the terminal for one command and do not want to lose the session. Terminal-level shortcut (Unix SIGTSTP), not a Claude Code binding. Windows has no direct equivalent.

The keys are the same on both systems — only the modifier's name changes (macOS calls Alt Option). Run /keybindings in any session to see exactly what is bound on your machine.

What a real CLAUDE.md looks like (worked example)

← Tips Context discipline

What a real CLAUDE.md looks like (worked example)

A worked example of a -level , distilled from 's official guidance, Karpathy's viral behavioral rules, HumanLayer's "under 60 lines" guide, and the awesome-claude- curated index. Each section is annotated with why it earns its slot.

beginner

CLAUDE.md is the first file Claude reads at the start of every . Think of it as the briefing you’d give a smart colleague who joined the this morning — what the project is, the conventions that matter, the rules that are non-obvious from the code. Keep it short. ’s own example is a dozen lines; HumanLayer keep their root file under sixty. Past that, important rules start getting filtered out and the document stops being load-bearing.

Here’s a real (lightly fictionalised) example from a small internal project — upgraded from the bare minimum to something genuinely load-bearing:

# project: customer-segments-api

A small Node 22 + TypeScript service that scores retail customers by
spending pattern. Backed by Postgres. Lives behind the internal API
gateway — never exposed to the public internet.

## How this project runs

- `npm run dev` — local dev server on port 3010
- `npm test` — vitest, all suites
- `npm run lint` — eslint + prettier, fixes most things automatically
- **Before you say "done", run `npm test && npm run lint` and paste the
  output. Don't claim success on a green build you didn't run.**

## Conventions that aren't obvious from the code

- Customer IDs (`cust_*`) are PII. **Never log them in plain text.**
  Use `redactCustId()` from `src/lib/log.ts`.
- All money values are integer minor units (cents/lepta), never float.
- Database tables are singular (`Customer`, not `Customers`).
  Plural is reserved for join tables (`CustomerTransactions`).
- Migrations in `db/migrations/` are additive only.
  **Never edit a migration after it has been applied to staging.**

## Where things live

- API routes: `src/routes/`
- Business logic: `src/services/`
- Postgres queries: `src/db/` (one file per table)
- Tests: alongside the source as `*.test.ts`

## How to work on this project

- State your plan in one or two sentences before editing. If you're
  unsure between two approaches, ask — don't pick silently.
- Touch only what the task requires. Don't refactor adjacent code
  "while you're in there".
- Match the existing style of the file you're in, not your own preferences.

See @README.md for product context. Personal overrides live in
@CLAUDE.local.md (gitignored).

That’s it — about forty lines. The art isn’t what you add, it’s what you cut.

What’s in there, and why

The one-paragraph opener. Names the stack, the boundary, and the trust posture in three sentences. Without it Claude defaults to generic Node patterns and won’t know “internal-only” is a hard constraint. (Anthropic’s guidance: include “architectural decisions specific to your project”; exclude long history.)

The commands block. Anthropic’s own include-list opens with “ commands Claude can’t guess” — port numbers, the actual test runner, the lint command. The line about pasting verification output before declaring done is the Karpathy “goal-driven execution” rule compressed to one sentence: define a check, loop until it passes, show the evidence.

The conventions block. Four rules, all of them things a smart new engineer would never guess and would get wrong every time without being told: a PII rule (Claude can’t infer that cust_* is sensitive), a money-representation rule, the singular-table convention, and a negative rule on migrations. The community consensus is that negative rules carry more weight than positive ones — without them Claude picks the most common pattern it knows, which probably isn’t yours.

The “where things live” map. HumanLayer’s WHAT category: a map of the codebase so Claude doesn’t have to grep around to find where a new route belongs. Saves three turns per session, every session.

The behavioural section. The compressed essence of Karpathy’s viral four-rule file: think before coding, surgical changes, match existing style. The full Karpathy file is excellent — you can append it under a ## Behavioural guidelines header if you want more. We kept three lines instead of forty so the document stays scannable.

The @ imports at the bottom. Anthropic’s progressive-disclosure pattern: @README.md loads the README contents only when relevant; @CLAUDE.local.md is the gitignored slot for personal preferences that shouldn’t pollute the team’s shared file.

What’s deliberately not in this file

The project’s history. The architecture diagram. Prose about why we chose . The full README. Anthropic’s own guidance is explicit: “If Claude already does something correctly without the instruction, delete it or convert it to a .” When in doubt, ask: would removing this line cause Claude to make a mistake? If not, drop it.

Two things that catch people out

Your edits don’t apply until you restart. is read once, when the session begins. Adding a rule mid-conversation has no effect on the conversation you’re in — which is why people conclude the file is ignored when it isn’t. See the claudemd-needs-a-restart tip.

A rule only works if it’s checkable. “Keep the code organised sensibly” reads like a rule and does nothing; “all SQL lives in database/” is followable. See the write-rules-for-the- tip for the phrasing test and the deletion test.

Sources

The five sources this example is distilled from — worth reading if you want to go deeper:

Next tip →

/compact and /clear — context-window discipline

Don't carry irrelevant history. Use `/` to summarise the conversation when staying on-task, `/clear` to wipe and start fresh when switching tasks. Know that compacting trades detail for room — for work you care about, a handoff to a fresh preserves more.