DEV Community

brian austin
brian austin

Posted on

Claude Code slash commands: the complete reference with custom examples

Claude Code slash commands: the complete reference with custom examples

If you've been using Claude Code for more than a week, you've probably typed /help and seen a list of slash commands. But most developers only use /clear and /exit. Here's everything else — and how to build your own.

Built-in slash commands

Command What it does
/help Show all commands
/clear Clear conversation context
/compact Summarize and compress context
/memory Show what Claude remembers
/review Request code review
/init Initialize CLAUDE.md in current dir
/exit or /quit Exit Claude Code
/model Switch between Claude models
/cost Show token usage and cost
/doctor Check your setup

The ones you're probably not using

/compact vs /clear

Most people use /clear when the context gets long. But /compact is usually better:

/clear   → wipes everything, you re-explain from scratch
/compact → summarizes progress, keeps the important stuff
Enter fullscreen mode Exit fullscreen mode

Use /compact when you're mid-feature and the context window is filling up.
Use /clear when you're starting a completely different task.

/cost

Run this regularly if you're on a metered plan:

/cost
# → Session: 47,832 tokens ($0.23)
# → Remaining budget: $4.77
Enter fullscreen mode Exit fullscreen mode

If you're hitting rate limits before you hit your budget, that's a different problem — more on that below.

/memory

Shows what's in your CLAUDE.md and session memory:

/memory
# → Project: e-commerce API
# → Stack: Node.js, PostgreSQL, Redis
# → Convention: snake_case for DB, camelCase for JS
Enter fullscreen mode Exit fullscreen mode

Run this after /compact to verify the summary captured what matters.

Building custom slash commands

Custom commands live in .claude/commands/ in your project:

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

Each .md file becomes a slash command:

# .claude/commands/deploy.md
You are a deployment assistant. Run the following:
1. Check all tests pass: `npm test`
2. Build: `npm run build`
3. Check for uncommitted changes: `git status`
4. If clean, create a git tag: `git tag v$ARGUMENTS`
5. Push with tags: `git push origin main --tags`

If anything fails, stop and report exactly what failed.
Enter fullscreen mode Exit fullscreen mode

Now you have /deploy in Claude Code:

/deploy 1.4.2
Enter fullscreen mode Exit fullscreen mode

The $ARGUMENTS variable captures everything you type after the command name.

More custom command examples

/review — code review with your team's standards

# .claude/commands/review.md
Review the file at $ARGUMENTS against our team standards:
- Functions under 30 lines
- No nested callbacks (use async/await)
- Error handling on every async operation
- JSDoc on all exported functions

List violations with line numbers. Be direct.
Enter fullscreen mode Exit fullscreen mode

/standup — generate your daily update

# .claude/commands/standup.md
Look at git log for the last 24 hours and open TODO.md.
Generate a standup update:
- What was completed (from git commits)
- What's in progress (from TODO.md WIP items)
- Any blockers you can see in the codebase

Keep it under 5 bullet points total.
Enter fullscreen mode Exit fullscreen mode

/migrate — database migration helper

# .claude/commands/migrate.md
Create a database migration for: $ARGUMENTS

Rules:
- Use our migration format in /db/migrations/
- Filename: YYYYMMDD_description.sql
- Include both UP and DOWN migrations
- Check existing migrations for naming patterns first
Enter fullscreen mode Exit fullscreen mode

The rate limit problem with heavy slash command use

If you're building custom commands into your workflow, you'll hit rate limits faster. Each /deploy, /review, /standup call consumes tokens.

The fix most Claude Code power users use is ANTHROPIC_BASE_URL:

export ANTHROPIC_BASE_URL=https://simplylouie.com
Enter fullscreen mode Exit fullscreen mode

This routes your Claude Code through SimplyLouie — a proxy that removes the rate limit wall at ✌️2/month. Your slash commands keep working, just without the mid-session interruption.

Sharing commands across projects

Global commands go in ~/.claude/commands/:

mkdir -p ~/.claude/commands

# Now /standup and /review work in every project
cp .claude/commands/standup.md ~/.claude/commands/
cp .claude/commands/review.md ~/.claude/commands/
Enter fullscreen mode Exit fullscreen mode

Project-level commands override global commands with the same name.

Quick reference: command discovery order

1. Built-in Claude Code commands
2. ~/.claude/commands/ (global custom)
3. .claude/commands/ (project custom, wins on conflict)
Enter fullscreen mode Exit fullscreen mode

The workflow

Most productive Claude Code setup I've seen:

  1. Create 3-5 custom commands for your most repeated tasks
  2. Put them in ~/.claude/commands/ so they work everywhere
  3. Add project-specific ones in .claude/commands/ for project context
  4. Use /compact instead of /clear to preserve session state
  5. Run /cost weekly to understand your usage patterns

The slash command system is underused. Most developers treat it as a menu — it's actually a scripting layer.


Rate limits slowing down your slash command workflows? SimplyLouie routes Claude Code through ANTHROPIC_BASE_URL at ✌️2/month — 7-day free trial, no commit.

Top comments (0)