ConsLabs
Claude Code
Advanced Features2 min read

Slash Commands

Built-in and custom slash commands: packaging a repeatable prompt into a single, named, reusable invocation.

A slash command is a named, reusable prompt — typed as /name instead of retyped in full every time you want to run the same kind of request.

Built-in commands

Claude Code ships with commands for session-level operations: clearing the conversation and starting fresh, compacting a long conversation's history to free up context while preserving the gist of what happened, checking configuration, and similar housekeeping. These exist because session management is something every user needs regardless of project, so it doesn't make sense to leave it to custom configuration.

Custom commands

A custom command is a markdown file living in a commands directory, containing the prompt template to run when invoked. Anything you find yourself typing out in full more than a couple of times is a candidate — a custom /review command, for instance, captures a specific checklist once and runs it identically every time, rather than rewriting (and inevitably varying) the instructions by hand on each call.

A simple example, defining /review:

---
description: Review the current diff for correctness and security issues
---
 
Review the current diff. For each issue found, report the file, line, what's wrong, and why it
matters. Focus on correctness bugs and security issues; skip pure style preferences unless they
indicate an actual bug.

Commands can also accept arguments, letting one template handle a family of related requests instead of needing a near-duplicate command for each variant.

Project-level vs personal commands

Commands can be defined at the project level (checked into the repository, shared with everyone working on it) or at a personal level (your own shortcuts, available across every project you work in). A /review command tailored to a specific team's review checklist belongs in the project; a general-purpose command you find useful everywhere belongs in your personal set.

What makes a good slash command

The best candidates are requests that are well-defined, repeated often, and don't meaningfully vary in wording between uses — a checklist, a fixed multi-step routine, a standard report format. Requests that genuinely differ each time, where you'd be editing the template more than reusing it verbatim, are usually better off as plain prompts.

Next: skills, for instructions that should load only when actually relevant.