,

Slash commands and common command patterns

16 min read
Featured image: Slash commands

You already got Claude Code open once. You asked it something about a repo, watched it read files, maybe approved a small edit. Then lunch happened. You closed the terminal. After lunch you type claude again and feel like a tourist: the model remembers nothing of your careful plan, your half-finished refactor sits half-finished, and you cannot remember whether the command to clear a messy chat was /clear, /reset, or something you invented in a dream.

This is Part 3 of the Claude Code tutorial. Parts 1 and 2 cover install and first run, then how to ask, explore, and change a codebase without thrashing. Here we stay on the control surface you will use every day: slash commands inside a session, plus a small set of shell patterns for starting, continuing, resuming, and one-shot work. Skills (reusable playbooks you can type as /name) get their own deep dive in Part 4. If you still need the product-family map before any of this, start with Claude product map, especially the Code purpose post.

What you’ll learn

  • How to open the command menu with /, filter by typing, and accept with Tab
  • Core session commands: /help, /clear, /login, /exit, and close cousins
  • Shell entry patterns: claude, claude -c, claude -r, claude -p
  • How built-in commands differ from skills that also live under /
  • A practical command map for first hour, mid-task, ship check, and “something broke”
  • Common mistakes that burn context, lose work, or train bad approval habits

Command lists grow with each release. Treat this post as a workflow map grounded in official Claude Code docs at code.claude.com, not a frozen encyclopedia of every flag. When in doubt, type / in your install and trust what your version shows.

Two places “commands” live

People get confused because English uses “command” for two different doors.

Door 1: the shell. You are outside Claude Code, in zsh, bash, PowerShell, or your IDE terminal. You type things like claude or claude -p "explain this". Those start, continue, or script a session. They are CLI entry points.

Door 2: the slash menu. You are already inside a Claude Code session. You type / at the start of a message. That opens the in-session command list: help, clear, model switches, reviews, skills, config panels. Official docs call these session commands. Many are built-in (fixed product logic). Others are skills (prompt playbooks you or Anthropic ship as SKILL.md style packages). From the keyboard they both look like /something.

If you mix the doors, you type /clear in a bare terminal and nothing useful happens, or you type claude -c inside a chat box and Claude treats it as prose. Same brand. Two keyboards.

Slash command map: type slash to open the menu, Tab to complete, then groups for session, task, review, and exit
Slash command map: type slash to open the menu, Tab to complete, then groups for session, task, review, and exit

The slash menu: type /, filter, Tab

Inside an interactive session, type / as the first character of your message. Claude Code shows every command available to you. Availability depends on plan, platform, and version, so your list will not match a screenshot from a stranger’s laptop.

Type more letters to filter. /he narrows toward /help. /cl might show /clear, /claude-api, and friends. Press Tab to accept a completion when the UI offers one (paths and partial names also complete in several places). You do not need to memorize the full catalog on day one. You need the reflex: slash, filter, pick, send.

A few rules from the product behavior as of writing:

  • A command is recognized at the start of the message. Free text after the name becomes arguments.
  • If Claude is mid-response and you send another command, many commands queue until the turn finishes. A few status-style commands can run immediately without interrupting the answer.
  • Skills can stack at the front of a message in newer versions (for example two skill names then shared trailing text). Built-in fixed commands still follow the older “one command at the start” mental model. When something feels weird, read the docs for your version.

Habit: When you forget a name, type / and hunt. Do not invent fake slash names out of muscle memory from another product. Wrong / strings often become confusing chat text instead of controls.

Starter pack: four commands everyone should know

You can live for a week on a tiny set if you are still learning the agent loop. Expand later.

/help

/help is orientation. Use it when the UI changed after an update, when you joined a new machine, or when a teammate said “just use the review command” and you blanked on the exact name. Help is cheaper than guessing wrong and burning a long agent run.

/clear

/clear starts a new conversation with empty chat context (aliases like /reset or /new may exist depending on version). Project memory such as CLAUDE.md still loads on the next work; you are not wiping the repo’s standing instructions. You are wiping the chat that got polluted with three abandoned approaches, a wrong file path you kept defending, and a digression about lunch.

