Slash commands are typed shortcuts in Claude Code that execute predefined tasks. Two flavors: built-in commands ship with Claude Code, custom commands live in .claude/commands/ folders.

Built-in Commands

Complete list as of January 2026:

| Command | Purpose | | ------------------------- | ----------------------------------------- | ------------------------ | | /add-dir | Add additional working directories | | /agents | Manage custom AI subagents | | /bashes | List and manage background tasks | | /bug | Report bugs to Anthropic | | /clear | Clear conversation history | | /compact [instructions] | Compact conversation with optional focus | | /config | Open settings interface | | /context | Visualize current context usage | | /cost | Show token usage statistics | | /doctor | Check installation health | | /exit | Exit the REPL | | /export [filename] | Export conversation to file or clipboard | | /help | List available commands | | /hooks | Manage hook configurations | | /ide | Manage IDE integrations | | /init | Initialize project with CLAUDE.md | | /install-github-app | Set up Claude GitHub Actions | | /login | Switch Anthropic accounts | | /logout | Sign out | | /mcp | Manage MCP server connections | | /memory | Edit CLAUDE.md memory files | | /model | Select or change AI model | | /output-style | Set response formatting | | /permissions | View or update tool permissions | | /plan | Enter plan mode for complex tasks | | /plugin | Manage Claude Code plugins | | /pr-comments | View pull request comments | | /privacy-settings | Update privacy settings | | /release-notes | View release notes | | /rename <name> | Rename current session | | /remote-env | Configure remote session environment | | /resume [session] | Resume conversation by ID or name | | /review | Request code review | | /rewind | Rewind conversation and code changes | | /sandbox | Enable sandboxed bash with isolation | | /security-review | Security review of pending changes | | /stats | Visualize daily usage and session history | | /status | Open settings status tab | | /statusline | Configure status line UI | | /teleport | Resume remote session from claude.ai | | /terminal-setup | Install Shift+Enter key binding | | /theme | Change color theme | | /todos | List current TODO items | | /usage | Show plan usage and rate limits | | /vim | Enter vim mode |

Custom Commands

Create markdown files in designated directories:

Project commands: .claude/commands/ (shared via git, project-specific) Personal commands: ~/.claude/commands/ (available across all projects)

Basic Example

mkdir -p .claude/commands
echo "Analyze this code for performance issues:" > .claude/commands/optimize.md

Invoke with /optimize.

Using Arguments

Fix issue #$1 with priority $2.

/fix-issue 123 high expands to “Fix issue #123 with priority high.”

$ARGUMENTS captures everything: /fix-issue 123 high gives $ARGUMENTS = "123 high".

Frontmatter Options

Commands support YAML frontmatter for configuration:

---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Create a git commit
model: claude-3-5-haiku-20241022
context: fork
agent: general-purpose
disable-model-invocation: false
hooks:
  PreToolUse:
    - matcher: "Bash"
      hooks:
        - type: command
          command: "./scripts/validate.sh"
          once: true
---
FieldPurpose
allowed-toolsTools the command can use without approval
argument-hintExpected arguments format shown in /help
descriptionCommand description
modelForce specific model (haiku for fast tasks)
contextfork runs as subagent, inline runs in conversation
agentAgent type when using fork context
disable-model-invocationPrevent Skill tool from calling programmatically
hooksEvent handlers during command execution

Embedding Shell Output

Prefix commands with ! to execute and embed results:

---
allowed-tools: Bash(git status:*), Bash(git diff:*)
description: Explain the git diff
---
 
## Context
 
- Current status: !`git status`
- Current diff: !`git diff HEAD`
 
Explain what changed.

File References

Use @ to reference files:

Review the implementation in @src/utils/helpers.js
 
Compare @src/old-version.js with @src/new-version.js

Practical Command Examples

Smart Commit

---
allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*)
argument-hint: [message]
description: Commit with sanity checks
model: haiku
---
 
Before committing, check for:
 
- TODO comments in changed files
- console.log or print statements
- Commented-out code blocks
- Test flags left enabled
 
If clean, commit with message: $ARGUMENTS
If issues found, list them and ask whether to proceed.

PR Review

---
allowed-tools: Read, Grep, Glob, Bash(git diff:*)
description: Comprehensive PR review
---
 
## Changed Files
 
!`git diff --name-only HEAD~1`
 
## Detailed Changes
 
!`git diff HEAD~1`
 
## Review Checklist
 
1. Code quality and readability
2. Security vulnerabilities
3. Performance implications
4. Test coverage
5. Documentation completeness
 
Provide specific, actionable feedback by priority.

Test Runner

---
allowed-tools: Bash, Read, Edit
argument-hint: [test-pattern]
description: Run tests with pattern matching
---
 
Run tests matching: $ARGUMENTS
 
1. Detect test framework (Jest, pytest, etc.)
2. Run tests with provided pattern
3. If failures, analyze and fix
4. Re-run to verify

MCP Commands

Connected MCP servers expose prompts as slash commands:

/mcp__<server-name>__<prompt-name> [arguments]

Example: /mcp__github__list_prs, /mcp__jira__create_issue "Bug title" high

Skills vs Slash Commands

AspectSlash CommandsAgent Skills
ComplexitySimple promptsComplex capabilities
StructureSingle .md fileMulti-file SKILL.md
InvocationManual onlyAuto-discovered + manual
Use caseFrequent tasksDomain expertise

For complex workflows, consider Spec Kit slash commands which structure entire development workflows.

Tips

  • /help shows all available commands including custom ones
  • Autocomplete works anywhere in input, not just at start
  • Use model: haiku for fast, simple commands
  • Built-in commands like /init and /compact cannot be invoked programmatically via Skill tool
  • Use # prefix for quick memory additions without opening /memory

Sources