Control Claude’s behavior during an interactive session with slash commands.
| Command | Purpose |
|---|---|
/add-dir | Add additional working directories |
/agents | Manage custom AI subagents for specialized tasks |
/bashes | List and manage background tasks |
/bug | Report bugs (sends conversation to Anthropic) |
/clear | Clear conversation history |
/compact [instructions] | Compact conversation with optional focus instructions |
/config | Open the Settings interface (Config tab) |
/context | Visualize current context usage as a colored grid |
/cost | Show token usage statistics. Seecost tracking guide for subscription-specific details. |
/doctor | Checks the health of your Claude Code installation |
/exit | Exit the REPL |
/export [filename] | Export the current conversation to a file or clipboard |
/help | Get usage help |
/hooks | Manage hook configurations for tool events |
/ide | Manage IDE integrations and show status |
/init | Initialize project withCLAUDE.md guide |
/install-github-app | Set up Claude GitHub Actions for a repository |
/login | Switch Anthropic accounts |
/logout | Sign out from your Anthropic account |
/mcp | Manage MCP server connections and OAuth authentication |
/memory | EditCLAUDE.md memory files |
/model | Select or change the AI model |
/output-style [style] | Set the output style directly or from a selection menu |
/permissions | View or updatepermissions |
/plugin | Manage Claude Code plugins |
/pr-comments | View pull request comments |
/privacy-settings | View and update your privacy settings |
/release-notes | View release notes |
/resume | Resume a conversation |
/review | Request code review |
/rewind | Rewind the conversation and/or code |
/sandbox | Enable sandboxed bash tool with filesystem and network isolation for safer, more autonomous execution |
/security-review | Complete a security review of pending changes on the current branch |
/stats | Visualize daily usage, session history, streaks, and model preferences |
/status | Open the Settings interface (Status tab) showing version, model, account, and connectivity |
/statusline | Set up Claude Code’s status line UI |
/terminal-setup | Install Shift+Enter key binding for newlines (iTerm2 and VSCode only) |
/todos | List current TODO items |
/usage | For subscription plans only: show plan usage limits and rate limit status |
/vim | Enter vim mode for alternating insert and command modes |
/<command-name> [arguments]| Parameter | Description |
|---|---|
<command-name> | Name derived from the Markdown filename (without.md extension) |
[arguments] | Optional arguments passed to the command |
/help, these commands show “(project)” after their description.Location:.claude/commands/The following example creates the/optimize command:# Create a project commandmkdir -p .claude/commandsecho "Analyze this code for performance issues and suggest optimizations:" > .claude/commands/optimize.md/help, these commands show “(user)” after their description.Location:~/.claude/commands/The following example creates the/security-review command:# Create a personal commandmkdir -p ~/.claude/commandsecho "Review this code for security vulnerabilities:" > ~/.claude/commands/security-review.md.claude/commands/frontend/component.md creates/component with description “(project:frontend)”~/.claude/commands/component.md creates/component with description “(user)”.claude/commands/deploy.md and~/.claude/commands/deploy.md exist,/deploy runs the project version.Commands in different subdirectories can share names since the subdirectory appears in the description to distinguish them. For example,.claude/commands/frontend/test.md and.claude/commands/backend/test.md both create/test, but show as “(project:frontend)” and “(project:backend)” respectively.$ARGUMENTS$ARGUMENTS placeholder captures all arguments passed to the command:# Command definitionecho 'Fix issue #$ARGUMENTS following our coding standards' > .claude/commands/fix-issue.md# Usage> /fix-issue 123 high-priority# $ARGUMENTS becomes: "123 high-priority"$1,$2, etc.# Command definitionecho 'Review PR #$1 with priority $2 and assign to $3' > .claude/commands/review-pr.md# Usage> /review-pr 456 high alice# $1 becomes "456", $2 becomes "high", $3 becomes "alice"! prefix. The output is included in the command context. Youmust includeallowed-tools with theBash tool, but you can choose the specific bash commands to allow.For example:---allowed-tools:Bash(git add:*), Bash(git status:*), Bash(git commit:*)description:Create a git commit---## Context- Current git status: !`git status`- Current git diff (staged and unstaged changes): !`git diff HEAD`- Current branch: !`git branch --show-current`- Recent commits: !`git log --oneline -10`## Your taskBased on the above changes, create a single git commit.@ prefix toreference files.For example:# Reference a specific fileReview the implementation in @src/utils/helpers.js# Reference multiple filesCompare @src/old-version.js with @src/new-version.js| Frontmatter | Purpose | Default |
|---|---|---|
allowed-tools | List of tools the command can use | Inherits from the conversation |
argument-hint | The arguments expected for the slash command. Example:argument-hint: add [tagId] | remove [tagId] | list. This hint is shown to the user when auto-completing the slash command. | None |
description | Brief description of the command | Uses the first line from the prompt |
model | Specific model string (seeModels overview) | Inherits from the conversation |
disable-model-invocation | Whether to preventSlashCommand tool from calling this command | false |
---allowed-tools:Bash(git add:*), Bash(git status:*), Bash(git commit:*)argument-hint: [message]description:Create a git commitmodel:claude-3-5-haiku-20241022---Create a git commit with message: $ARGUMENTS---argument-hint: [pr-number] [priority] [assignee]description:Review pull request---Review PR #$1 with priority $2 and assign to $3.Focus on security, performance, and code style./plugin-name:command-name to avoid conflicts (plugin prefix is optional unless there are name collisions)/helpcommands/ directory in plugin rootFile format: Markdown files with frontmatterBasic command structure:---description:Brief description of what the command does---# Command NameDetailed instructions for Claude on how to execute this command.Include specific guidance on parameters, expected outcomes, and any special considerations.{arg1} in command descriptions/command-name/plugin-name:command-name/command-name arg1 arg2/mcp__<server-name>__<prompt-name> [arguments]# Without arguments> /mcp__github__list_prs# With arguments> /mcp__github__pr_review 456> /mcp__jira__create_issue "Bug title" high/mcp command to:mcp__github (approves all GitHub tools)mcp__github__get_issuemcp__github__list_issuesSlashCommand toolSlashCommand tool allows Claude to executecustom slash commands programmaticallyduring a conversation. This gives Claude the ability to invoke custom commandson your behalf when appropriate.To encourage Claude to use theSlashCommand tool, reference the command by name, including the slash, in your prompts orCLAUDE.md file. For example:> Run /write-unit-test when you are about to start writing tests./context to monitor token usage and follow the operations below to manage context.SlashCommand tool supported commandsSlashCommand tool only supports custom slash commands that:/compact and/init arenot supported.description frontmatter field populated. The description is used in the context.SlashCommand tool can invoke by runningclaude --debug and triggering a query.SlashCommand tool/permissions# Add to deny rules: SlashCommanddisable-model-invocation: true to the slash command’s frontmatter.This also removes the command’s metadata from context.SlashCommand permission rulesSlashCommand:/commit (allows only/commit with no arguments)SlashCommand:/review-pr:* (allows/review-pr with any arguments)SlashCommand tool includes a character budget to limit the size of commanddescriptions shown to Claude. This prevents token overflow when many commandsare available.The budget includes each custom slash command’s name, arguments, and description.SLASH_COMMAND_TOOL_CHAR_BUDGET environment variable/context, a warning shows “M of N commands”./review → “Review this code for bugs and suggest improvements”/explain → “Explain this code in simple terms”/optimize → “Analyze this code for performance issues”| Aspect | Slash Commands | Agent Skills |
|---|---|---|
| Complexity | Simple prompts | Complex capabilities |
| Structure | Single .md file | Directory with SKILL.md + resources |
| Discovery | Explicit invocation (/command) | Automatic (based on context) |
| Files | One file only | Multiple files, scripts, templates |
| Scope | Project or personal | Project or personal |
| Sharing | Via git | Via git |
# .claude/commands/review.mdReview this code for:- Security vulnerabilities- Performance issues- Code style violations/review (manual invocation)As a Skill:.claude/skills/code-review/├── SKILL.md (overview and workflows)├── SECURITY.md (security checklist)├── PERFORMANCE.md (performance patterns)├── STYLE.md (style guide reference)└── scripts/ └── run-linters.shWas this page helpful?