Commands
Claude
Intermediate
Use $ARGUMENTS in Commands
Pass dynamic input to slash commands with the $ARGUMENTS variable
28 of 66
How $ARGUMENTS works
When you invoke a slash command, everything after the command name becomes $ARGUMENTS:
/commit refactor auth module → $ARGUMENTS = "refactor auth module"
Parsing patterns
Simple pass-through
Review this code change: $ARGUMENTS
Structured parsing
Parse the user's input: $ARGUMENTS Extract: - **Project name** (first word) - **Description** (remaining words)
Optional arguments
$ARGUMENTS If no arguments provided, ask the user what they want to build. If arguments provided, proceed directly with the description.
Real example: /commit command
# Commit Review diffs and create a commit. **Message hint:** $ARGUMENTS ## Steps 1. Run git diff --staged 2. Analyze changes 3. Craft a Conventional Commits message 4. If $ARGUMENTS is provided, use it as a hint for the message