Claude Code commands are slash commands you type inside Anthropic’s Claude Code terminal session to manage context, settings, permissions, models, memory, reviews, and reusable prompt workflows.

c-ai.chat is an independent guide, not Anthropic or claude.ai. Use this practical reference alongside the official documentation, and see our Claude features overview for how Claude Code fits into the wider Claude product ecosystem.
Contents
- The short answer
- How it works
- What you would actually do with it
- How Claude Code compares
- Other questions readers ask
- The honest take
- Sources
The short answer

Claude Code slash commands are control messages for Anthropic’s agentic coding tool. They do not run as shell commands by themselves. Type them at the Claude Code prompt, usually starting with /, to control the session, inspect usage, edit memory, request reviews, manage permissions, or trigger custom prompt templates.
- What they do: control Claude Code sessions.
- Where they run: inside the Claude Code terminal prompt.
- Who they are for: developers using Claude to read, edit, test, or review code.
- Plan pricing: Free $0; Pro $20/mo or $17/mo annual; Max from $100/mo; Team Standard $25/seat/mo or $20/seat/mo annual; Team Premium $125/seat/mo or $100/seat/mo annual; Enterprise $20/seat base + API rates.
The exact command list can change. Trust /help inside your installed version first, then check Anthropic’s official Claude Code slash commands documentation. This page explains what the main commands mean in daily work and how to avoid common mistakes.
Start safely
Use /help, /init, and /permissions before asking Claude to change code.
Control context
Use /clear when the session is wrong and /compact when it is useful but too long.
Repeat workflows
Use custom commands for review checklists, migration steps, release checks, and test-writing prompts.
| Command | What it does | Use it when |
|---|---|---|
/help | Shows available commands and usage help. | You need the live command list for your installed Claude Code version. |
/init | Creates or updates project instructions, commonly through a CLAUDE.md file. | You start using Claude Code in a repository and want it to understand project conventions. |
/clear | Clears the current conversation context. | The session is stale, overloaded, or focused on the wrong task. |
/compact | Compresses the current conversation into a shorter working summary, optionally with instructions. | You want to keep progress while reducing context size. |
/model | Changes or shows the selected Claude model. | You want a different speed, capability, or cost profile. |
/cost | Shows token usage and cost information for the session. | You want to monitor spend or understand a long coding session. |
/status | Shows account, connection, and system status details. | Claude Code is behaving unexpectedly and you need diagnostics. |
/config | Views or changes Claude Code configuration. | You need to adjust local settings. |
/permissions | Views or changes what Claude Code may do without asking. | You want tighter control over file edits, command execution, or trusted operations. |
/memory | Opens or manages Claude’s saved project or user memory. | You want Claude to remember coding standards, commands, or architectural notes. |
/add-dir | Adds another working directory to the session. | Your task spans more than one repository or folder. |
/agents | Manages custom subagents for specialised tasks. | You use roles such as reviewer, tester, migration assistant, or documentation writer. |
/review | Requests a code review. | You want Claude to inspect changes before a commit or pull request. |
/pr_comments | Works with pull request comments where supported. | You are responding to review feedback from a pull request workflow. |
/mcp | Manages Model Context Protocol connections. | You want Claude Code to connect to approved external tools or data sources. |
/login | Signs in or switches Anthropic accounts. | You need to authenticate or change accounts. |
/logout | Signs out of the current Anthropic account. | You are leaving a shared machine or changing credentials. |
/doctor | Runs checks on the Claude Code installation. | Something is broken and you want a guided health check. |
/terminal-setup | Helps configure terminal key bindings. | You want smoother multiline input or terminal integration. |
/vim | Enables or toggles Vim-style input mode where supported. | You prefer Vim-like editing inside the prompt. |
/bug | Reports a bug to Anthropic, usually with diagnostic context. | You have a reproducible Claude Code issue to report. |
How it works

