D3 · Claude Code › Cluster 4 · Slash Commands

4.1 · Built-in Slash Commands

The commands you get for free

CONCEPT Type / to control the session

A slash command is an instruction to the Claude Code harness, not a message to the model. You type / at the prompt and an autocomplete menu lists what is available. Most built-ins execute fixed logic directly — they clear context, open a settings dialog, switch a model — rather than asking Claude to do something. A handful of newer entries are bundled skills (marked Skill in the reference): these are prompt-based, giving Claude detailed instructions and letting it orchestrate with its tools.

🔑 A built-in command runs in the harness. That is why /clear can wipe context and /model can swap models — the model itself cannot do those things mid-turn.

CONCEPT The commands worth memorizing

The catalogue is large and grows every release, but the exam-relevant core clusters around context, configuration, and session management.

CommandWhat it does
/helpShow help and the list of available commands.
/clearStart a new conversation with empty context. The old one stays available in /resume. Aliases: /reset, /new.
/compactFree up context by summarizing the conversation so far (same thread). Optional focus instructions.
/configOpen Settings (theme, model, output style…). Alias /settings. Can set key=value directly.
/permissionsManage allow / ask / deny tool rules. Alias /allowed-tools.
/modelSwitch the model and save it as the default for new sessions.
/agentsReminder to create/manage subagents (edit .claude/agents/).
/mcpManage MCP server connections and OAuth authentication.
/initInitialize the project with a CLAUDE.md guide.
/memoryEdit CLAUDE.md memory files; manage auto-memory.
/reviewBundled skill — fast read-only review of a GitHub PR by number.
/costShow usage/cost — it is an alias for /usage.
/resumeResume a conversation by ID or name. Alias /continue.
/contextVisualize current context usage as a colored grid.
/add-dirAdd a working directory for file access this session.
/doctorSetup checkup that diagnoses (and can fix) install issues.
/login · /logoutSign in / out of your Anthropic account.
⚠️ /clear vs /compact is the classic mix-up. /clear discards context and starts fresh; /compact keeps the thread but replaces history with a summary. Use /compact mid-task, /clear between tasks.

DIAGRAM Where a slash command is handled

flowchart TD A["You type at the prompt"] --> Q{"Starts with /?"} Q -->|"no"| MSG["Message → sent to the model"] Q -->|"yes"| K{"Kind of command?"} K -->|"built-in (fixed logic)"| H["🟢 Harness runs it
/clear /model /config"] K -->|"bundled skill (prompt)"| S["🔵 Claude orchestrates
/review /doctor /code-review"] K -->|"custom (your .md)"| C["🟠 Prompt template
expands → sent to model"] classDef ok fill:#d4edda,stroke:#28a745,color:#155724; classDef sk fill:#cfe2ff,stroke:#0d6efd,color:#084298; classDef cust fill:#ffe8cc,stroke:#ff9f40,color:#9a4a0a; class H ok; class S sk; class C cust;

CODE A typical control flow at the prompt

Built-ins are typed straight into the Claude Code prompt (not the shell):

# Inspect and manage the session
/help                      # list every available command
/context                   # see what is eating the context window
/compact focus on the API  # summarize, keep the thread going

# Switch what Claude can do
/model                     # open the model picker, save as default
/permissions               # edit allow / ask / deny rules
/mcp                       # manage MCP servers + OAuth

# Between tasks: wipe context, then resume later if needed
/clear                     # fresh conversation, old one kept in /resume
/cost                      # alias for /usage

TRADE-OFFS /clear vs /compact

✅ /compact — summarize in place

  • Keeps the same conversation and its intent
  • Recovers context budget without losing the thread
  • Accepts focus instructions to bias the summary
  • Best during a long task

⚠️ /clear — start over

  • Empties context entirely — a clean slate
  • Old conversation still reachable via /resume
  • Loses in-thread continuity (nothing carried forward)
  • Best between unrelated tasks

EXAM TRAPS

Trap: "/clear and /compact do the same thing." → No. /clear discards context and opens a fresh conversation; /compact summarizes the current thread to reclaim budget while continuing it.
Trap: "Slash commands are messages to the model." → Built-ins run in the harness. Only custom commands and bundled skills produce a prompt the model reads.
Trap: "/cost is its own separate command." → It is an alias for /usage. Aliases are common: /settings=/config, /allowed-tools=/permissions, /continue=/resume.
Trap: "/agents opens an agent editor." → As of recent versions it just prints a reminder to ask Claude to manage subagents or edit .claude/agents/ directly.

PRACTICE

Q1 · You are deep in a task and context is nearly full but you want to keep going. Which command?

/compact — it summarizes the conversation so far to free context while keeping the same thread. /clear would throw the task away and start fresh.

Q2 · What is the difference between a built-in command and a bundled skill?

A built-in runs fixed logic directly in the harness (e.g. /clear, /model). A bundled skill is prompt-based: it hands Claude instructions and lets it orchestrate with its tools (e.g. /review, /doctor, /code-review).

Q3 · Name the command that manages tool allow/ask/deny rules, and one alias for it.

/permissions; its alias is /allowed-tools. It opens an interactive dialog to view and edit rules by scope.