Why This Matters#
When working with Claude Code, sometimes you need to quickly perform a service action: compress conversation history, rename a session, check settings. That’s what slash commands are for — short commands that start with the / (slash) symbol.
They’re like keyboard shortcuts, but in text form. Instead of explaining to Claude what you want to do, you simply type a command.
What is a Slash Command#
A slash command is a special instruction for Claude Code that starts with /. It’s not a question or request to Claude — it’s a direct command to the system.
For example:
/help— show help/compact— compress conversation history
Main Built-in Commands#
Conversation Management#
| Command | What It Does |
|---|---|
/compact |
Compresses conversation history, freeing space for new messages |
/clear |
Completely clears the current conversation |
/resume |
Continues a previous conversation (if you closed Claude and reopened) |
Information and Settings#
| Command | What It Does |
|---|---|
/help |
Shows a list of available commands |
/config |
Opens Claude Code settings |
/status |
Shows current state: model, project, usage |
/mcp |
Shows connected MCP servers (more on this in Lesson 6) |
Session Management#
| Command | What It Does |
|---|---|
/rename |
Renames the current session (conversation) |
Debugging and Feedback#
| Command | What It Does |
|---|---|
/bug |
Report a bug in Claude Code |
Step-by-Step Instructions#
How to Use /compact#
When needed: You’ve been chatting with Claude for a while, and it starts “forgetting” the beginning of the conversation or works slower. This happens because Claude has a limit on the volume of text it can “keep in mind” (called the context window).
What to do:
-
Simply type in the chat:
/compact -
Claude will compress the entire conversation history into a brief summary
-
You continue working, but Claude remembers the gist of the previous discussion
💡 You can add a hint:
/compact focus on the database work— then Claude will emphasize that topic when compressing.
How to Use /resume#
When needed: You closed the terminal or restarted Claude Code but want to continue a previous conversation.
What to do:
-
Launch Claude Code:
claude -
Type:
/resume -
Claude will show a list of recent sessions — choose the one you need
💡 You can also launch with a flag:
claude --resume— this immediately offers to continue the last session.
How to Use /config#
When needed: You want to view or change settings without editing files manually.
What to do:
-
Type:
/config -
An interactive interface with tabs will open
-
Navigate between sections and change the parameters you need
How to Rename a Session#
When needed: You have many sessions and want to give the current one a clear name.
What to do:
-
Type:
/rename Working on the homepage -
Now when using
/resume, this session will have a clear name
Skills — Custom Commands#
Besides built-in commands, you can create your own! In Claude Code, they’re called skills.
How to Create Your Own Skill#
-
Create a folder:
mkdir -p .claude/skills/review-code -
Create the file
.claude/skills/review-code/SKILL.md:--- invoke: user --- # Code Review Check the current code for: 1. Errors and bugs 2. Readability 3. Compliance with project style Output the result in this format: - ✅ What's good - ⚠️ What can be improved - ❌ What needs to be fixed -
Now you can invoke this skill:
/review-code
Where to Store Skills#
| Location | Availability |
|---|---|
.claude/skills/ |
For this project (can be added to Git for the team) |
~/.claude/skills/ |
For all your projects |
Useful Scenarios#
Scenario 1: Long Project Work#
You: Let's create a contacts page...
Claude: [works]
You: Now add a feedback form...
Claude: [works]
... (an hour later) ...
You: /compact work on the contacts page
Claude: [compressed context, remembers the gist]
You: Now add form validation
Claude: [continues working]Scenario 2: Multi-Day Work#
--- Day 1 ---
You: Let's start building an online store...
Claude: [works]
You: /rename Online store: product catalog
(close terminal)
--- Day 2 ---
claude
You: /resume
(select "Online store: product catalog")
You: Let's continue, add a shopping cartTips#
- ✅ Use
/compactwhen the conversation gets long (more than 20-30 messages) - ✅ Give sessions clear names with
/rename - ✅ Create skills for repetitive tasks
- ✅ Type
/helpif you forget a command
Lesson Summary#
- Slash commands are quick system commands starting with
/ /compactcompresses history,/resumecontinues a past session,/configopens settings- You can create your own skills — custom commands for repetitive tasks
- Skills are stored in
.claude/skills/(project) or~/.claude/skills/(personal) - Slash commands save time and make work more convenient