Claude Code for Clinicians Appendix A
Appendices

Appendix A: The Claude Code Cheat Sheet

Print this. Tape it to the side of your monitor. Don’t try to memorize it; just know where to look.


Open / close / reset

What How
Open Claude Code Type claude at your terminal
Close Press Ctrl+C twice
Clear the conversation (keep the project) /clear
Resume the most recent session claude --continue
Pick an earlier session to resume claude --resume
List every slash command /help

The ten essential slash commands

Command What it does
/init Generate a starter CLAUDE.md by scanning the project (then cut it in half)
/clear Wipe the conversation; keep the project open
/compact <focus> Summarize history and continue; always pass a focus
/rewind Restore code or conversation to any earlier point in the session
/model <name> Switch model: haiku / sonnet / opus (alone, shows the current menu)
/cost Session spend in dollars
/permissions Edit the allow and deny lists with a UI
/agents Create or manage subagents
/btw <question> Ask a side question without polluting the main history
/statusline Install a live status display at the bottom of the terminal

Keystrokes worth knowing

Key What it does
Shift+Tab Cycle permission modes, including Plan Mode (Claude writes a plan first)
Ctrl+G Open your draft prompt — or a proposed plan — in your text editor to edit before sending (Chapter 9)
Esc Stop Claude mid-action
Esc Esc Open the /rewind menu (when the input line is empty)
Ctrl+R Search your prompt history
Ctrl+B Background a long-running task
!cmd Run a shell command and put its output into Claude’s context
@path/to/file Reference a specific file directly in the prompt
Ctrl+V Paste a screenshot (Cmd+V in some Mac terminals)

Models, at a glance

Model Use when
Haiku Bulk classification, simple file operations, mechanical work
Sonnet Daily default for most coding
Opus Hard reasoning, suspicious bugs, architecture decisions
Opus + ultrathink Adaptive deep reasoning when you don’t know how hard the problem is
Long-context option in /model When one task needs the 1-million-token context window (plan-dependent)

The 8 built-in tools

The eight tools you’ll see most (Chapter 5 has the long version):

Read Write Edit Bash Glob Grep WebSearch WebFetch

There are a few more — notably Task, which spawns subagents (Chapter 13).

File layout

~/.claude/                           # personal, lives across all projects
├── CLAUDE.md                        # your global preferences
├── settings.json                    # global permissions + hooks
├── commands/                        # your personal slash commands
└── agents/                          # your personal subagents

<your-project>/
├── CLAUDE.md                        # project preferences
├── .claude/
│   ├── settings.json                # project allow/deny + hooks
│   ├── commands/                    # project slash commands
│   ├── agents/                      # project subagents
│   ├── skills/<name>/SKILL.md       # project skills
│   └── rules/                       # conditional rules

Permissions one-liner (.claude/settings.json)

{
  "permissions": {
    "allow": [
      "Read(*)",
      "Bash(npm test)",
      "Bash(pytest *)",
      "Bash(pre-commit run *)",
      "Bash(git status)",
      "Bash(git diff *)",
      "Bash(gh pr *)"
    ],
    "deny": [
      "Read(.env)",
      "Read(secrets/**)",
      "Read(data/patients/**)",
      "Read(*.key)",
      "Read(*.pem)"
    ]
  }
}

Auto-format hook (.claude/settings.json)

{
  "hooks": {
    "PostToolUse": [{
      "matcher": "Edit|Write",
      "hooks": [{
        "type": "command",
        "command": "jq -r '.tool_input.file_path' | xargs -r npx prettier --write 2>/dev/null || true"
      }]
    }]
  }
}

The hook receives a JSON description of the tool call on stdin; jq -r '.tool_input.file_path' pulls out the path of the file Claude just edited. (jq is a small command-line tool for reading JSON.)

Headless and scripting

# One-shot, no prompts
claude -p "fix the failing tests" --allowedTools Read,Edit,Bash

# Pipe a log file in
cat error.log | claude -p "explain this error and suggest a fix"

# Run three parallel worktrees on different branches
claude --worktree feature-auth
claude --worktree bugfix-login
claude --worktree refactor-api

Pricing (as of writing)

Plan Cost When
Pro $20/mo Light daily use
Max 5× $100/mo Regular development work
Max 20× $200/mo Heavy power user, long sessions
API pay-as-you-go Per token Irregular use, or scripted batches

The starter CLAUDE.md

# CLAUDE.md
## Stack
<your stack in one sentence>

## Run / test
- Tests: <command>
- Eval: <command>
- Lint: <command>

## Behavior rules
1. Think before coding: verify, don't guess.
2. Simplicity first: minimum code that solves the problem.
3. Surgical changes: don't touch adjacent code.
4. Tests encode intent.
5. Fail loud: surface every skipped row, null, partial success.

## PHI rules (KHCC)
- MRNs: Optimus-encoded only in outputs.
- Names: Fernet-encrypted, never in logs.
- Eval cohort: frozen deceased-patient set only.

Daily flow

  1. claude to open (or cc if you’ve configured the alias).
  2. /statusline — one-time per laptop.
  3. Shift+Tab into Plan Mode for anything bigger than a one-liner.
  4. Read the plan; ask for changes before approving.
  5. Watch the diff before approving each change.
  6. /clear between unrelated tasks.
  7. /cost before lunch; /cost again before you leave.

Glossary

A one-line definition for the vocabulary used in this book.