Slash Commands

Slash commands are built-in commands you can type during a Claude Code session to control behavior, manage context, and access useful utilities. Every slash command starts with / and is processed immediately by the CLI rather than being sent as a prompt.

Command Reference

CommandDescription
/helpDisplay a list of all available commands and their descriptions.
/clearClear the conversation history and start fresh with a clean context.
/compactSummarize the current conversation to free up context window space.
/statusShow session status including loaded CLAUDE.md files and current configuration.
/costDisplay the token usage and estimated cost for the current session.
/reviewAsk Claude to review code changes, typically the current git diff.
/initGenerate a CLAUDE.md file for the current project based on the codebase.
/configView or modify Claude Code configuration settings.

Using Slash Commands

Slash commands are typed directly into the Claude Code prompt. They do not require any special syntax beyond the leading forward slash.

> /help

This prints the full list of available commands with brief descriptions.

> /compact

This triggers a context summarization. Claude compresses the conversation history into a shorter summary, freeing up tokens for continued work.

Common Workflows

Starting a New Project

When you open Claude Code in a new repository for the first time, run /init to generate a starter CLAUDE.md file:

> /init

Claude will analyze your codebase and create a CLAUDE.md with your detected tech stack, available scripts, and project structure.

Monitoring Costs

Keep an eye on token usage during long sessions with /cost:

> /cost

This shows the total tokens consumed and the estimated dollar cost so far.

Reviewing Changes

After making a series of edits, use /review to get Claude to examine the current diff:

> /review

Claude will look at all staged and unstaged changes and provide feedback on code quality, potential bugs, and style consistency.

Resetting Context

If the conversation has drifted off track or accumulated too much history, use /clear to start over:

> /clear

This wipes the conversation but keeps your CLAUDE.md instructions loaded.

Tips

  • You can type a slash command at any point in a session. It does not interrupt ongoing work.
  • Combine /compact with long-running tasks to avoid hitting context limits.
  • Use /status to verify your CLAUDE.md was loaded correctly after starting a session.