Everything from the rest of the guide, condensed to what you'll actually look up in a running session. Skim it once end to end, then treat it as a map: you'll know where to jump for the exact flag, command, or ratio you need.

Print this page

This page is designed to print cleanly. Cmd+P → single column → fits on two sides of A4. The first side covers commands, shortcuts, and flags; the second side covers file layout and patterns. Most teams I've seen get real value out of taping side one above their monitor for the first month.

Slash Commands

Type / in any session to get autocomplete. Everything below is built in — custom commands live in .claude/commands/ (project) or ~/.claude/commands/ (personal).

Session control

CommandWhat it does
/helpList every command available, built-in and custom
/clearReset the conversation. Context window → empty. Use before a new task.
/compact [instruction]Summarize conversation so far, keep the summary, drop the detail. Optional instruction steers what gets preserved.
/contextBreakdown of what's loaded: system prompt, CLAUDE.md, tools, conversation.
/costTokens spent and dollars burned in the current session.
/statusModel in use, permission mode, connected MCP servers, active hooks.
/resumePick a past session from a list and pick up where it ended.
/exit (or /quit)End the session cleanly.

Configuration

CommandWhat it does
/initScaffold a CLAUDE.md in the current repo. Claude reads the codebase and writes a first draft.
/memoryOpen any CLAUDE.md (project, personal, parent) in your editor.
/configOpen the settings UI — model, theme, notifications, telemetry.
/permissionsView/edit the allow, ask, deny lists. Cheaper than opening settings.json by hand.
/modelSwap models mid-session (Opus ↔ Sonnet ↔ Haiku).
/agentsManage subagent definitions at .claude/agents/ and ~/.claude/agents/.
/mcpList every connected MCP server, with status and exposed tools.
/hooksList every registered hook with matcher and command.

Operational

CommandWhat it does
/reviewCode review pass on the current diff.
/doctorDiagnose setup issues — auth, network, MCP, installer location.
/migrate-installerMove a global npm install to the local-managed installer.
/bugOpen a GitHub issue pre-filled with session metadata.
/login / /logoutRe-auth or sign out.

The inline prefixes

Three characters change the meaning of what you type, not just the tool:

  • @ — reference a file or folder. @src/auth.ts pastes the path and loads it into context.
  • # — add to memory. # never use any as a type appends to CLAUDE.md.
  • ! — shell mode. !git status runs the command inline; Claude sees the output but doesn't re-enter it.

Keyboard Shortcuts

Inside the Claude CLI — not your terminal emulator's shortcuts. These are muscle memory worth building.

Modes and interruption

KeysWhat it does
Shift + TabCycle: normal → auto-accept edits → plan mode → normal
EscInterrupt Claude's current action (stop streaming, cancel tool call)
Esc × 2Jump back to a previous turn and edit from there
Ctrl + C × 2Hard exit the session
Ctrl + DExit when the input buffer is empty

Input

KeysWhat it does
/ Cycle through your recent prompts
Ctrl + RReverse-search your prompt history
\ + EnterInsert a newline mid-prompt (so Enter sends)
Option + Enter (mac) / Alt + Enter (linux)Alternative newline
TabAutocomplete commands, file paths, and @-mentions
Cmd + V / Ctrl + VPaste; images paste inline on macOS terminals that support it

Useful to remember

ComboContext
!EnterDrop into shell mode for a single command
# → free textAppend that text to CLAUDE.md
/ → autocompleteFastest way to discover commands you haven't used
Shift + Tab × 2The one to remember: activates Plan Mode

If nothing works

If shortcuts misbehave, it's almost always your terminal eating the key. iTerm2, Warp, and Alacritty all work out of the box. VS Code's integrated terminal sometimes swallows Shift + Tab — use an external terminal for heavy work.

CLI Flags

Everything you can pass to claude on the command line. The headless and scripted usages live here.

Starting a session

bash
claude                           # interactive, fresh session
claude -c                        # continue the last session
claude -r                        # resume — pick from a list
claude --resume <session-id>     # resume a specific session
claude "review my latest diff"   # interactive, with a first prompt already set

Headless / one-shot (-p)

