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:

CommandPurpose
/add-dirAdd additional working directories
/agentsManage custom AI subagents
/bashesList and manage background tasks
/bugReport bugs to Anthropic
/clearClear conversation history
/compact [instructions]Compact conversation with optional focus
/configOpen settings interface
/contextVisualize current context usage
/costShow token usage statistics
/doctorCheck installation health
/exitExit the REPL
/export [filename]Export conversation to file or clipboard
/helpList available commands
/hooksManage hook configurations
/ideManage IDE integrations
/initInitialize project with CLAUDE.md
/install-github-appSet up Claude GitHub Actions
/loginSwitch Anthropic accounts
/logoutSign out
/mcpManage MCP server connections
/memoryEdit CLAUDE.md memory files
/modelSelect or change AI model
/output-styleSet response formatting
/permissionsView or update tool permissions
/planEnter plan mode for complex tasks
/pluginManage Claude Code plugins
/pr-commentsView pull request comments
/privacy-settingsUpdate privacy settings
/release-notesView release notes
/rename <name>Rename current session
/remote-envConfigure remote session environment
/resume [session]Resume conversation by ID or name
/reviewRequest code review
/rewindRewind conversation and code changes
/sandboxEnable sandboxed bash with isolation
/security-reviewSecurity review of pending changes
/statsVisualize daily usage and session history
/statusOpen settings status tab
/statuslineConfigure status line UI
/teleportResume remote session from claude.ai
/terminal-setupInstall Shift+Enter key binding
/themeChange color theme
/todosList current TODO items
/usageShow plan usage and rate limits
/vimEnter 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