Definition

Slash command

A slash command is a reusable named prompt macro invoked with a leading slash, like /review or /test, used to trigger repeatable agent workflows.

A slash command is a reusable named prompt macro invoked with a leading slash, like /review or /test. In agentic coding CLIs — most notably Claude Code — slash commands are how you package repeatable workflows so you don't have to retype the same instructions every session.

Why it matters

Every developer ends up asking their coding agent the same questions: "review this diff", "write tests for the current file", "explain this function", "refactor to use async/await". Slash commands take those recurring prompts and turn them into a single keystroke. They're the simplest form of prompt engineering reuse — cheaper than a subagent, quicker than writing the prompt each time.

In SpaceSpider panes, your Claude Code slash commands are available exactly as they would be in a standalone terminal. Nothing is intercepted — the CLI reads your ~/.claude/commands/ directory or project-local .claude/commands/ as usual.

How it works

A Claude Code slash command is a Markdown file in .claude/commands/<name>.md. The file contains the prompt body (plain Markdown, with optional $ARGUMENTS placeholder for user-supplied text). When you type /<name> some args in an interactive session, the CLI loads the file, substitutes the argument, and sends it as the user turn.

Minimal example — .claude/commands/review.md:

Review the diff currently staged in git. Focus on correctness,
performance, and test coverage. Ignore style nits.

Invoke with /review. Slash commands can include tool-use directives, structured instructions, or links to other files. Some teams store a dozen in a shared repo and distribute them via CLAUDE.md.

How it's used

Common slash commands developers maintain:

  • /review — review the staged diff
  • /test — write tests for the current file
  • /plan — force plan mode for the upcoming change
  • /explain — explain the selected code
  • /fix — read the most recent error output and fix it
  • /commit — write a conventional commit message

Other CLIs (Codex CLI, Qwen Code, Kimi CLI) have similar mechanisms with slightly different file layouts.

FAQ

Can I share slash commands across a team?

Yes — commit .claude/commands/ to your repo. Every team member using Claude Code gets them automatically when they open the repo.

Do slash commands work with Codex CLI?

Codex CLI has its own custom command mechanism — similar idea, different file format. Check the Codex CLI docs for specifics. The general pattern of "named reusable prompts" applies everywhere.

Related terms