Claude Code runs as an interactive coding session in your terminal. Natural-language prompts ask Claude to inspect, edit, or explain code. Slash commands control the session itself. That distinction matters: fix the failing auth tests is a task prompt, while /clear changes the conversation state.
Claude Code sends relevant context to Claude, receives a proposed plan or edit, and may ask before making changes or running commands depending on your permissions. Commands such as /permissions, /memory, and /add-dir shape what context Claude can use and what actions it can take. For model and token details, use Anthropic’s official model overview and our independent Claude API docs guide.
Custom slash commands add another layer. You can save repeatable prompts as Markdown files, usually in a project-level commands folder or a user-level commands folder. Then you trigger them from the Claude Code prompt instead of retyping the same review checklist, migration procedure, or release workflow.
Open a repository
Start in the project folder you want Claude Code to understand. Keep the scope narrow at first.
Run Claude Code
Launch the Claude Code session from your terminal, then use
/helpto see the commands available in your installed version.Initialize project context
Use
/initto create or refresh project instructions. Add conventions such as test commands, lint rules, package manager, and architectural boundaries.Set safe permissions
Use
/permissionsbefore giving Claude broad tasks. Allow only the actions you are comfortable with for the repository and machine.Work in loops
Ask for a plan, approve edits, run tests, then use
/compactor/clearwhen the session becomes too long or the task changes.
Claude Code is not a replacement for version control. Treat its edits like any other contributor’s work. Review diffs, run tests, and avoid granting broad command permissions in sensitive repositories.
What you would actually do with it
The most useful Claude Code commands reduce repeated setup. A good session starts with project context, then moves through planning, edits, tests, review, and cleanup.
Worked example
Start a new repository session safely
/help/init/permissionsExplain the architecture and identify the test command.This gives Claude context before you ask it to modify files.
Example 1: clear a confused session
If Claude has spent too long on the wrong approach, do not keep adding corrections. Clear the context and restart with a sharper prompt.
/clear
We are fixing the login redirect bug only.
Read src/auth and tests/auth.
First explain the likely cause.
Do not edit files until I approve the plan.
This is often better than asking Claude to recover from several false starts. Use it when the previous context is hurting the next answer.
Example 2: compact a long task without losing progress
Use /compact when the session has useful decisions, but the conversation is too long. Add a short instruction so the summary preserves what matters.
/compact Keep the migration plan, files changed, failing tests, and decisions about backward compatibility.
After compaction, continue with a direct next step:
Continue from the compacted summary.
Run through the remaining failing tests and propose the smallest safe patch.
Example 3: create a project-specific slash command
Custom slash commands are useful for repeatable work. For example, a team might create a project command that asks Claude to review a diff using the team’s own standards.
# .claude/commands/review-diff.md
Review the current git diff for this repository.
Focus on:
- correctness
- security issues
- missing tests
- unnecessary complexity
- compatibility with the conventions in CLAUDE.md
Return:
1. blocking issues
2. non-blocking suggestions
3. tests to run
Extra context from the user:
$ARGUMENTS
Then call it from Claude Code:
/project:review-diff Pay special attention to the payment webhook changes.
Project commands help keep reviews consistent across a repository. Personal commands are better for your own habits, such as a preferred debugging checklist.
Example 4: switch model for the task
Use /model when you want to check or change the model used by the session. Opus 4.7 is the flagship model at $5 input and $25 output per million tokens with a 1M context window. Sonnet 4.6 costs $3 input and $15 output per million tokens, supports a 1M context window, and has a 128K maximum output. Haiku 4.5 costs $1 input and $5 output per million tokens. Compare Anthropic’s model information with our Claude models guide.
For API workflows outside Claude Code, prompt caching gives 90% off cached input. Batch API gives 50% off both input and output. For plan-level pricing, compare the official Claude pricing page with our independent Claude pricing guide.
/model
We need a careful refactor plan for the billing module.
Read the code first, then list risks before editing.
Example 5: manage access to another directory
Some tasks span a frontend app, a backend service, and shared types. Use /add-dir rather than copying files into the prompt. Keep the added scope limited to the directories Claude needs.
/add-dir ../shared-types
Compare the API response types in this service with the shared TypeScript definitions.
List mismatches before suggesting edits.
This approach works well when you need cross-repository context, but it also increases what Claude can inspect. Use /permissions and review file access carefully.
How Claude Code compares
Claude Code competes less with a single autocomplete tool and more with a wider group of coding assistants. The key difference is workflow. Claude Code is terminal-first and task-oriented. Cursor, GitHub Copilot, and Sourcegraph Cody are more editor-centered. Many developers use more than one.
| Tool | Main interface | Strength | Trade-off |
|---|---|---|---|
| Claude Code | Terminal | Good for repository-level tasks, refactors, reviews, command-line workflows, and repeatable slash commands. | Requires comfort with terminal workflows. You still need to review edits and permissions. |
| Cursor | Code editor | Good for interactive editing, codebase chat, and keeping AI close to the file you are editing. | Best experience depends on using Cursor as your editor. |
| GitHub Copilot | Editor and GitHub workflow | Good for inline completions, common code patterns, and teams already centered on GitHub. | Autocomplete is not the same as a terminal agent that can plan multi-step work. |
| Sourcegraph Cody | Editor and code search context | Good for codebase questions where repository search and enterprise code context matter. | Fit depends on your Sourcegraph setup and code search needs. |
| Direct Claude chat | Web or app | Good for explanations, design discussion, and isolated snippets. | Less convenient for editing files and running local project workflows. |
Pick Claude Code when
- You want AI help inside the terminal.
- Your work involves several files, tests, and shell commands.
- You want reusable project commands and project memory.
- You prefer reviewing plans and diffs before accepting changes.
Skip it when
- You only want lightweight autocomplete.
- Your team does not allow AI tools to inspect local repositories.
- You cannot review generated changes carefully.
- Your workflow is entirely inside an editor and you do not want a terminal agent.
If you are deciding where Claude Code fits, start with the broader Claude feature set. For outages or unusual behavior, check Claude status before spending time on local debugging.
Other questions readers ask
The honest take
Decision
Learn Claude Code commands if you use Claude for real coding work rather than one-off snippets. The biggest gains come from context control: initializing a repository, setting permissions, clearing bad sessions, compacting long ones, and saving repeatable prompts as project commands.
The limitation is clear. Slash commands do not remove the need for engineering judgment. They make Claude Code easier to steer, but you still own the repository, the tests, the security review, and the final diff.
Independent guide. Not affiliated with Anthropic. For the official Claude product, visit claude.ai.
Last updated: 2026-05-12
This article is part of the Claude Code hub on c-ai.chat.





