Claude Code · Slash Commands

Replace Multi-Step Tasks with Single Keystrokes

Terminal shortcuts that supercharge your workflow.

Claude Code slash commands are shortcuts you type in the terminal to trigger specific actions — like /init to create a CLAUDE.md, /review to check your code, or /commit to stage and commit changes with an AI-generated message. They replace multi-step manual processes with single keystrokes, letting you stay in flow while Claude handles the heavy lifting.

Claude Code slash commands are built-in shortcuts that control session behavior. Key commands include /init (generate project config), /compact (compress conversation), /cost (check API usage), /model (switch models), and /review (code review). You can also create custom slash commands in .claude/commands/ for project-specific workflows.

Reference

Built-in Slash Commands

/init

Creates a CLAUDE.md file in your project root. This file acts as persistent memory for Claude Code — it stores project conventions, architecture notes, and instructions that Claude reads at the start of every session. Running /init in an existing project scans your codebase and generates a starter CLAUDE.md automatically.

/review

Triggers a code review of your current changes. Claude examines your staged and unstaged diffs, checks for bugs, security issues, style violations, and potential improvements. It returns structured feedback you can act on immediately — no need to push to a remote and wait for CI.

/commit

Stages your changes and creates a commit with an AI-generated message. Claude analyzes the diff, writes a concise commit message that captures the 'why' rather than the 'what,' and commits. You can review and edit the message before it finalizes.

/clear

Clears the current conversation context. Useful when you are switching tasks or when the context window is getting long. Claude starts fresh with only your CLAUDE.md and project files for context.

/model

Switches the active model mid-session. Use /model opus for complex reasoning, /model sonnet for standard coding, or /model haiku for simple tasks. This lets you optimize cost and speed without restarting your session.

/help

Displays a reference of all available slash commands, keyboard shortcuts, and configuration options. A quick way to discover commands you might not know about yet.

/bug

Reports a bug to the Claude Code team. Captures your current context, session state, and the issue description so the team can reproduce and fix the problem.

/config

Opens or modifies your Claude Code configuration. You can adjust permissions, set default behaviors, configure allowed and denied commands, and manage other settings without manually editing JSON files.

Customization

Custom Slash Commands

You can define your own slash commands to automate repetitive workflows. Custom commands live in your project's .claude/settings.json file or in your CLAUDE.md. When you type the command, Claude reads the associated prompt and executes it as if you had typed it manually.

.claude/settings.json
{
  "slash_commands": {
    "/test": "Run the full test suite and report failures",
    "/deploy": "Run tests, build, then deploy to staging",
    "/doc": "Generate JSDoc comments for all exports",
    "/security": "Audit the current file for vulnerabilities"
  }
}
Project-level commands

Define commands in .claude/settings.json at your project root. These are shared with your team through version control. Everyone who works on the repo gets the same commands automatically.

User-level commands

Define personal commands in ~/.claude/settings.json for commands you want everywhere. These apply across all your projects and stay on your machine — not committed to any repo.

CLAUDE.md-based commands

You can also reference slash commands in your CLAUDE.md with detailed instructions. This lets you write multi-paragraph prompts that Claude follows when the command is invoked — ideal for complex, context-heavy workflows.

When to Use What

Slash Commands vs. Regular Prompts

Use slash commands when...
  • You repeat the same action multiple times a day
  • The task has a predictable, well-defined outcome
  • You want consistency across team members
  • Speed matters more than nuance
  • The workflow can be described in a single instruction
Use regular prompts when...
  • The task requires back-and-forth conversation
  • You need to explain context or constraints
  • The problem is exploratory or ambiguous
  • You want Claude to ask clarifying questions
  • Each instance is different enough to need custom instructions

Workflows

Building a Workflow with Slash Commands

The real power of slash commands emerges when you chain them into a development workflow. Here is a typical feature development cycle using slash commands at each stage:

1. Initialize the project/init

Start by running /init to ensure Claude understands your project structure. This creates or updates the CLAUDE.md with architecture details, conventions, and dependencies that Claude references throughout the session.

2. Write the featureRegular prompt

Describe the feature you want to build. Claude reads your CLAUDE.md context and implements the code across relevant files. This is conversational — you can iterate, ask questions, and refine.

3. Review the changes/review

Before committing, run /review. Claude examines every change, flags potential bugs, security issues, and style violations. Fix anything it catches before moving to the next step.

4. Run custom checks/test or /security

If you have defined custom commands for testing or security scanning, run them now. These can invoke your test suite, linters, or any project-specific validation.

5. Commit the work/commit

Claude stages the relevant files, generates a descriptive commit message based on the actual diff, and creates the commit. You review the message and approve.

Frequently Asked Questions

Where can I find the full list of Claude Code slash commands?

Type /help in any Claude Code session to see every available command with descriptions. The list updates as new commands are added in Claude Code releases. You can also check the official Anthropic documentation for the most current reference.

Can I share custom slash commands with my team?

Yes. Custom slash commands defined in your project's .claude/settings.json are committed to version control and shared with anyone who clones the repo. Team members get the same commands automatically when they start a Claude Code session in that project.

Do slash commands work in VS Code or other IDEs?

Claude Code slash commands work in the Claude Code CLI terminal. If you use the Claude Code extension for VS Code, slash commands work in the integrated terminal panel. The commands are not IDE-specific — they work anywhere Claude Code runs.

How do I create complex multi-step slash commands?

Define a custom slash command with a detailed prompt that describes the multi-step workflow. For example, a /deploy command could instruct Claude to run tests, build the project, check for linting errors, and then deploy — all in sequence. Claude interprets the prompt and executes each step.

What is the best slash command to start with?

Start with /review and /commit. These two commands cover the most common workflow: review your changes for bugs and style issues, then create a well-described commit. Once comfortable, add custom commands for your project-specific workflows like testing, deployment, or documentation generation.

Master advanced Claude Code workflows

Your first custom command. 20 minutes.