Use clear when the task changed. Do not use clear as a panic button when you merely feel embarrassed. If the conversation is long but still on-task, prefer compaction-style tools (often /compact) so Claude keeps a summary instead of forgetting the plan. Part 5 of this series goes deeper on memory and context; for now, remember: clear is a new chat, not a soft tidy.

/login

Authentication is a first-class pain point. Seats expire, tokens rotate, someone switches from API billing to a Claude subscription, CI boxes need different credentials than your laptop. When Claude cannot reach a model, or when you need to re-authenticate after a policy change, reach for login-style flows rather than reinstalling the whole tool. Official CLI also exposes shell-side auth helpers such as claude auth login and claude auth status. Inside the session, use the login command your version lists under /.

/exit

/exit (and often /quit) leaves the interactive CLI. On some background or attached agent views, exit may detach rather than kill a remote run. If you meant “stop the agent hard,” check whether you need a stop command for a background session instead of exit. Leaving cleanly is better than force-killing a terminal and wondering whether a half-written file still has a lock.

Shell patterns: start, continue, resume, one-shot

Before any slash menu exists, you start Claude Code from the shell. These four patterns cover most beginner and intermediate days. Full flag lists live in the CLI reference; you do not need them all to work.

Four shell patterns: claude for interactive, claude -c continue, claude -r resume by name or id, claude -p one-shot print mode
Four shell patterns: claude for interactive, claude -c continue, claude -r resume by name or id, claude -p one-shot p…

claude: interactive session

From a project directory:

cd ~/work/my-app
claude

You get an interactive session bound to that working directory. You can also start with a first prompt:

claude "Map how auth is enforced for the admin API. Cite file paths."

Interactive mode is the default learning surface. You read diffs, answer permission prompts, steer mid-task, and use slash commands.

claude -c: continue the most recent chat here

claude -c (long form --continue) loads the most recent conversation for the current directory. That includes sessions that added this directory with extra directory access, depending on product rules. Use it when you stepped away for coffee and the terminal closed, but the work is the same branch and the same problem.

cd ~/work/my-app
claude -c

Continue is not magic time travel across unrelated folders. If you cd into a different project and hit -c, you continue that other project’s latest session, not the one you meant. Directory context is part of the contract.

claude -r: resume a named or id session

claude -r (long form --resume) picks a specific session by id or name. Use it when “most recent” is wrong: you bounced between a bugfix and a docs pass, or you named sessions on purpose.

claude -r "auth-refactor" "Finish the remaining tests for the middleware change."

Resume is how multi-day work stays sane. Without it, people paste giant summaries into a fresh chat every morning and hope the model reconstructs intent. With it, you reopen the thread that already holds the investigation.

claude -p: one-shot print mode

claude -p (also called print / non-interactive mode in docs) runs a query and exits. It is for scripts, CI snippets, quick questions you do not need a chat UI for, and pipes.

claude -p "In one short paragraph, what does this repo's main package export?"

cat error.log | claude -p "Explain the most likely root cause in plain English."

One-shot is not a replacement for multi-file refactors that need back-and-forth permissions. It is a power tool for bounded questions and automation. If you find yourself chaining twenty -p calls to mimic a conversation, stop and open interactive mode.

A command map by moment in the day

Memorizing a table is less useful than knowing when a command earns its seat. Here is a practical map. Exact names can vary by version; the jobs stay stable.

MomentPreferWhy
First open in a new repoShell claude, then explore prompts; later /init style project setup if your version offers itYou need orientation before automation
Back from lunch, same taskclaude -c or claude -rKeep investigation context
Chat got polluted/clear for a new task; /compact when the same task is longWrong tool for the wrong mess
Need a side question without derailingSide-question commands such as /btw when availableKeeps main thread clean
About to shipDiff viewers, review skills like /code-review, tests you run yourselfAgent confidence is not CI
Auth or install weirdness/login, shell claude auth status, /doctor or claude doctorFix the platform before blaming the model
Done for the day/exit; stop background agents intentionallyLeave no zombie sessions

Built-in commands vs skills under the same slash

Two entries can both start with / and still be different animals.

