What is a command?
When you work with Claude Code, you will encounter three distinct types of input. Understanding the difference between them saves a lot of confusion early on.
A slash command is something you type directly in the interactive session that controls the session itself. Commands like /help, /clear, and /cost do not ask Claude to do anything with your code. They manage the state of the conversation — resetting history, showing token usage, switching models.
A shell command is a terminal instruction you want to run without leaving Claude Code. Prefix it with ! and it executes in your working directory. ! git status runs git status and shows you the output. ! python -m pytest runs your test suite. The result is visible in the session and Claude can read it.
A prompt is plain text — your natural language message to Claude. “Refactor this function to use list comprehension” is a prompt. So is “Why is this model overfitting?”. Prompts are what you send most of the time.
The distinction matters because /clear and clear the conversation do the same thing, but ! ls and list the files do not. The first actually runs ls; the second asks Claude to describe what it thinks is in the directory, which may or may not be accurate.
How to find all available commands
There are two places to look, depending on where you are.
From your terminal, before starting a session:
> claude --help
This shows CLI flags — options you pass when launching Claude Code, like --model, --verbose, or --version. It is the right place to look when you want to understand how to start a session differently.
Once inside a running session, type:
/help
This shows every slash command available in the current version of Claude Code, with a one-line description of each. The list is longer than most people expect. Claude Code is updated regularly and new commands appear without much fanfare, so running /help in an actual session is more reliable than any documentation.
The output format is consistent: command name on the left, short description on the right. Scan it vertically and you will spot commands worth exploring.
Most common and useful commands
Here are the commands you will reach for most often, grouped by what they do.
Starting Claude Code from the terminal:
> claude # [1]
> claude "fix the bug in src/model.py" # [2]
> claude --model haiku "summarize this file" # [3]
# [1] Opens an interactive session in your current directory. Claude loads CLAUDE.md automatically if one exists.
# [2] Starts a session and immediately sends that string as the first prompt. Useful when you already know the task.
# [3] Starts a session with a specific model. Haiku is faster and cheaper; Opus is more capable. You can also switch models mid-session with /model.
Inside a session:
| Command | What it does | When to use it |
|---|---|---|
/help | Lists all available slash commands | When you want to discover what is available |
/clear | Clears conversation history | When context is stale or too large |
/compact | Compresses history to save tokens | When you want to continue but reduce cost |
/cost | Shows token usage and estimated cost | After a long session, before continuing |
/model | Switch model (Haiku / Sonnet / Opus) | When a task needs more or less capability |
/plan | Toggles Plan mode (Claude proposes, does not edit) | When you want to review before any file changes |
/init | Generates a CLAUDE.md for the current project | When starting on a new codebase |
! <cmd> | Runs a shell command inline | ! git diff, ! pytest, ! ls src/ |
/clear and /compact are worth understanding as a pair. /clear wipes the entire history and starts fresh — useful when you have gone down a dead end. /compact keeps recent context but summarizes older turns — useful when a session is going well but getting expensive.
/plan is particularly useful when you are about to make a large change and want to see Claude’s approach before it touches anything. Toggle it on, describe the task, review the plan, then toggle it off when you are ready to proceed.
/init is a one-time operation per project. It reads your codebase and generates a CLAUDE.md with sensible defaults. Run it once in a new repo and then edit the file to fit your actual conventions.