🔥 Launch tonight — Claude Code Power Prompts PDF 50p (just 50p tonight)30 battle-tested prompts · 8-page PDF · paste into CLAUDE.md · flat 50p tonight

Claude Code Slash Commands

Updated May 2026 · Inside-session command reference

Slash commands are typed inside an active Claude Code session (the REPL). They give Claude specific modes and actions without exiting the session. Type /help inside any session to see the current list.

Quick tip: Press Tab to autocomplete slash commands. Press / to navigate command history.

Code Review & Quality

/review [path-or-diff]
Run a structured code review. Without arguments, reviews staged changes. Produces findings grouped by severity (critical / warning / suggestion).
/review
/review src/api/auth.ts
/review HEAD~3          # last 3 commits
/review --format json   # for CI pipelines
/fix [description]
Fix a bug, type error, or test failure. Claude reads the error output, traces the root cause, and applies a minimal targeted fix.
/fix
/fix "TypeError: Cannot read properties of undefined"
/fix the failing auth tests
/test [file]
Run tests and fix failures. Claude runs your test command (from CLAUDE.md or detected from package.json), reads failures, and patches the code.
/test
/test src/auth.test.ts
/test --write           # also write missing tests
/security [path]
Security-focused review. Checks for OWASP Top 10, hardcoded secrets, SQL injection, XSS, and auth bypass patterns.
/security
/security src/api/
/security --report      # full markdown report

Git & Collaboration

/commit [message]
Write a commit message for staged changes that matches your repo's convention (detected from git log). Optionally creates the commit.
/commit
/commit --create
/commit "fix: handle null session"
/pr [create|describe|review <n>]
Pull request workflows. Requires gh CLI authenticated.
/pr create          # create PR with AI description
/pr describe        # just write the description
/pr review 42       # review PR #42 from GitHub
/diff [base]
Show and summarize the diff. More useful than raw git diff because Claude explains why each change matters.
/diff
/diff main
/diff HEAD~5

Code Navigation & Understanding

/explain [symbol-or-file]
Deep explanation of code. Claude traces call graphs, explains design decisions, and surfaces non-obvious invariants.
/explain src/queue/worker.ts
/explain AuthMiddleware
/explain "how does token refresh work here?"
/find [what]
Find code by description. Claude uses ripgrep + AST analysis to locate the relevant code, even if you don't know the exact symbol name.
/find "where is the rate limiter"
/find "all places we call stripe"
/find TODO comments with no ticket numbers
/map [path]
Generate a visual map of module dependencies and data flow for a directory or file.
/map src/
/map src/auth/
/map --format mermaid

Editing & Refactoring

/edit [file] [instructions]
Edit a specific file. Claude makes targeted changes, shows a diff, and asks for confirmation before writing.
/edit src/auth.ts add JWT refresh
/edit . fix all ESLint warnings
/edit --no-confirm src/utils.ts remove unused exports
/refactor [description]
Larger-scale refactoring. Claude plans the change across multiple files before executing, and summarizes what will change.
/refactor rename UserService to AccountService everywhere
/refactor extract the payment logic into its own module
/refactor make the API layer async/await throughout
/docs [path]
Generate or update documentation. Produces JSDoc/TSDoc, README sections, or ADR-style decision records.
/docs src/api/
/docs --format readme
/docs src/auth.ts update existing jsdoc

Session Management

/clear
Clear the conversation context. Use when starting a new unrelated task to avoid context pollution.
/context
Show current context usage — how many tokens are loaded and which files are in context.
/model [name]
Switch models mid-session. Useful for switching between Opus (thorough) and Sonnet (fast).
/undo
Revert the last file edit Claude made. Works on the most recent edit only — use git for full undo history.
/run [command]
Run a shell command and bring the output into context. Claude can then act on the output.
/help [command]
Show help for any slash command, or list all available commands.

Creating Custom Slash Commands

Claude Code supports custom slash commands defined in your CLAUDE.md or in ~/.claude/commands/:

# In CLAUDE.md or ~/.claude/commands/deploy.md

name: deploy
description: Run staging deploy and post result to Slack
command: |
  ./scripts/deploy-staging.sh
  if [ $? -eq 0 ]; then
    ./scripts/slack-notify.sh "Staging deploy succeeded"
  fi

Then use /deploy inside any session. Commands have access to the session context, so Claude can make decisions based on what you've been working on.

→ Next: Keyboard Shortcuts

← Back to Home