# Prompt Mode and Prefixes

<SlideStart />

## The Three Prompt Modes

Claude Code has three operating modes. Each one defines what Claude is allowed to do during a session.

You start every session in **Default mode**. The other two are opt-in — activated when the situation calls for them.

<SlideEnd />

<SlideStart />

### Default Mode

**Default mode** is the starting point for every session. Claude can read files, write files, run commands, and act on its own judgment.

There is nothing to configure — you are already in Default mode the moment you open Claude Code.

<Callout type="tip">Default mode is appropriate for most tasks. Use the other modes only in specific situations, not as a habit.</Callout>

<SlideEnd />

<SlideStart />

### Plan Mode

**Plan mode** removes the ability to act. Claude can read and reason freely, but it will not edit any file or run any command. It describes what it *would* do instead.

**When to use it:**
- Before a large refactor you have not fully mapped out
- When touching code you do not fully understand
- Any time you want to review an approach before anything changes

**Activate:** `Shift+Tab` twice, or type `/plan` — **Exit:** `Shift+Tab` once, or `/plan` again

<Callout type="tip">Plan mode costs nothing and can save you from a bad refactor. Run it first on any task that touches unfamiliar files, then switch back once you are satisfied with the plan.</Callout>

<SlideEnd />

<SlideStart />

### Accept Edits Mode

**Accept edits mode** does the opposite of Plan mode. Claude applies file edits automatically, without stopping to ask for confirmation on each change.

**When to use it:**
- After reviewing a plan — you understand what will happen
- When running a batch of changes without interruption

**Activate:** `Shift+Tab` once from Default mode — **Exit:** `Shift+Tab` once to return to Default mode

<Callout type="warning">Only use Accept edits mode after reviewing a plan first. Changes apply immediately — there is no confirmation prompt to catch mistakes.</Callout>

<SlideEnd />

<SlideStart />

## The Input Prefixes

Prefixes are single characters you place immediately before a word. Each one changes how Claude Code interprets that input.

| Prefix | Name | What it does |
|--------|------|--------------|
| `@` | File reference | Include a file or directory in context |
| `!` | Shell command | Run a command and pass its output to Claude |
| `&` | Background task | Run a command in the background while Claude continues |
| `#` | Comment | Record a note in the session log without sending it to Claude |

Prefixes work in both interactive and non-interactive sessions, and you can combine more than one in the same message.

<SlideEnd />

<SlideStart />

### @ — File Reference

The `@` prefix includes a specific file or directory in Claude's context for that message. Without it, Claude may read several files to orient itself. With it, you point directly to what is relevant.

```bash
# Include a single file
> @src/model.py explain the forward pass

# Include multiple files at once
> @src/preprocessing.py @tests/test_preprocessing.py the test is failing — why?
```

This reduces token usage and focuses Claude on the relevant code. In a large project with dozens of modules, you will see fewer unnecessary file reads.

<SlideEnd />

<SlideStart />

### ! — Shell Command

The `!` prefix enters bash mode — the input is run directly as a shell command, without Claude interpreting it. The command output is added to the conversation context. You then ask Claude about it in the next message.

```bash
# Step 1: run the command
! pytest tests/test_model.py -v

# Step 2: ask Claude about the output
> what is causing the assertion error in test_predict?
```

```bash
# Step 1: add the git log to context
! git log --oneline -10

# Step 2: ask Claude to reason about it
> which of these commits is most likely to have introduced the regression?
```

This is particularly useful for data scientists: run a training job output, a dataset shape check, or a notebook cell result, then ask Claude about it without leaving the session.

<SlideEnd />

<SlideStart />

### & — Background Task

The `&` prefix runs a command in the background. Claude Code returns a background task ID immediately and can continue responding to prompts while the command executes.

```bash
# Start a long training run in the background
> & python src/train.py --config configs/default.yaml

# Continue working while it runs
> @src/evaluate.py review the evaluation logic while the training runs
```

Use it for anything slow — training jobs, test suites, data pipelines — where waiting is just wasted time.

<SlideEnd />

<SlideStart />

### # — Comment

The `#` prefix records your input in the session log without sending it to Claude as a prompt. Claude does not respond to it.

Use it to leave a note mid-session without breaking your flow:

```bash
# Trying the sklearn approach first — may switch to custom transformer if it fails
> @src/features/transform.py refactor the imputation step to use ColumnTransformer
```

The comment stays visible in your session history as a reference for yourself, while Claude proceeds as if it wasn't there.

<SlideEnd />

<SlideStart />

### Combining Prefixes

The prefixes complement each other within the same session. Use them in sequence to build up the context Claude needs before asking your question.

```bash
# Add a file to context
> @src/train.py

# Run a command to get its output into context
! python -c "import src.train; print(src.train.__version__)"

# Now ask Claude with full context available
> does the version in the file match what Python reports?
```

By the time you ask the question, Claude has the file and the command output in context.

<SlideEnd />