On this page
Claude Code Slash Commands: What They Do & When to Use Them
This guide organizes Claude Code's 90+ slash commands by real-world operational use case, not alphabetical order. Learn which commands streamline session setup, context management, autonomous workflows, and pre-merge reviews, plus key tips to avoid unexpected costs and boost daily productivity.
That internal usage stat is a useful lens for understanding why the CLI tool’s command surface has grown so large. Claude Code exposes 90+ slash commands for controlling session behavior, managing permissions, spawning subagents, reviewing diffs, compacting context, and orchestrating long-running work. Most developers use three or four. The rest sit dormant until you need them.
This guide organizes the command surface by what you’re actually trying to accomplish — not alphabetical order. If you’ve already read our Claude Code commands complete reference, you have the full catalog. Here, I’ll focus on the operational patterns and the tradeoffs that matter when you’re deciding which commands belong in your daily workflow.
How Commands Fit the Session Lifecycle
Every slash command must appear at the start of a message. Anything after the command name gets passed as arguments. Type / to see everything available in your installation, or / followed by letters to filter. The list updates with each release, so the in-CLI menu is always authoritative.
Commands control session behavior — context, mode, output review — and do not run code directly. CLI flags like --headless or --dangerously-skip-permissions are passed at launch and cannot be changed mid-session. Both are part of Claude Code, but they operate at different layers. If you’re building CI/CD pipelines, most commands work in headless mode, including /clear, /compact, and custom commands.
The typical workflow follows a predictable arc:
- Setup:
/init→/memory→/mcp→/agents→/permissions - Work:
/plan→/model→/compact(as needed) - Parallelize:
/agents,/tasks,/background,/batch,/fork - Ship:
/diff→/code-review→/security-review→/review - Between sessions:
/clear,/resume,/rewind
/init generates a starter CLAUDE.md file for the project and creates the .claude/ directory. That file becomes Claude’s instruction manual for every future session in that project. Get it right and the rest of your sessions will be significantly more consistent. If you want to go deeper on configuration formats, our guide to Claude Code skills, Cursor rules, and AGENTS.md breaks down the layered approach.
The Three Commands That Prevent Cost Surprises
If you’ve read our Claude Code pricing deep dive, you know the subscription-versus-API decision changes your bill by an order of magnitude. But within the subscription model, three commands can run for hours and bill accordingly if left unattended: /loop, /goal combined with /loop, and /schedule.
/loop repeats a prompt on an interval. /goal sets a finish condition for autonomous work — Claude keeps going until the condition is met. /schedule creates cloud cron routines. All three are powerful. All three will happily consume your entire credit pool if you walk away without a clear termination condition.
The practical advice: run /usage before starting any autonomous workflow. It shows session cost and plan usage (aliases include /cost and /stats). If you’re on a Max plan with a 5-hour rolling session window, heavy chat use during the day leaves fewer Claude Code turns in the evening. The command makes that visible before you commit to a long run.
/compact deserves special mention. It summarizes the conversation to free context window space and is widely considered the most important command for long sessions. When your context window fills past 80%, model quality degrades — instructions get dropped, and you’ll notice the agent ignoring constraints it honored earlier. /compact is how you stay in the game without starting over.
Context Management and Recovery
/context visualizes current context usage as a percentage or colored grid. /context [all] shows full usage. This is your early warning system.
When you do need to reset, /clear (aliases /reset and /new) wipes conversation history but keeps project memory. The newer /rewind command, added in v2.1.191, rolls back to a checkpoint before /clear was run, restoring prior context so the session continues. Before /rewind, an aggressive clear meant you relied on /resume for a saved session — not the in-flight thread. The recovery story is now much cleaner.
/resume (alias /continue) reopens a past conversation by ID or search term. /branch (alias /fork) creates a branch of the current conversation at a specific point, which is useful when you want to try two approaches from the same starting state.
Subagent Orchestration
/agents manages subagents for parallel work. /tasks manages task queues. /background handles background agents. And as of v2.1.191, background agent stops are permanent — killing an agent from the tasks panel no longer resurrects it. That fix alone has saved teams from phantom resource consumption.
/batch runs parallel work in worktrees, which is the pattern for refactoring across multiple files simultaneously. For teams running heavy agent workloads, the cost implications are real. Subagent fan-out has produced documented incident bills up to $47,000. Our Claude Code hooks guide covers how to configure lifecycle guardrails that prevent runaway agent spending.
Review, Security, and Pre-Merge Workflows
/code-review, /security-review, and /review perform code audits at different scopes. /ultrareview runs multi-agent deep review — the most expensive review variant, but the one that catches cross-file issues. /autofix-pr auto-fixes PRs on CI failure, which is where the June 15 pricing change bites: programmatic usage like this draws from your separate autonomous credit pool, not your interactive subscription limits.
/diff opens an interactive diff viewer. Combined with the review commands, this gives you a pre-merge workflow that doesn’t require leaving the terminal.
Custom Commands and Extensibility
Custom slash commands are created by adding Markdown files to .claude/commands/. The command name is derived from the filename without extension. Inside the file, you can use $ARGUMENTS for the full argument string, $1/$2 (or $ARGUMENTS[0]/$ARGUMENTS[1]) for positional arguments, and $name for named arguments.
Here’s the current state of the documentation: custom commands have been merged into skills, with skills now the recommended format. Existing .claude/commands/ files keep working. But skills add a directory for supporting files, invocation control, and automatic loading. If you’re starting fresh, use the skills format. If you have existing custom commands, they’re not broken — but new development should go into skills.
MCP servers can expose custom commands using the /mcp__<server>__<prompt> pattern. This is the extensibility path for teams that want to integrate internal tooling without building full plugins.
The Commands Most People Miss
/btw asks a quick side question without interrupting the main conversation. /effort adjusts reasoning depth from low through max and ultracode. /fast toggles fast mode for lower-latency output. /design-sync connects Claude Code and Claude Design to pull design systems into the repo and push code back to the canvas — a niche command, but transformative for teams that work across design and engineering.
/hooks provides interactive setup for lifecycle hooks. /plugin manages plugins. /skills manages skills. /reload-skills and /reload-plugins refresh them. These are the infrastructure commands you set up once and forget about — until you need them.
/doctor diagnoses install and configuration problems. /config opens settings. /memory edits CLAUDE.md files and views auto memory. /permissions manages allow, ask, and deny rules for tools, with a Recently-denied tab that now persists approvals on close.
What Gets Removed
Some commands have been retired. /output-style is gone — use /config. /vim is gone — use /config → Editor mode. If a tutorial references either, it’s stale. Command availability also depends on platform, plan, environment, and feature flags. Not every command is visible to every user.
The Bigger Picture
The command surface reveals where Anthropic is investing. Session continuity (/rewind, /resume, /branch), team collaboration (/batch, /agents, /tasks), and autonomous workflow controls (/loop, /goal, /schedule) dominate the recent additions. This isn’t a tool optimized for raw coding throughput — it’s being built as a persistent team collaboration layer where session state and shared work artifacts are the core value.
The practical takeaway: learn the twenty commands that cover 90% of day-to-day use. Set up /compact as a habit before context pressure hits. Use /usage before any autonomous workflow. And migrate custom commands to the skills format the next time you touch them. The tool rewards teams that invest in configuration upfront — the return shows up in session consistency and predictable costs.