Built-in commands implement fixed product logic: clear context, open settings, exit, show usage, change model. They do not “improvise” the way a long prompt does. When they fail, it is usually configuration, permissions, or network, not “the model got creative.”

Bundled skills such as /code-review, and many team custom skills, hand Claude a detailed playbook and let it orchestrate tools. Official docs describe bundled skills as prompt-based: Claude reads instructions and works with tools rather than executing a single hard-coded subroutine. That is why a skill can spawn agents, read files, and adapt to your tree.

Custom skills live under paths like .claude/skills/name/SKILL.md (project) or ~/.claude/skills/name/SKILL.md (personal). You can invoke them as /name. Legacy custom commands under .claude/commands/ still work; skills are the recommended home because they support supporting files and automatic loading when relevant. Part 4 is the full skills lesson. For this post, the takeaway is simple: if a slash name feels like a mini-workflow, it is probably a skill. If it feels like a light switch for the product, it is probably built-in.

Worked mini-session: same bug, three shell patterns

Imagine a flaky test in tests/test_billing.py. You have thirty minutes before a standup.

Morning open (interactive):

cd ~/work/billing-service
claude
# then, in the session:
# "Read tests/test_billing.py and the code it covers. List three plausible causes of flakiness. Do not edit yet."

You explore. You approve a few reads. Standup interrupts you. You exit.

After standup (continue):

cd ~/work/billing-service
claude -c
# "Continue from the flakiness list. Add a failing reproduction if you can find one. Still no production deploy."

Later, for a scripted summary to paste into Slack (one-shot):

claude -p "Summarize the current uncommitted diff in three bullets for a non-expert. No code edits."

If yesterday’s auth-refactor session is the one you need, not today’s most recent chat, use resume instead of continue:

claude -r "auth-refactor" "Re-check the middleware tests after the rebase."

That is the whole pattern family: interactive for steering, continue for the latest thread, resume for a chosen thread, print for a closed question.

Commands that shape quality mid-task

Once the starter pack is automatic, a second tier pays rent on real workdays.

Context hygiene

Long sessions fill the context window with dead ends. Tools such as /context help you see what is eating space. /compact summarizes to free room while keeping the same conversation. /clear is the hard reset when the task itself changed. Using clear for every awkward silence trains you to lose hard-won investigation. Using compact never, while pasting the same stack trace five times, trains the model on noise.

Model and effort switches

Many installs expose model selection and effort controls as slash commands (names like /model and /effort appear in official command tables). Cheap and fast is fine for “where is this function defined.” Harder multi-file reasoning may need a heavier model or higher effort. Switching mid-session is a product feature; thrashing every two minutes is not a strategy. Pick a lane for a task, then stick with it until the task ends or clearly fails.

Review and ship helpers

Bundled skills such as /code-review exist to inspect diffs for correctness and cleanup. Other review-related commands target pull requests or security-shaped checks. They are assistants for your judgment, not a substitute for tests, CI, or a human merge. Use them when the diff is large enough that skimming alone is unreliable. Do not use them as a moral license to skip reading the change.

Diagnostics

When the product itself misbehaves, prefer doctor and debug style commands over random reinstalls. Shell claude doctor can print read-only diagnostics without a full interactive ritual. In-session checkup skills may offer fixes with confirmation. If auth is the issue, login first. If PATH has two Claudes fighting, doctor-style output is the map.

Arguments: text after the command name

Most session commands accept trailing text as arguments. Examples of the shape (exact support depends on the command):

/compact Focus on the billing migration decisions, drop the CSS digression.
/code-review medium
/btw What does the AcmeClient class do in one sentence?

For skills, arguments often map into placeholders such as $ARGUMENTS inside the skill file. You do not need to author skills yet to use that idea: whatever you type after the skill name is the payload the playbook receives. Keep arguments short and concrete. A paragraph novel after a slash name is usually a sign you wanted a normal chat message instead.

What not to put in the slash box

Slash is for control and named workflows. Everyday steering still belongs in normal language:

  • “Do not touch production configs.”
  • “Show me the plan before editing.”
  • “Only change files under src/billing/.”
  • “Stop after the failing test is isolated.”