bash
claude -p "summarize README.md"                       # one-shot, prints result, exits
claude -p "..." --output-format json                  # structured output for scripts
claude -p "..." --output-format stream-json           # streaming events (assistant/tool)
claude -p "..." --input-format stream-json            # accept streamed JSON on stdin
claude -p "..." --include-partial-messages            # include partial chunks in stream
claude -p "..." --max-turns 3                         # hard cap on agentic loops
echo "prompt" | claude -p                             # stdin works too

Model and context

FlagEffect
--model opus|sonnet|haikuPick the model for this run
--fallback-model sonnetFallback if the primary is overloaded
--add-dir <path>Add another working directory Claude can read/edit
--append-system-prompt "..."Glue extra instructions onto the system prompt
--setting-sources user,project,localChoose which settings layers load
--session-id <uuid>Use/create a session with a specific UUID
--agents '{"reviewer":{...}}'Inject agent definitions as JSON inline

Permissions and safety

FlagEffect
--permission-mode default|acceptEdits|plan|bypassPermissionsStart the session in a given mode
--allowed-tools "Read,Grep,Bash(npm test*)"Allow only these tools
--disallowed-tools "Bash(git push*)"Block these tools outright
--permission-prompt-tool <mcpTool>Route permission prompts through an MCP tool
--dangerously-skip-permissionsNo prompts at all. Sandbox-only. Do not use on your main machine.

MCP and plugins

bash
claude --mcp-config ./.mcp.json               # load MCP servers from a file
claude --strict-mcp-config                    # ignore all other MCP sources
claude --plugin <name>                        # load a plugin

Subcommands

bash
claude config get <key>                       # read a setting
claude config set <key> <value>               # write a setting
claude config set -g theme dark               # global setting
claude mcp add <name> -- <cmd>                # register an MCP server
claude mcp list                               # list registered servers
claude mcp remove <name>                      # deregister
claude update                                 # self-update the CLI
claude migrate-installer                      # move from global npm to managed installer
claude doctor                                 # diagnose the install
claude --version                              # print version
claude --help                                 # full flag reference

The two flags to be careful with

  • --dangerously-skip-permissions — exactly what it says. Use it only inside a disposable container or sandbox. On a real developer box, something is eventually going to run that you didn't want to.
  • --output-format stream-json + shell pipes — parse the JSON. Do not grep for words inside tool-call results. The schema changes; strings don't.

File Structure

Everywhere Claude Code reads from and writes to. If something is misbehaving, the fix is almost always in one of these files.

Personal (follows you across repos)

~/.claude/
~/.claude/
├── CLAUDE.md              # your cross-project preferences (style, verbosity, habits)
├── settings.json          # personal defaults: model, theme, telemetry, hooks
├── commands/              # personal slash commands, available everywhere
│   └── *.md
├── agents/                # personal subagent definitions
│   └── *.md
├── plugins/               # installed plugins
├── projects/              # one folder per repo you've used; sessions live here
├── todos/                 # in-flight task state
├── statsig/               # feature-flag cache
└── shell-snapshots/       # per-session shell env capture

Project (committed or .gitignored per team preference)

project root
<repo>/
├── CLAUDE.md                    # the project's shared context (commit this)
├── AGENTS.md                    # multi-agent team charter (commit this)
├── .mcp.json                    # project-scoped MCP servers (commit this)
├── .claude/
│   ├── settings.json            # committed team defaults: model, hooks, permissions
│   ├── settings.local.json      # per-dev overrides (.gitignore this)
│   ├── commands/                # shared slash commands (commit)
│   │   └── <name>.md
│   ├── agents/                  # shared subagent specs (commit)
│   │   └── <name>.md
│   ├── hooks/                   # hook scripts referenced by settings.json
│   └── plan.md / impl-done.md   # ephemeral agent handoffs (.gitignore these)
└── src/
    └── <any subdir>/CLAUDE.md   # subtree-scoped context, loaded when Claude works here

Settings precedence (last wins)

  1. Enterprise managed policy (if any)
  2. ~/.claude/settings.json
  3. <repo>/.claude/settings.json
  4. <repo>/.claude/settings.local.json
  5. Inline CLI flags (--model, --allowed-tools, etc.)

