Live on Product Hunt Intraface launched today. Less steering, more vacations. See the launch
Start for free

What are Claude Code slash commands?

Claude Code slash commands are messages that start with a forward slash, such as /compact or /model, and run an action instead of going to Claude as plain text. Built-in commands execute fixed logic inside Claude Code. Custom commands are Markdown files in .claude/commands/ or skills in .claude/skills/, so /deploy expands into a prompt you wrote once.

Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.

How it works

You type a slash command; Claude Code either runs it directly or reads your Markdown file and sends its content, plus your arguments, to Claude.youClaude Codereads the / menubuilt-in command/clear, /compact, /modeldeploy.mdin .claude/commands/Claudethe model1. types /deploy staging2a. runs fixed logic2b. reads the file3. prompt + arguments
  1. Type / at the start of a message. The menu lists built-in commands, bundled skills, your own commands and MCP prompts. Text after the name is the arguments.

  2. A built-in command such as /clear, /compact, /model or /permissions runs fixed logic in Claude Code itself. Nothing is sent to the model.

  3. A custom command is a Markdown file. .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy; the file's content becomes the prompt.

  4. $ARGUMENTS, $0, $1 or named arguments fill in what you typed. A !`command` placeholder runs a shell command first and pastes its output into the prompt.

    Fix GitHub issue $ARGUMENTS following our coding standards.
  5. Frontmatter shapes the command: description shows in the menu, allowed-tools pre-approves tools for that turn, model picks a model, argument-hint names inputs.

Source: Claude Code docs: commands reference

Slash commands versus plain prompts

A plain prompt goes to the model, which decides what to do. A slash command is handled by Claude Code first. For built-in commands that is the whole story: /clear starts a fresh conversation, /compact summarises the one you have to free context, /model switches models, /resume reopens an earlier session, /rewind steps the code and conversation back to a checkpoint. None of that involves asking Claude anything.

Custom commands sit in between. Claude Code reads a Markdown file, substitutes your arguments, runs any shell placeholders, and only then hands the result to the model as a prompt. The command is a saved prompt with a short name. That is why it is worth writing one for anything you type more than twice a week: a review checklist, a release procedure, a way of summarising test failures.

Bundled skills such as /doctor, /code-review and /loop work the same way as your custom ones. They are prompt-based, and the docs are explicit that most built-in commands instead execute fixed logic directly.

Example: a /fix-issue command

Save this as .claude/commands/fix-issue.md or as .claude/skills/fix-issue/SKILL.md:

---
description: Fix a GitHub issue
argument-hint: [issue-number]
allowed-tools: Bash(gh issue view *) Bash(git status *)
---
Fix GitHub issue $ARGUMENTS following our coding standards.
Start with the issue text: !`gh issue view $0`

Typing /fix-issue 42 makes Claude Code run gh issue view 42, paste the output where the placeholder was, and send the whole thing to Claude. The two allowed-tools rules mean those commands run without a permission prompt for that turn. If the injected command fails, the whole invocation is aborted, which is better than Claude working from an empty issue.

Arguments are positional and 0-based: $0 is the first, $1 the second. Multi-word values need quotes. If you declare arguments: [issue, branch] in the frontmatter you can write $issue and $branch instead.

Where commands live

Three places, with different scopes. ~/.claude/skills/<name>/SKILL.md is personal and follows you to every project on the machine. .claude/skills/<name>/SKILL.md and .claude/commands/*.md are project scope and can be committed, so the whole team gets the same /deploy. Plugins add theirs under a namespace, /plugin-name:skill-name, and a command in a subfolder is namespaced too: .claude/commands/frontend/component.md becomes /frontend:component.

When names collide, enterprise settings win over personal, and personal over project. A skill with the same name as a bundled command replaces it, but not its aliases. Intraface's Claude Code setup relies on this: it adds an MCP server and a skill, so the board workflow shows up in the / menu like anything else.

Common mistakes

  • Putting the command mid-sentence. Claude Code only recognises a command at the start of a message. Anything after the name is arguments, nothing before it counts.
  • Expecting the file to be re-read. The content is added to the conversation when you invoke the command. If the conversation is compacted later, invoke it again; only the start of a long skill may survive compaction.
  • Hand-rolling what a hook should do. A command runs when you call it. A rule that must hold every time, like running the formatter after each edit, belongs in a hook, not in a prompt.
  • Chaining too much. You can start one message with several skills, /a /b do this, up to six. Past two or three the instructions start to fight.

FAQ

Are Claude Code slash commands the same as skills?
They have merged. A file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and behave the same. The docs recommend skills for new work because a skill folder can hold supporting files and scripts, and a skill can also be picked up by Claude on its own when its description matches.
Can an MCP server add Claude Code slash commands?
Yes. Prompts an MCP server exposes appear in the / menu and run as /mcp__servername__promptname. Arguments go after the name, separated by spaces, and the server fills them into its prompt template.
Why does my Claude Code slash command not run?
A command is only recognised at the start of a message. If the name is right, check the frontmatter: malformed YAML loads the body with no fields set, so the command still runs but has no description or argument hint. Frontmatter is only read when the opening --- is the first line of the file. /doctor gives a setup checkup.

Stop sending HTMLover Slack.

Create an account in a minute, connect your coding agent, and make your first board.