Slash command
A slash command is an instruction typed with a leading slash, such as /compact or /review, that tells an AI tool to run a built-in action or a saved prompt instead of treating the text as an ordinary message.
Also called: custom command
By Divya Sharma · Checked Nov 15, 2026 · How we review
Slash commands come from chat apps like Slack and IRC, and AI tools adopted them as a quick way to reach features without leaving the keyboard. In a coding agent, typing a slash usually opens a menu of the commands available.
Built-in and custom commands
Built-in commands control the tool itself: clear the conversation, switch models, check usage, or compact the context with /compact. Custom commands are saved prompts. In Claude Code, a Markdown file in the project's commands folder becomes a command named after the file, and its text is sent as the prompt when you run it. Anything typed after the command name is passed in as arguments, so /fix-issue 123 can fill the issue number into the template. Claude Code has since folded custom commands into agent skills, which can be run by name the same way or picked up by the model when relevant. Browse shared ones in the skills directory.
MCP servers can offer commands too: the protocol's prompts are templates that clients often show as slash commands.
Why they matter
A command turns a prompt you would retype every day, such as "review this diff against our checklist", into one consistent step that the whole team can share through the repository.
Limits
A slash command is a shortcut for a prompt, not a guarantee. The model still interprets the text, so results vary between runs. For actions that must happen every time, use agent hooks.
Related terms
- Coding agent
- A coding agent is an AI agent that works on software directly: it reads a codebase, edits files, runs commands and tests, and repeats until a change works, rather than only suggesting code for a person to paste.
- Agent skills
- Agent skills are folders of instructions, scripts and reference files, each described by a SKILL.md file, that an AI agent can discover and load only when a task needs them.
- MCP resources and prompts
- MCP resources and prompts are two things an MCP server can offer besides tools. Resources are pieces of data, each with a URI, that an app can add to context; prompts are reusable message templates a user chooses to run.
- Agent instructions file (AGENTS.md)
- An agent instructions file is a Markdown file in a code repository, such as AGENTS.md or CLAUDE.md, that a coding agent reads at the start of a session to learn the project's commands, conventions and rules.
- Agent hooks
- Agent hooks are user-defined commands or scripts that a coding agent runs automatically at set points in its work, such as before a tool call or after a file edit, to check, block or extend what it does.