Dynamic Slash Commands in Claude Code with Arguments
Watch on TikTok
Most Claude Code users know about slash commands, but few know you can pass arguments to make them dynamic. A basic slash command runs the same prompt every time. With arguments, you can make commands that accept input and adapt to different situations.
Setting Up a Custom Command
First, create a commands folder inside the .claude folder of your project. Inside that folder, create a markdown file with the same name as the command you want. Write your prompt in that markdown file, and wherever you want user input to go, use #$ARGUMENTS.

For example, an /issue command with #$ARGUMENTS lets you type /issue 47 and Claude will know exactly which GitHub issue to look at. The command file contains your prompt template, and the argument gets substituted in at runtime.

Positional Arguments for More Control
If you need more than one input, use positional arguments. Instead of #$ARGUMENTS, use $1, $2, and so on to denote the position of each input.
A practical example: a /migrate command that takes two arguments. $1 for the source framework and $2 for the target framework. Run /migrate react vue and Claude knows to convert a component from React to Vue without you having to explain the full context every time.

The rule of thumb: if you do something more than once in your workflow, build a command for it. Arguments make those commands flexible enough to handle variations without needing a separate command for each case.
Key Takeaways
- Custom slash commands live in
.claude/commands/as markdown files - Use
#$ARGUMENTSfor single-input commands - Use
$1,$2, etc. for commands that need multiple distinct inputs - Any repetitive workflow is a candidate for a custom command
Published May 25, 2026. Writeup generated from a favorited TikTok.