PrepGenAICerts

Slash Commands

Claude Code

Definition

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 starter CLAUDE.md by 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:

CommandsSkills
Invoked byExplicit name (/command-name)Claude judging relevance to the current task
TriggerThe user types the commandA 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/*.md files are just as much slash commands as /clear or /init.
  • Confusing a Command (explicit, named invocation) with a Skill (implicit, relevance-based loading) because both are Markdown-authored reusable instructions.

PrepGenAICerts is an independent exam-prep site. It is not affiliated with, endorsed by, or sponsored by Anthropic, PBC. Claude and Anthropic are trademarks of Anthropic, PBC. Exam details are taken from publicly available Anthropic and Pearson documentation. About PrepGenAICerts.