AI Slash Command Generator

Describe a quick action you repeat all the time and get back a single, ready-to-save Claude Code command file - correct frontmatter, the right argument placeholders, and the exact path to drop it in so /yourcommand just works.

1. What should the command do?

One quick, repeatable action. If you find yourself typing the same prompt every day, that is the one.

Or start from one of these

Your command file will appear here, fully editable, with the file name and frontmatter checked as you type.

How a custom slash command file is put together

It is one markdown file, and the file name is the command name: save ~/.claude/commands/commit.md and you have /commit. That is also why the file itself carries no name: key - in a command file, name and paths are ignored. Everything else in the frontmatter is the same set a skill accepts, and this builder only writes the fields you actually turn on.

Where the command needs input, the body uses a placeholder: $ARGUMENTS takes everything you type after the command, while $1 and $2 take the arguments one at a time when the command genuinely has two distinct inputs. Plenty of good commands use no placeholder at all, because they act on the repo or the conversation you are already in. The tool reads your body back and tells you exactly which placeholders it found.

There is one more trick worth knowing. A line like !`git diff --staged` runs that shell command and inlines its output into the prompt before Claude reads the file - so a commit-message command can see the real diff every time instead of being told about it. Keep injected commands read-only, and pair them with a matching Bash(...) entry in allowed-tools so you are not approving the same call daily.

常见问题

Where do I save the file to create a slash command for Claude?

Two choices. Save it to ~/.claude/commands/<name>.md and the command is personal: it works in every project on that machine and nobody else sees it. Save it to .claude/commands/<name>.md inside a repo and it becomes a project command, shareable through git so everyone who clones the repo gets it - the right home for team workflows like your release checklist or your PR template. This generator shows the exact path for whichever scope you pick, plus the mkdir line to create the folder.

How do $ARGUMENTS, $1 and $2 work?

$ARGUMENTS is replaced with everything you type after the command, so /translate hello there passes 'hello there' as one string. $1, $2 and so on take the arguments positionally, which is what you want when a command has two genuinely separate inputs - a file and a language, say. There is also a named form, where an arguments list in the frontmatter maps $name placeholders onto positional arguments. Mixing $ARGUMENTS with $1 in the same body usually means the same input lands twice, so this tool flags that as you type.

Are Claude Code commands and skills the same thing now?

Close to it, and it is worth being precise. Claude Code has unified commands and skills: a command file and a skill both produce the same /<name> behaviour, and a command file accepts the same frontmatter a skill does, except name and paths, which it ignores because the file name is the name. What skills add is structure - a skill is a directory, so it can bundle supporting files like a REFERENCE.md or a scripts/ folder alongside its instructions. So this is the fast, single-file path for a simple, quick command, and the Skill Generator is the one to use when the workflow needs more than one file's worth of instruction. Neither is a replacement for the other.

Should I set disable-model-invocation on a command?

Set it when the command does something with real consequences. By default both invocation routes are open: you can type the command, and Claude can also run it on its own when your request matches the description. That is fine for a command that explains code or drafts a message, and not fine for one that deploys, pushes, publishes or sends something - those should fire only when a human types them, which is exactly what disable-model-invocation: true enforces. It is a Claude Code extension, so other Agent Skills runtimes will ignore it.

Why does the description field matter for a command?

It does double duty. The description is what you see next to the command in your command list, so a clear one-liner saves you guessing later - and it is also what Claude matches against when deciding to run the command itself. Say what it does and when to use it, keep it to a single readable line, and you get both benefits. The builder counts it live against the 1024-character frontmatter limit and nudges you if it grows past a comfortable length for a list.

Is anything I type stored?

No. Your description is sent once to a free AI model to draft the command, and the result is returned to your browser and not stored afterwards. Everything after that - editing, validation, the file preview, copy and download - happens locally in the page, and you can skip the AI entirely by clicking 'write it manually' and using this purely as a validating command-file editor.

Need something with real structure - multiple steps, examples, supporting files? Use the Claude Skill Generator instead and get a full SKILL.md.

相关工具