Turn a prompt you keep retyping into a reusable command. Save a markdown file and it becomes a /command you and your team can run with arguments.
Why: a custom command is just a markdown file whose body is the prompt — save it once, run it forever. When: make one for any task you repeat (reviews, commits, scaffolding). Where: project commands live in .claude/commands/; personal ones in ~/.claude/commands/.
<!-- .claude/commands/review.md -> runs as /review -->
Review the staged changes for bugs, security issues, and missing tests.
Group findings by severity. Be specific with file and line references.Why: arguments make a command reusable across inputs instead of hard-coded. When: use $ARGUMENTS for everything passed, or $1, $2 for positional ones. Where: the frontmatter argument-hint shows users what to pass.
<!-- .claude/commands/fix-issue.md -> /fix-issue 123 high -->
---
description: Fix a GitHub issue by number
argument-hint: <issue-number> <priority>
---
Fix GitHub issue #$1 (priority: $2).
Read the issue, reproduce it, implement a fix, and add a regression test.Why: a command can gather its own context — run a shell command and pull files in before the model sees the prompt. When: prefix a line with ! to inline command output, and use @ to include files. Where: list the commands you allow in allowed-tools so they run without a prompt.
<!-- .claude/commands/commit.md -> /commit -->
---
description: Write a commit message from the staged diff
allowed-tools: Bash(git diff:*), Bash(git log:*)
---
Here is the staged diff:
!`git diff --staged`
Recent commit style:
!`git log --oneline -5`
Write a concise conventional-commit message for these changes.