Memory precedence (all loaded, merged top-to-bottom)

  1. ~/.claude/CLAUDE.md — your personal memory
  2. Parent directory CLAUDE.md files — walked upward from CWD
  3. <repo>/CLAUDE.md — the project memory
  4. <repo>/<subdir>/CLAUDE.md — loaded when Claude works inside that subtree

.claude/ and .gitignore

Never blanket-ignore .claude/. Commit settings.json, commands/, agents/, and hooks/ — those are team artifacts. Ignore settings.local.json, plan.md, impl-done.md, review.md, and anything else generated mid-session. The split is worth setting up once:

.gitignore
.claude/settings.local.json
.claude/plan.md
.claude/impl-done.md
.claude/review.md
.claude/handoffs/

Patterns

The shapes worth having in muscle memory — each one links back to the chapter that covers it in full.

Workflow rhythms

PatternWhen to reach for itFull chapter
Explore → Plan → Execute → VerifyEvery non-trivial changeWorkflows
Plan ModeAnything touching more than one fileWorkflows
The Big PromptOne shot at a large, well-shaped taskWorkflows
Best of NHigh-stakes work where a second opinion is cheapWorkflows
Context HandoffEnd of day, switching tasks, hitting 70% contextWorkflows

Extension decisions — when to reach for each

LayerUse when
CLAUDE.mdThe rule applies every session in this repo
Slash commandYou re-type the same prompt shape more than 3×
SkillClaude needs procedural know-how to do a recurring task
HookYou want deterministic side effects (lint, audit, block)
SubagentA task is self-contained and pollutes main context
Agent teamDifferent roles, persistent handoff files, human gates
MCPClaude needs live data or actions outside this repo

Model routing — starting heuristic

ModelUse forDon't use for
HaikuClassification, extraction, commit messages, log triageAnything requiring a plan
SonnetDefault. Feature work, reviews, single-file edits, most promptsMulti-file architectural work
OpusArchitecture planning, debugging genuinely unknown territory, AGENTS.md authoringRote edits, anything you could have batched with a hook

Context budget traffic lights

/context showsStateDo
0–50%GreenKeep going
50–70%YellowFinish the logical unit, then consider /compact
70–85%OrangeWrite a handoff, /clear, resume with the handoff
85%+RedStop. Anything you do here is expensive and unreliable.

Permission shapes worth copying

.claude/settings.json — baseline
{
  "model": "sonnet",
  "permissions": {
    "allow": [
      "Read", "Glob", "Grep",
      "Bash(npm run lint)", "Bash(npm test*)",
      "Bash(git status)", "Bash(git diff*)", "Bash(git log*)"
    ],
    "ask": [
      "Write", "Edit",
      "Bash(git push*)", "Bash(git checkout*)"
    ],
    "deny": [
      "Read(./.env)", "Read(./.env.*)",
      "Bash(cat .env*)",
      "Bash(rm -rf*)",
      "Bash(git push --force*)",
      "Bash(curl* | bash)", "Bash(wget* | bash)"
    ]
  }
}

Hook shapes worth copying

PostToolUse lint fixer
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "npm run lint -- --fix $CLAUDE_FILE_PATHS 2>&1 | tail -20"
          }
        ]
      }
    ]
  }
}
PreToolUse shell audit
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "echo \"$(date -u +%FT%TZ) | $CLAUDE_TOOL_INPUT\" >> ~/.claude/bash-audit.log"
          }
        ]
      }
    ]
  }
}

Prompt stems worth reusing

explore-only
Explore only — do not edit any files.
Read [paths]. Report: what exists, what surprised you, what's missing.
plan phase
Plan Mode. Produce a plan: files touched, functions changed, tests,
risks, ambiguities. Save to .claude/plan.md. Do not write any code.
verify phase
Run lint, typecheck, and tests. Then `git diff`. Tell me: does the diff
match the plan? List any divergence.
handoff
Write a handoff to .claude/handoff-[name].md:
1. What we were doing and why
2. What's done (with paths)
3. What's not done and why
4. The exact prompt to resume, ready to paste
5. Anything non-obvious that isn't in the files

The one rule

If something keeps breaking the same way twice, it belongs in a hook, a skill, a slash command, or CLAUDE.md — not in your next prompt. Every time you solve a recurring problem by retyping, you're losing the leverage the extension layers exist to give you.