What are slash commands? Claude Code, Codex, Cursor, Grok

By

Slash commands are the /name controls inside a coding agent session. How they work in Claude Code, Codex, Cursor and Grok Build, and how to add your own.

~~~

Slash commands are named controls you run by typing / and a name in the agent’s prompt. Some change the session, like the model or the permission mode. Others hand the agent a saved prompt and let it do the work.

How slash commands work

You type / at the start of a message. The agent filters the commands you have. Built-in commands run their own logic: clear the chat, show the diff, switch plan mode. A skill or custom prompt is different. The tool loads that file and sends it to the model as the next instruction, with any arguments you typed after the name.

What happens when you run a slash commandYou type a slash and a name. A built-in command changes the session directly. A skill or custom prompt is loaded as text and sent to the model as the next instruction.Built-inSkill or custom promptYou type / and anameBuilt-in or savedprompt?The tool changes thesessionThe file is sent tothe model

Claude Code, Codex and Grok Build each have a separate way to run a shell line from the prompt. The slash menu is for the agent itself.

Slash commands in each tool

Claude CodeCodexCursorGrok Build
Open the listType /Type / in the composerType / in the CLIType /
Your own commandA skill, or a file in .claude/commands/A skill. Files in ~/.codex/prompts/ still work and are deprecatedNot documentedA user-invocable skill, as /name
Free context/compact, with optional focus text/compact/summarize (alias /compress)/compact
Side question/btw/side or /btwNot documented/btw

Claude Code

In Claude Code, a command is recognized only at the start of your message. Text after the name becomes its arguments. Type / to filter the menu. A few commands stay hidden until you type the full name.

Built-in commands such as /clear, /model and /compact are coded into the CLI. Skills, including bundled ones like /code-review, are prompts the model follows. You can put your own commands in .claude/commands/, or install them from a plugin. The docs recommend skills for multi-step commands.

You can start one message with several skills, up to six: /skill-a /skill-b do XYZ loads both and passes the trailing text to each. If you send a command while Claude is responding, Claude Code queues it and runs it after the turn, except a few that run immediately, such as /status, /tasks and /usage.

Not every command appears for every account. Availability depends on your platform, plan and environment.

See Commands in the Claude Code docs.

OpenAI Codex

In Codex, type / in the composer to open the popup, then start typing the name. While a chat is running, type a slash command and press Tab to queue it for the next turn. Codex parses that queued command when it runs, so menus and errors show up after the current turn.

/plan switches into plan mode and can take the task on the same line. /permissions changes what Codex can do without asking. /skills browses skills. /init writes an AGENTS.md scaffold.

Custom prompts are deprecated. They are still Markdown files in ~/.codex/prompts/, invoked as /prompts:name, and they are not shared through the repository. The docs say to use skills for a reusable prompt, including one you want Codex to invoke on its own. After you edit a prompt file, restart Codex or open a new chat.

/plan is unavailable while Codex is already working.

See the Codex slash commands and custom prompts.

Cursor

The Cursor CLI has its own slash command list. /plan switches to Plan mode or submits a prompt in that mode. /ask toggles read-only Ask mode. /model selects a model. /resume opens recent chats. /summarize shortens the conversation, and /compress is an alias. /run-everything toggles Run Everything, with /auto-run as an alias. /sandbox configures the sandbox.

/goal gives the agent a long-lived objective. The CLI docs mark it as rolling out, so it may be missing from your install.

In Agent chat, /create-rule generates a project rule file. The docs don’t publish a separate list of custom slash commands for the editor.

See the Cursor CLI slash commands.

Grok Build

Grok Build’s TUI has a command palette, plus commands from the shell, plus any user-invocable skill. A skill shows up as /name. If two names collide, use the qualified form, such as /local:commit.

/plan enters plan mode. /context shows context usage, and /compact summarizes history. /btw asks a side question without interrupting. /queue lists prompts waiting behind the running turn. A few commands appear only when the feature is available, such as /imagine and /loop.

/hooks, /plugins, /marketplace, /skills and /mcps open the same extensions modal on different tabs.

See Modes and commands in the Grok Build docs.

Details checked against each vendor’s documentation in October 2026.

A real example

This starts a planning pass in Claude Code, Codex, the Cursor CLI and Grok Build. The task text is the same in all four:

/plan Add a last-updated line under the title on each post page. Read the updated field in the frontmatter of src/posts. Use the publish date when that field is missing. Don't change the RSS feed.

/plan with text is documented for each of them. In Codex, skip it while a turn is already running.

After the edit, check the diff and then free the context window before the next task. The compact command is not the same name everywhere:

/compact Keep the files we changed and the test command

That focus text is a Claude Code argument. Codex and Grok Build use /compact without that documented focus sentence. In the Cursor CLI the command is /summarize.

For a command you will reuse, put it in a skill rather than retyping it. In Claude Code and Grok Build that skill can appear in the / menu. In Codex, /skills is where you pick one.

When to use slash commands

Use a slash command when you want a session change the model should not interpret as a coding task. Switching mode, compacting, resuming a chat and opening the diff are that kind of action.

Use a skill command when the same multi-step job comes up often, such as a review with a fixed checklist. A one-off request is a normal prompt. You don’t need a command file for it.

Pitfalls

The name looks shared and the behavior isn’t. /compact in Claude Code accepts focus instructions. /summarize is the Cursor CLI command for the same job. Guessing the other tool’s name gets you an unknown command.

In Claude Code, a slash command in the middle of a sentence is ordinary text. It has to be the start of the message. You can chain skills there, and the trailing text goes to each of them, so a second skill is not a separate message.

Codex custom prompts live only under ~/.codex/prompts/, as top-level Markdown files, and a teammate doesn’t get them with the repo. Skills are the shared replacement. Restart or open a new chat after you edit a prompt file, or the menu still shows the old text.

Queued commands wait. Codex runs a Tab-queued slash command after the current turn, and Claude Code does the same for most commands you send while it is responding. If you needed /permissions to apply to the tool call happening now, the queue is too late.

  • How to use the Codex CLI shows queueing a slash command with Tab while Codex is still working.
  • How to use Grok Build shows a skill turning up as a slash command, and /help when a shortcut doesn’t arrive.
  • The complete guide to Codex includes the slash command menu in the desktop app.
  • Skill Cabinet lists the agent skills on your Mac and which agents load each one. In Claude Code and Grok Build, a skill you can invoke is also a slash command.
  • Plan mode: Plan mode makes a coding agent research and propose a plan before it edits code. How it works in Claude Code, Codex, Cursor and Grok Build, and when to use it.
  • Permission modes: Permission modes decide what a coding agent can do without asking. The modes in Claude Code, Codex, Cursor and Grok Build, and what YOLO mode really skips.
  • Hooks: Hooks run your own scripts when a coding agent calls a tool or stops. How hooks work in Claude Code, Codex, Cursor and Grok Build, with examples.

All AI glossary entries →

Want me to talk about your product? You can sponsor this site.