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:
| Command | What it does |
|---|---|
/clear | Wipes the context between two unrelated tasks (the number one reflex) |
/compact | Summarises the conversation to free up room |
/context | Shows what is currently filling your context window |
/rewind | Returns to an earlier point in the conversation |
/resume | Picks up a previous session |
The habit that matters most: /clear between independent tasks. A clean context gives sharper answers.
Setting up a project
/initgenerates a first CLAUDE.md by scanning your codebase./memoryedits that project memory./configopens your settings.
Tools and automation
/mcpmanages the MCP servers connected to your project./agentscreates and launches subagents./hooksconfigures hooks, the shell commands that run automatically on events.
Models and cost
/modelswitches the model you are using./costshows 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.