--- description: Generate a conventional commit message (feat/fix/chore…) from the staged diff — prints it or copies it to the clipboard; never commits argument-hint: [--copy] [--scope ] [--issue ] allowed-tools: Bash(git:*), Bash(clip:*), Bash(pbcopy:*), Bash(xclip:*), Bash(wl-copy:*) category: productivity --- # /commit-message Write a [Conventional Commits](https://www.conventionalcommits.org/) message for the changes currently staged in git. This command only reads the repository: it never stages, commits, amends or otherwise modifies it. Arguments passed by the user: `$ARGUMENTS` - `--copy` copies the message to the system clipboard in addition to printing it. - `--scope ` forces the scope instead of inferring one. - `--issue ` adds a `Fixes #` footer. ## 1. Read the staged changes ```bash git rev-parse --is-inside-work-tree git diff --cached --stat git diff --cached git log -n 10 --format=%s ``` - Not a git repo → stop and say so. - No commits yet (`git log` fails) → skip the history hint; the staged diff is still valid. - Nothing staged → stop and tell the user to `git add` first. If there are unstaged changes, mention that they exist, but do not stage them and do not describe them. - A very large diff (thousands of lines): rely on `--stat` plus the most significant hunks; skip lockfiles, generated files and vendored code when describing intent. The recent subjects show the repository's own habits (scope names, casing, issue-reference style). Follow them where they do not conflict with the format below. ## 2. Pick the type Choose exactly one, by the *primary intent* of the whole staged change: | Type | Use for | |------|---------| | `feat` | new user-visible capability | | `fix` | bug fix | | `docs` | documentation only | | `refactor` | restructuring with no behaviour change | | `perf` | performance improvement | | `test` | adding or fixing tests only | | `build` / `ci` | build system, dependencies / CI configuration | | `chore` | maintenance that fits nothing above | | `style` | formatting only | Mixed changes: pick the dominant one. If the diff clearly contains several unrelated changes, still write one message for it, then add one line after it suggesting the user split the commit (and into which parts). ## 3. Write the message ``` ():