Claude Code Slash Commands: Cheat Sheet and Custom Commands
Claude Code reads a slash command only at the start of a message. Built-in commands by task, their aliases, and how to write custom ones in .claude/commands/.
- A Claude Code slash command is recognized only at the start of your message, and any text after the name becomes its arguments.
- The built-ins follow a workflow: /init and /permissions to set up, /plan, /context and /compact during a task, /diff, /code-review and /security-review before shipping, /rewind when something goes wrong.
- Custom commands are now part of skills, but a Markdown file in .claude/commands/ still works and its file name becomes the command name.
This is a cheat sheet of Claude Code’s / commands, grouped by where they fit in a session, plus how to add your own commands in .claude/commands/ and how their names are worked out. Writing a full SKILL.md is covered in How to Create Claude Code Skills (SKILL.md), so we don’t repeat it here.
In our test environment (macOS, Claude Code 2.1.311, on 2026-10-27) we ran claude --version and claude plugin validate against two sample command files in a throwaway directory under /tmp. We did not run any of the slash commands inside a session (not run). Everything about their behavior below comes from the docs.
How commands are parsed
- A command is recognized only at the start of a message. Text after the command name becomes its arguments.
- Type
/to see the commands available to you, then type letters to filter. - The top suggestion is highlighted only when your letters match a command name or alias, from the start or from a word inside it, ignoring
:,_and-./adddirhighlights/add-dir, and/newhighlights/clearthrough its alias. These rules need v2.1.236 or later. - After a typo nothing is highlighted. Close matches stay listed, but
Entersends what you typed and you get Unknown command. - At the terminal prompt you can chain up to six skills at the start of one message.
/skill-a /skill-b do XYZloads both and passes the trailing text to each. - If you send a command while Claude is responding, it’s queued until the turn ends.
/status,/tasksand/usagerun immediately without interrupting. In fullscreen rendering, dialog commands such as/themeand/helpalso open immediately (queued before v2.1.234).
Source: https://code.claude.com/docs/en/commands, checked 2026-10-27
The cheat sheet
The rows follow the docs’ “Commands across a typical workflow”. Which commands you get depends on your OS, plan and environment. Rows marked (skill) are bundled skills: they give Claude instructions to carry out, rather than running fixed logic.
| When | Command | What it does |
|---|---|---|
| First session in a repo | /init | Generates a starter CLAUDE.md |
/memory | Edits CLAUDE.md files and turns auto memory on or off | |
/mcp | Manages MCP server connections and OAuth | |
/permissions | Manages allow, ask and deny rules | |
| During a task | /plan [description] | Enters plan mode, optionally starting on the task you describe |
/model, /effort | Switches the model and sets the effort level | |
/context | Shows what is filling the context window as a colored grid | |
/compact [instructions] | Summarizes the conversation so far to free space | |
/btw [question] | Asks a side question without adding it to the conversation | |
| Parallel work | /tasks | Lists this session’s background work, including finished subagents. Alias /bashes |
/background [prompt] | Detaches the session to keep running as a background agent. Alias /bg | |
/batch <instruction> | (skill) Splits a large change into 5 to 30 independent units, each run by a background subagent in its own worktree | |
| Before you ship | /diff | Shows working-tree changes, including Claude’s edits |
/code-review | (skill) Reviews the current diff, or a PR number, branch or path, for correctness bugs. --fix applies findings, --comment posts them to the PR, ultra runs a cloud review. Alias /review | |
/security-review | Checks your branch’s diff against origin’s default branch for security issues. Needs an origin remote | |
| Between sessions | /clear | Starts a new conversation with empty context. Aliases /reset, /new |
/resume | Returns to an earlier conversation by ID, name or picker | |
/branch | Branches the current conversation and switches into the branch | |
/fork | Copies the conversation into a new background session while you keep working here | |
| When something’s wrong | /rewind | Rolls code and/or conversation back to a checkpoint. Aliases /checkpoint, /undo |
/doctor | (skill) Diagnoses installation, settings and CLAUDE.md problems and proposes fixes you confirm | |
/debug [description] | (skill) Turns on debug logging from that point and reads the log | |
| Any time | /usage | Session cost, plan usage limits and activity stats. Aliases /cost, /stats |
/status | Version, model, account and connectivity |
Two more show up in the workflow section of the docs: /teleport (alias /tp) pulls a cloud session into your terminal, and /remote-control makes the local session available from claude.ai. Both need a claude.ai subscription.
Sources: https://code.claude.com/docs/en/commands and https://code.claude.com/docs/en/skills, checked 2026-10-27
For planning before a large change, see Claude Code Plan Mode: Plan Before It Edits. If /usage shows you’re near the limit, see When You Hit Claude Code’s Usage Limit.
Writing your own commands
Custom commands have been merged into skills. The older format, a Markdown file in .claude/commands/, still works. The file name without its extension becomes the command name. Here is a generic example:
---
description: Fix a GitHub issue by number. Use when the user gives an issue number.
argument-hint: "[issue-number]"
---
Fix issue #$ARGUMENTS.
1. Read the failing test or the steps in the issue.
2. Make the smallest change that fixes it.
3. Run `npm test` and report the result.
Save it as .claude/commands/fix-issue.md and you get /fix-issue. Type /fix-issue 42 and $ARGUMENTS becomes 42.
For single arguments, use $ARGUMENTS[0] or the shorthand $0, $1 and so on, counting from zero. Indexed arguments use shell-style quoting, so /my-command "hello world" second sets $0 to hello world and $1 to second. $ARGUMENTS always expands to the full string as typed. If the file has no placeholder at all, Claude Code appends ARGUMENTS: <your input> to the end so Claude still sees it.
Put a file in a subdirectory and each / in its path becomes :. .claude/commands/release/notes.md is /release:notes:
---
description: Draft release notes from commits since the last tag.
disable-model-invocation: true
---
Draft release notes for version $0 from `git log` since the last tag. Group them as Added / Fixed.
A command file accepts the same frontmatter as a skill except name and paths. disable-model-invocation: true stops Claude from running the command on its own. Use it for anything with side effects that you want to trigger yourself.
Source: https://code.claude.com/docs/en/skills, checked 2026-10-27
We put those two files in a throwaway directory under /tmp and ran claude plugin validate .claude/commands. It printed ✔ Validation passed and exited 0. Then we added a third file whose description opened a double quote and never closed it:
✘ Found 1 error:
❯ frontmatter: YAML frontmatter failed to parse: YAML Parse error: Unexpected EOF. At runtime this command loads with empty metadata (all frontmatter fields silently dropped).
✘ Validation failed
That run exited 1. The message is the useful part. A command with broken YAML doesn’t fail to load; it loads with its frontmatter silently dropped, including disable-model-invocation. The skills docs recommend claude plugin validate for exactly this: run it on a skills directory, such as claude plugin validate .claude/skills, to find files whose frontmatter doesn’t parse. It needs v2.1.233 or later; the options are in the plugins CLI reference.
Source: https://code.claude.com/docs/en/skills, checked 2026-10-27
Commands or skills
.claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy and behave the same way. When both exist, the skill wins. A skill can hold supporting files in its directory, and the docs recommend skills for new work.
Your own skill can also take over a built-in name. In a local terminal session, a project usage skill replaces /usage, but the built-in alias /cost still runs the built-in command. Bundled skills work the same way: a project code-review skill replaces /code-review, and /review never runs your skill.
Source: https://code.claude.com/docs/en/skills, checked 2026-10-27
When a command doesn’t show up
| Symptom | What to check |
|---|---|
| Not in the menu | Commands your plan, OS or environment can’t use are left out. With no match you see No commands match "/name" |
Unknown command | A typo, or a command that isn’t available to you. A few, such as /schedule on a Console API key, reply with their own availability message instead |
| A hidden command | A few available commands, such as /heapdump, stay out of the menu. A partial name never shows them; type the full name and it runs |
| Your custom command is missing | Its file or folder name has a character Claude Code refuses: a zero-width space, a control character, a private-use glyph, a direction-changing character, < or >, or any blank other than one plain space between words |
| A name that never loads | Outside a plugin, names that are anthropic-skills or start with anthropic-skills: don’t load. That namespace is reserved for skills synced from claude.ai |
| You want to know which name was refused | Start with claude --debug and search the debug log for [names]. Restart the session after renaming, unless the file is in a directory Claude Code watches for changes |
Sources: https://code.claude.com/docs/en/commands and https://code.claude.com/docs/en/skills, checked 2026-10-27
Related articles
-
Claude Code Setup and Daily Operations: where config files, instructions, daily commands and IDE setup live.
Summary
- A command is recognized only at the start of a message, and the rest of the line is its arguments.
- Commands sent mid-response are queued.
/status,/tasksand/usagerun right away. - During a task, reach for
/plan,/contextand/compact. Before shipping, use/diff,/code-reviewand/security-review. - Many commands have aliases:
/review,/new,/cost,/undo,/bg. - A file at
.claude/commands/<name>.mdbecomes/<name>, and subdirectories become:in the name. - Read arguments with
$ARGUMENTS, or$0,$1by position. - A skill with the same name wins, and skills are the recommended format for new commands.
FAQ
- How do I see the list of Claude Code slash commands?
- Type / at the prompt to see the commands available to you, then keep typing to filter. Commands your plan, OS or environment can't use are left out of the menu, and a few such as /heapdump stay hidden until you type the full name.
- How do I create a custom slash command in Claude Code?
- Put a Markdown file in .claude/commands/. The file name without .md becomes the command, so .claude/commands/fix-issue.md is /fix-issue, and $ARGUMENTS in the file is replaced by the text you type after it.
- What is the difference between .claude/commands and skills?
- Both create the same kind of command and work the same way. A skill can also hold supporting files in its directory, wins when both use the same name, and is what the docs recommend for new work.
- Can I run a slash command while Claude is responding?
- Yes. It is queued and runs after the current turn, except a few such as /status, /tasks and /usage, which run immediately without interrupting the response.
- Why does my custom slash command not show up?
- Check the file or folder name for characters Claude Code refuses, such as a zero-width space, a control character, < or >, or two spaces in a row. Names starting with anthropic-skills don't load outside a plugin. Start claude --debug and search the debug log for [names].