Slash Commands
Claude CodeDefinition
Named, explicitly invoked instructions in Claude Code -- built-in (e.g., /clear, /init, /help) or custom commands authored as Markdown prompt files in .claude/commands/. Distinguished from Skills by invocation: a Command is called by name; a Skill loads automatically when Claude judges it relevant.
Example Usage
Author a custom /review-pr command as a Markdown file in .claude/commands/ so a frequently repeated multi-line review prompt becomes a single named invocation instead of being re-typed every session.
In Depth
Built-in vs. Custom
Claude Code ships with built-in slash commands for common actions:
/clear-- resets the conversation context to keep it focused/init-- bootstraps a starterCLAUDE.mdby analyzing the existing codebase/help-- lists available commands
Beyond the built-ins, a developer can author custom slash commands as Markdown prompt files placed in .claude/commands/. Each file defines a repeated workflow -- a prompt template -- invoked later by name (/command-name) instead of being re-typed or re-explained every session.
Why This Matters for Workflow Design
Custom commands are one of the concrete mechanisms Anthropic's best-practice guidance points to for tightening a workflow with custom commands and hooks rather than long, brittle ad hoc prompts. Encoding a repeated procedure once as a command turns a fragile habit (remembering to re-type the same multi-line instruction correctly every time) into a durable, versioned artifact.
Commands vs. Skills
Commands and Skills both package reusable instructions as Markdown, which makes them easy to confuse. The distinguishing factor is invocation:
| Commands | Skills | |
|---|---|---|
| Invoked by | Explicit name (/command-name) | Claude judging relevance to the current task |
| Trigger | The user types the command | A description field in SKILL.md frontmatter |
A Command always requires the user to know it exists and type its name; a Skill can activate without the user ever knowing its name, purely from the task matching its description.
Common Pitfalls
- Assuming all slash commands are built-in -- custom commands authored as
.claude/commands/*.mdfiles are just as much slash commands as/clearor/init. - Confusing a Command (explicit, named invocation) with a Skill (implicit, relevance-based loading) because both are Markdown-authored reusable instructions.