Standing rules for a project belong in CLAUDE.md and related instruction files (Part 6 of this series). Repeatable multi-step procedures belong in skills (Part 4). If you keep pasting the same 12-line ritual every Tuesday, that is a skill candidate, not a longer slash argument forever.

Common mistakes

Treating /clear as “undo”

Clear empties conversation context. It does not magically reverse file edits already applied. For rollback, use git and product rewind features if available. Confusing chat reset with filesystem undo is how people lose the plot of what actually changed on disk.

Continuing the wrong directory

claude -c is directory-scoped in spirit. Running it from ~/Downloads after you meant the service monorepo continues the wrong story. Always cd first. Say the path out loud if you have to.

One-shot for multi-step agent work

claude -p shines for closed questions. It is a poor default for “migrate this package and open a PR” because you lose the interactive permission and steering loop. Use interactive when the blast radius is real.

Inventing slash names

If /ship-it-please is not in the menu, typing it will not summon a hidden deploy fairy. Type / and filter. Or create a real skill in Part 4 when you want a named workflow.

Ignoring version drift

Command tables move. A blog post from last quarter may name a command that is now a skill, or a skill that gained new flags. When something fails with “unknown command,” run /help, check claude --version, and open the live docs rather than forcing outdated muscle memory.

Approving because the command menu felt official

Slash commands can still lead to shell tool use and file edits. Official does not mean risk-free. Read permission prompts the same way you would if you typed the shell string yourself.

FAQ

Is /help the same as reading the docs?

No. Help is local to your install and great for discovery. Docs at code.claude.com stay authoritative for full behavior, version notes, and edge cases. Use both.

Do I need skills to use slash commands?

No. Built-ins work without writing any skill files. Skills extend the slash menu with your team’s playbooks and with Anthropic’s bundled playbooks. Part 4 covers adding your own.

What about .claude/commands/?

Legacy custom command files still work. Prefer .claude/skills/<name>/SKILL.md for new work. Same /name idea, more room to grow.

How is this different from chat slash tools on claude.ai?

Claude Code’s slash menu is tied to coding-agent sessions: repo context, tools, permissions, CLI lifecycle. Consumer chat surfaces have their own features. Do not assume every chat shortcut exists in Code or the reverse. The product map series keeps those doors separate on purpose.

How to practice

  1. Open a throwaway or personal repo. Run claude. Type / and scroll the real list on your machine. Write down five names you recognize and two you do not.
  2. Ask a small explore question. Exit with /exit. Run claude -c from the same directory and confirm the thread continues.
  3. Run one claude -p question against the same repo. Notice what you cannot do as easily without interactive permissions.
  4. Deliberately derail a chat with an unrelated topic, then practice choosing: compact to stay on task vs clear to switch tasks.
  5. If auth is healthy, still run a status check once so you know what “logged in” looks like before a crisis.
  6. Tomorrow, before inventing a new ritual, type / first and see if the product already has a name for it.

What comes next

Part 4 of the Claude Code tutorial is skills: what a SKILL.md is, where personal vs project skills live, how to invoke /name, how auto-loading works, and how skills differ from always-on CLAUDE.md. Later parts cover memory, instruction files, plugins, agent loops, diff review, and team rails.

If you need the wider product family again (Code vs Cowork vs chat vs API), return to Claude product map. For everyday non-coding Claude habits, Learn Claude from scratch still applies. Vendor-neutral verification habits live in the Practical AI series.

Quick recap

  • Shell commands start and resume sessions; slash commands control work inside a session.
  • Type / to list, type letters to filter, Tab to complete when offered.
  • Know /help, /clear, /login, /exit cold.
  • Shell patterns: claude interactive, claude -c continue, claude -r resume, claude -p one-shot.
  • Built-ins flip product switches; skills run playbooks. Both can appear under /.
  • Clear is a new chat, not undo for files. Continue is directory-aware. One-shot is not a full agent day.
  • When names drift, trust your live / menu and code.claude.com over memory.

Sources

Official Claude Code documentation used for command and CLI claims in this article (re-check after upgrades):