What Is a Slash Command?
A slash command is a chat shortcut triggered by typing “/” (forward slash) at the beginning of an input field, followed by a command name. Slash commands are used across a wide range of tools — Discord, Slack, Microsoft Teams, Notion, and Anthropic’s Claude Code — to let users invoke predefined prompts, automations, or integrations without leaving the chat interface.
Think of slash commands as the chat-UI equivalent of keyboard shortcuts like Ctrl+C. Instead of retyping a multi-line prompt or clicking through a menu, a user types a short identifier and the tool expands it into a full action. In Claude Code, for example, typing /init generates a fresh CLAUDE.md for the current repository, and /review runs a structured pull-request review — all from a handful of keystrokes.
How to Pronounce Slash Command
slash command (/slæʃ kəˈmænd/)
slash-command (/slæʃ kəˈmænd/)
How Slash Commands Work
When the input parser detects a “/” at the start of a message, the client switches into command mode and treats the following token as a command name. The system looks up the name in a registered command table and executes the associated handler — expanding a prompt, calling an internal API, or firing a webhook. An important point to note is that the “/” trigger behaves slightly differently across platforms.
Platform-specific flavors
| Platform | Purpose | Examples |
|---|---|---|
| Claude Code | Prompt expansion, skill invocation | /init, /review, /clear |
| Discord | Bot actions, API interactions | /play, /kick, /tts |
| Slack | App integrations, webhooks | /remind, /jira |
| Microsoft Teams | Status changes, calls | /available, /call |
| Notion | Block insertion, formatting | /heading, /todo |
Typical execution flow
Slash command pipeline
command mode
suggestions
validated
result returned
Slash Command Usage and Examples
Defining a custom command in Claude Code
In Claude Code, adding a new slash command is as simple as creating a Markdown file in the .claude/commands/ directory. The filename becomes the command name.
# .claude/commands/security-review.md
Review the current branch from a security perspective.
Check for:
- SQL injection, XSS, CSRF vectors
- Hardcoded secrets or credentials
- Missing authentication or authorization
Report findings as a prioritized (HIGH / MEDIUM / LOW) list
with suggested fixes.
Once the file is saved, typing /security-review in the chat sends the embedded prompt to Claude. Team-wide commands live in the project’s .claude/commands/, while personal commands go in ~/.claude/commands/.
Registering a slash command for a Discord bot (Python)
import discord
from discord import app_commands
intents = discord.Intents.default()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
@tree.command(name="hello", description="Says hi")
async def hello(interaction: discord.Interaction):
await interaction.response.send_message(
f"Hello, {interaction.user.display_name}!"
)
@client.event
async def on_ready():
await tree.sync()
print(f"Logged in as {client.user}")
client.run("YOUR_BOT_TOKEN")
On Discord, commands must be registered with the API (via tree.sync()) before they become visible to users. Discord auto-complete will surface the command as the user types /hel... in the client.
Slack slash commands
For Slack apps, slash commands are configured in the developer dashboard at api.slack.com. You register a name (e.g., /deploy) and a request URL. When a user runs the command, Slack sends a POST to your endpoint with the payload, and your service replies with a message to post back. In production, slash commands commonly drive CI/CD triggers, ticket creation, and internal reporting.
Advantages and Disadvantages of Slash Commands
Advantages
✅ Low learning curve
Typing “/” reveals suggestions, making discovery intuitive.
✅ High reusability
Recurring prompts and actions are captured once and reused.
✅ Shareable
Commit command files to a repo and the whole team gets them.
✅ UI integration
External systems reachable without leaving the chat.
Disadvantages
⚠️ Hard to curate
As commands pile up they become hard to remember and discover.
⚠️ Platform-specific
Definition formats differ sharply across tools.
⚠️ Change management
Renaming or retiring a command requires broad communication.
⚠️ Accidental triggers
Messages starting with “/” (like paths) can fire commands unintentionally.
Slash Command vs Agent Skill
Slash commands and Anthropic’s Agent Skills solve overlapping but distinct problems. A slash command is a user-triggered shortcut; an Agent Skill is a model-triggered playbook. Remember that a slash command runs only when the user types the command, whereas an Agent Skill activates when the model decides (based on context) that the skill is relevant.
| Aspect | Slash Command | Agent Skill |
|---|---|---|
| Trigger | Explicit user input: /name |
Model picks autonomously from context |
| Content | Fixed prompt or action | SKILL.md plus supporting files |
| Flexibility | Static behavior | Branches based on the task |
| Typical use | Code review, init, cleanup | Document creation, data workflows |
Common Misconceptions
Misconception 1: “Slash commands are Claude Code-specific”
Keep in mind that slash commands predate Claude Code. Discord pioneered the pattern for bots, Slack popularized it for enterprise integrations, and tools like Notion and Mattermost adopted similar conventions years ago.
Misconception 2: “The command name is the whole story”
Many slash commands accept arguments. For example, /remind me at 10am "stand-up" passes everything after the name as arguments. On Discord you define a formal argument schema (name, type, required/optional) up front.
Misconception 3: “Defining commands looks the same everywhere”
Note that every platform has its own format. Claude Code uses Markdown, Discord uses JSON or code registration, Slack uses a web form. Always check the target platform’s docs before starting.
Real-World Use Cases
Standardized code review in Claude Code
With a /review command, every engineer on a team runs the same review prompt — same checklist, same tone, same output shape. This reduces variance in review quality and ensures shared conventions are enforced consistently.
CI/CD kicks from Slack
A widely used pattern is a Slack app that registers /deploy staging and triggers a GitHub Actions workflow via webhook. Teams get full deploy visibility in their primary chat channel, with the command flow audit-logged for free.
Faster writing in Notion
Writers rely on /code, /table, /todo to stay in flow, inserting blocks without reaching for the mouse. It’s important to note that this lightweight UI has made Notion a default choice for technical writers.
Custom AI-driven workflows
Engineering teams increasingly ship project-specific commands for /release-notes, /write-tests, or /migrate-schema, baking institutional knowledge into the repo itself so every contributor benefits.
Frequently Asked Questions (FAQ)
Q1: Can I pass arguments to a Claude Code command?
Yes. Placeholders such as $1 or $ARGUMENTS inside the Markdown file are replaced with the user’s input when the command runs.
Q2: Can slash commands be disabled?
Yes, but the mechanism varies. Discord uses role permissions; Slack admins can hide app commands; in Claude Code, just remove the Markdown file.
Q3: How do I separate personal commands from team commands?
In Claude Code, personal commands go in ~/.claude/commands/, and project commands go in ./.claude/commands/. Commit the project ones; keep personal ones private.
Q4: What happens when two commands share a name?
Most tools give precedence to the more-specific scope. Claude Code prefers project-level commands over user-level ones.
Q5: How are slash commands different from keyboard shortcuts?
Keyboard shortcuts are key combinations. Slash commands live in the text input. The two coexist — Slack supports both for many actions.
Conclusion
- A slash command is a chat shortcut that executes an action when a user types
/name. - It’s a widespread UI pattern used in Claude Code, Discord, Slack, Teams, Notion, and more.
- In Claude Code, adding a command is as easy as dropping a Markdown file into
.claude/commands/. - Strengths include discoverability, reusability, and shareability across a team.
- Tradeoffs include curation overhead and platform-specific formats.
- Unlike Agent Skills, slash commands are explicitly user-triggered.
- Committing project commands to source control levels up team quality instantly.
References
📚 References
- ・Anthropic. “Claude Code — Slash Commands.” https://docs.claude.com/en/docs/claude-code/slash-commands
- ・Discord Developer Portal. “Application Commands.” https://discord.com/developers/docs/interactions/application-commands
- ・Slack API. “Slash Commands.” https://api.slack.com/interactivity/slash-commands



































Leave a Reply