Improve `/commit-msg` skill fmting + consistency

Align `SKILL.md` and `style-guide-reference.md` with the
claude-code skills docs and actual usage conventions.

Deats,
- add missing frontmatter fields: `argument-hint`,
  `disable-model-invocation`, and scope `Bash` tool to
  `Bash(git *)` prefix pattern per docs.
- add `Grep`/`Glob` to `allowed-tools`.
- restructure `!`backtick`` usage for proper dynamic
  context injection (not mixed with instructional text).
- use markdown link for `style-guide-reference.md` ref
  per docs' supporting-files convention.
- switch timestamp format to cross-OS-safe
  `date -u +%Y%m%dT%H%M%SZ`.

Also,
- rm errant blank lines between footer attribution and
  reference-def lines in both files.
- fix double space in style guide subject length desc.
- reflow long lines for 67 char limit.

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
ns_aware
Gud Boi 2026-03-04 14:36:00 -05:00
parent d4f2fa547a
commit c5ea6040bf
2 changed files with 33 additions and 22 deletions

View File

@ -1,27 +1,41 @@
--- ---
name: commit-msg name: commit-msg
description: Generate git commit messages following project style. description: >
Use when user wants to create a commit or asks for a commit message. Generate git commit messages following project style. Use when user
wants to create a commit or asks for a commit message.
argument-hint: "[optional-scope-or-description]"
disable-model-invocation: true
allowed-tools: allowed-tools:
- Bash - Bash(git *)
- Bash(date *)
- Bash(cp *)
- Read - Read
- Grep
- Glob
- Write - Write
--- ---
When generating commit messages, always follow this process: When generating commit messages, always follow this process:
1. **Gather context**: Run, `~/repos/claude_wks/commit_gen.py` 0. **Check for staged changes**: if `git diff --staged` is
to get staged changes, recent commits, and style guide rules empty, STOP and tell the user "nothing is staged!" with
a reminder to `git add` before invoking this skill.
2. **Analyze the diff**: Understand what files changed and the nature 1. **Gather context** from the staged diff and recent
of the changes (new feature, bug fix, refactor, etc.) history:
- Staged changes: !`git diff --staged --stat`
- Recent commits: !`git log --oneline -5`
2. **Analyze the diff**: understand what files changed and
the nature of the changes (new feature, bug fix, refactor,
etc.)
3. **Write the commit message** following these rules: 3. **Write the commit message** following these rules:
**Use the accompanying style guide:** **Use the accompanying style guide:**
- Use the style guide `./style-guide-reference.md` for more details - See [style-guide-reference.md](style-guide-reference.md)
on how to write the message based on analysis of past commits in for detailed analysis of past commits in this repo.
this repo.
**Subject Line Format:** **Subject Line Format:**
- Present tense verbs: Add, Drop, Fix, Use, Move, Adjust, etc. - Present tense verbs: Add, Drop, Fix, Use, Move, Adjust, etc.
@ -46,9 +60,10 @@ When generating commit messages, always follow this process:
- Minor tweaks: "Adjust `behavior` in `component`" - Minor tweaks: "Adjust `behavior` in `component`"
4. **Write to TWO files**: 4. **Write to TWO files**:
- `.claude/<timestamp>_<hash>_commit_msg.md` (timestamp from `date - `.claude/<timestamp>_<hash>_commit_msg.md`
--iso-8601=seconds`, hash from `git log -1 --format=%h` first * with `<timestamp>` from `date -u +%Y%m%dT%H%M%SZ` or similar
7 chars) filesystem-safe format.
* and `<hash>` from `git log -1 --format=%h` first 7 chars.
- `.claude/git_commit_msg_LATEST.md` (overwrite) - `.claude/git_commit_msg_LATEST.md` (overwrite)
5. **Always include credit footer**: 5. **Always include credit footer**:
@ -56,16 +71,14 @@ When generating commit messages, always follow this process:
When no part of the patch was written by `claude`, When no part of the patch was written by `claude`,
``` ```
(this commit msg was generated in some part by [`claude-code`][claude-code-gh]) (this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code [claude-code-gh]: https://github.com/anthropics/claude-code
``` ```
and when some or all of the patch was written by `claude` instead when some or all of the patch was written by `claude`
use, instead use,
``` ```
(this patch was generated in some part by [`claude-code`][claude-code-gh]) (this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code [claude-code-gh]: https://github.com/anthropics/claude-code
``` ```

View File

@ -11,7 +11,7 @@ clarity about what changed and why.
## Subject Line Format ## Subject Line Format
### Length and Structure ### Length and Structure
- Target: ~49 chars (avg: 48.7, max: 50 preferred) - Target: ~50 chars with a hard-max of 67.
- Use backticks around code elements (72.2% of commits) - Use backticks around code elements (72.2% of commits)
- Rarely use colons (5.2%), except for file prefixes - Rarely use colons (5.2%), except for file prefixes
- End with '?' for uncertain changes (rare: 0.8%) - End with '?' for uncertain changes (rare: 0.8%)
@ -185,16 +185,14 @@ the commit msg content:
``` ```
(this commit msg was generated in some part by [`claude-code`][claude-code-gh]) (this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code [claude-code-gh]: https://github.com/anthropics/claude-code
``` ```
Further, if the patch was solely or in part written by `claude`, instead Further, if the patch was solely or in part written
add: by `claude`, instead add:
``` ```
(this patch was generated in some part by [`claude-code`][claude-code-gh]) (this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code [claude-code-gh]: https://github.com/anthropics/claude-code
``` ```