Issue 00 · Autumn 2026日本語 · RSS
AgentKoji

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/.

TL;DR

  • 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

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.

WhenCommandWhat it does
First session in a repo/initGenerates a starter CLAUDE.md
/memoryEdits CLAUDE.md files and turns auto memory on or off
/mcpManages MCP server connections and OAuth
/permissionsManages allow, ask and deny rules
During a task/plan [description]Enters plan mode, optionally starting on the task you describe
/model, /effortSwitches the model and sets the effort level
/contextShows 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/tasksLists 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/diffShows 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-reviewChecks your branch’s diff against origin’s default branch for security issues. Needs an origin remote
Between sessions/clearStarts a new conversation with empty context. Aliases /reset, /new
/resumeReturns to an earlier conversation by ID, name or picker
/branchBranches the current conversation and switches into the branch
/forkCopies the conversation into a new background session while you keep working here
When something’s wrong/rewindRolls 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/usageSession cost, plan usage limits and activity stats. Aliases /cost, /stats
/statusVersion, 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

SymptomWhat to check
Not in the menuCommands your plan, OS or environment can’t use are left out. With no match you see No commands match "/name"
Unknown commandA 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 commandA 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 missingIts 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 loadsOutside 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 refusedStart 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

Summary

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].