Slash commands are short commands you type in the Claude Code prompt to control the session directly, instead of asking in plain English. The ones you reach for every day are /clear to reset the context, /compact to shrink it, /context to inspect it, /init to bootstrap a CLAUDE.md, and /review to review code. You can also define your own.

Managing context

Context is the most important resource in an agentic session. These commands keep it clean:

CommandWhat it does
/clearWipes the context between two unrelated tasks (the number one reflex)
/compactSummarises the conversation to free up room
/contextShows what is currently filling your context window
/rewindReturns to an earlier point in the conversation
/resumePicks up a previous session

The habit that matters most: /clear between independent tasks. A clean context gives sharper answers.

Setting up a project

  • /init generates a first CLAUDE.md by scanning your codebase.
  • /memory edits that project memory.
  • /config opens your settings.

Tools and automation

  • /mcp manages the MCP servers connected to your project.
  • /agents creates and launches subagents.
  • /hooks configures hooks, the shell commands that run automatically on events.

Models and cost

  • /model switches the model you are using.
  • /cost shows token usage and the running cost of the session.

Custom slash commands

You are not limited to the built-ins. Drop a markdown file in .claude/commands/ and it becomes a slash command you can run by name, a quick way to package a prompt you use often.

The takeaway

A handful of slash commands cover most of the work: /clear and /compact for context, /init for setup, /mcp and /hooks for tools, /cost to stay aware. Learn those five and the rest follow.


Want the full system behind these commands, the workflow that makes them pay off? The Harness Engineering course takes you from first setup to production-grade Claude Code. The first module is free, no card needed.