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.
Related terms
- Prompt engineering — the umbrella skill
- Subagent — a heavier, more isolated version
- Hook — event-driven automation, a different tool
- System prompt — related but for the whole session
- Claude Code — main implementation this page references
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
- Agentic codingAgentic coding is software development where an LLM-powered agent plans, edits, runs, and verifies code on its own using tools, not just autocomplete.
- AI pair programmingAI pair programming is a collaboration style where an LLM assistant sits alongside you, suggesting code and reviewing changes in real time as you work.
- ANSI escape codesANSI escape codes are control sequences that terminals interpret for colors, cursor movement, and screen clearing — the language of every modern CLI UI.
- Autonomous agentAn autonomous agent is an AI program that perceives, decides, and acts on its own toward a goal — the architecture behind modern coding CLIs.
- CheckpointA checkpoint is a saved snapshot of file state that lets you roll back an AI coding agent's changes to a known-good point.
- Claude CodeClaude Code is Anthropic's official command-line agent that plans, edits, runs, and verifies code across your repo using Claude models and tool use.