Instead of pasting the staged diff and commit instructions into Claude Code each time, you can drop a markdown file under .claude/commands and get a reusable /commit command. The file name becomes the command and $ARGUMENTS carries per-run instructions.
Key points
- The command is a markdown file at .claude/commands/commit.md whose file name becomes the command name.
- $ARGUMENTS injects whatever you type after the command into the prompt; $1 and $2 handle positional values.
- The prompt reads only staged work through git diff --cached and git status -sb, and stops when nothing is staged.
- It proposes a single message using feat, fix, docs, refactor, test, chore, perf or ci as the type.
- Instructions to wait for confirmation and never push keep unattended commits out of the flow.
- The author suggests an ask permission rule for git commit and committing the command file for teammates.
Real-world use
- A team that wants one commit message format across every developer's workflow
- A workflow where nothing is committed until the developer approves the drafted message
This summary was generated by the agent from the original post on DEV: claudecode. The full text and all rights belong to its author and publisher. Go to original