Custom Slash Commands
Definition
User-defined /commands backed by Markdown files in .claude/commands/*.md — now unified with skills: a file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and work the same way.
Key points
- Command name = file name without extension (
.claude/commands/deploy.md→/deploy). Recognized only at the start of your message; text after the name becomes its arguments. - "Custom commands have been merged into skills." Existing
.claude/commands/files keep working and support the same frontmatter as skills; skills add supporting-file directories, invocation-control frontmatter, and automatic model loading. If a skill and a command share a name, the skill takes precedence. - Argument substitutions:
$ARGUMENTS(all),$ARGUMENTS[N](0-based index),$N(shorthand),$name(declared inarguments). - Dynamic context injection:
!`<command>`runs the shell command before the content is sent and replaces the placeholder (preprocessing, not something Claude executes); recognized only when!is at line start or after whitespace. Supporting files referenced with markdown links /@file-style paths.
Why it matters for the exam
- D3 (20% of scored content) tests the commands↔skills merge (both
.claude/commands/*.mdand.claude/skills/<name>/SKILL.mdproduce/name, skill wins on clash) and the substitution/!bashsyntax — likely distractors in "how do you parameterize a command" questions.
Common gotchas
- A command is only recognized at the start of the message — mid-message
/nameis literal text. !bashruns as preprocessing before Claude sees the content, once — output is not re-scanned; escape a literal$before a digit with a backslash (\$1.00).- On a name clash, the skill wins, not the
.claude/commands/file.
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.