DEV Community

brian austin
brian austin

Posted on

Claude Code slash commands: the complete reference for 2026

Claude Code slash commands: the complete reference for 2026

If you use Claude Code daily, slash commands are your fastest productivity lever. Here's every built-in command, what it actually does, and how to build your own.

Built-in slash commands

Command What it does
/help Show all available commands
/clear Clear conversation history (preserves context file)
/compact Summarize conversation to reduce token usage
/cost Show token usage and estimated cost for current session
/model Switch between Claude models mid-session
/review Request a code review of recent changes
/commit Generate a commit message and commit staged changes
/pr Create a pull request description
/diff Show git diff with AI summary
/test Run test suite and fix failures
/lint Run linter and auto-fix issues
/memory Show what's in CLAUDE.md and session memory
/reset Full reset — clear history and reload CLAUDE.md

The commands I use every session

/compact — before you hit the context limit

Don't wait until Claude starts forgetting things. Run /compact proactively:

# When your session is getting long:
/compact

# Claude summarizes everything into a compact briefing:
# "Working on auth module. Completed: JWT setup, login endpoint.
# In progress: refresh token logic. Next: tests for edge cases."
Enter fullscreen mode Exit fullscreen mode

This preserves your working context while freeing up token budget for the actual work.

/cost — reality check

Run this periodically to understand your token burn rate:

/cost

# Output:
# Session tokens: 47,382 input / 12,891 output
# Estimated cost: $0.43
# Session time: 1h 23m
Enter fullscreen mode Exit fullscreen mode

If you're hitting rate limits frequently, the cost output tells you exactly why.

/commit — stop writing commit messages manually

# Stage your changes first:
git add -p

# Then let Claude write the commit:
/commit

# Claude generates:
# feat(auth): add refresh token rotation with 7-day expiry
#
# - Implement token rotation on each refresh
# - Add Redis TTL for refresh token storage
# - Handle concurrent refresh race condition
Enter fullscreen mode Exit fullscreen mode

The generated messages follow conventional commits format automatically.

Custom slash commands

Create a .claude/commands/ directory in your project and add markdown files:

mkdir -p .claude/commands
Enter fullscreen mode Exit fullscreen mode

Example: /deploy command

# .claude/commands/deploy.md

Run the deployment checklist:
1. Run full test suite — stop if any fail
2. Check for console.log statements in src/
3. Verify environment variables are set
4. Build production bundle
5. Run smoke test against staging
6. Report: ready to deploy or blockers found
Enter fullscreen mode Exit fullscreen mode

Now /deploy runs your entire pre-deployment checklist.

Example: /review command (customized)

# .claude/commands/review.md

Review the staged changes:
- Security: any SQL injection, XSS, or auth bypass risks?
- Performance: N+1 queries, missing indexes, sync where async needed?
- Tests: are edge cases covered?
- Docs: does the README need updating?

Output as a table with severity: BLOCKER / WARNING / SUGGESTION
Enter fullscreen mode Exit fullscreen mode

Example: /standup command

# .claude/commands/standup.md

Based on git log --since=yesterday and current working state, generate:
- What I completed yesterday
- What I'm working on today  
- Any blockers

Format for Slack copy-paste.
Enter fullscreen mode Exit fullscreen mode

Slash command arguments

You can pass arguments to custom commands using $ARGUMENTS:

# .claude/commands/explain.md

Explain this concept in simple terms for a junior developer: $ARGUMENTS

Include:
- One-line summary
- Real-world analogy
- Code example
- Common mistakes to avoid
Enter fullscreen mode Exit fullscreen mode

Usage: /explain dependency injection

The rate limit problem with long sessions

Slash commands that iterate (like /test → fix → /test → fix) burn through API calls fast. If you're running deep sessions with automation loops, you'll hit Claude's rate limits mid-workflow.

Fix: set ANTHROPIC_BASE_URL to a proxy that removes the rate limit:

export ANTHROPIC_BASE_URL=https://simplylouie.com
export ANTHROPIC_API_KEY=your-key

# Now /test loops run without interruption
claude
Enter fullscreen mode Exit fullscreen mode

SimplyLouie is $2/month and purpose-built for Claude Code — simplylouie.com

Keyboard shortcut: run commands faster

In Claude Code's TUI, you can type the / prefix and use tab completion:

/c<TAB>     # completes to /clear, /compact, /commit, /cost
/co<TAB>    # completes to /compact, /commit, /cost
/com<TAB>   # completes to /commit
Enter fullscreen mode Exit fullscreen mode

Building a command library

The best teams version-control their .claude/commands/ directory:

# Commit your team's command library
git add .claude/commands/
git commit -m "add team claude commands: deploy, review, standup"
Enter fullscreen mode Exit fullscreen mode

New team members get the full command library on git clone.

What's worth building as a custom command?

Good candidates for custom commands:

  • Repetitive multi-step workflows (deploy checklist, PR prep)
  • Context-specific reviews (your team's specific standards)
  • Onboarding tasks ("explain the architecture", "find where X is implemented")
  • Reporting (standup, sprint summary, change log generation)

Not worth it:

  • Single-step tasks (just type them)
  • Things that need real-time input (interactive better than command)

The full workflow

Here's a complete session using slash commands:

# Start session
claude

# Work for an hour...

# Check your spend
/cost

# Compact before context fills
/compact

# Run tests, fix failures
/test

# Review staged changes
/review

# Write the commit
/commit

# Generate PR description
/pr

# Prep standup
/standup
Enter fullscreen mode Exit fullscreen mode

The whole workflow — from code to PR to standup note — without leaving your terminal.


Running out of rate limits mid-session? Set ANTHROPIC_BASE_URL=https://simplylouie.com — $2/month, no rate limits.

Top comments (0)