| name | git-commit |
| description | This skill should be used BEFORE running any git commit command. Triggers when about to run `git commit`. Ensures commit messages follow Conventional Commits specification. |
| metadata | {"source":"https://github.com/fredrikaverpil/dotfiles/blob/main/stow/shared/.claude/skills/git-commit/SKILL.md"} |
Git Commit Messages
Write commit messages following the Conventional Commits specification.
Format
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types
| Type | Purpose |
|---|
feat | New feature |
fix | Bug fix |
docs | Documentation only |
style | Code style (formatting, no logic change) |
refactor | Code change that neither fixes a bug nor adds a feature |
perf | Performance improvement |
test | Adding or correcting tests |
build | Build system or external dependencies |
ci | CI configuration |
chore | Maintenance tasks |
revert | Reverts a previous commit |
Rules
- Use imperative mood in description ("add feature" not "added feature")
- Do not end description with a period
- Keep description under 72 characters
- Separate subject from body with a blank line
- Use the body to explain intent, nuances, gotchas, or background behind the
change — not a paraphrase of the diff
Breaking Changes
Add ! after type/scope or include BREAKING CHANGE: in footer:
feat(api)!: remove deprecated endpoints
BREAKING CHANGE: The /v1/users endpoint has been removed.
Scope
Optional. Use to specify area of change (e.g., api, ui, auth, db).
Pull Request
After committing, check whether a pull request already exists for the current
branch and offer to create one if it does not.
-
Check for an existing pull request:
gh pr view --json url
If this succeeds, a pull request already exists — do nothing further.
-
If no pull request exists (the command above fails), ask the user whether a
pull request should be created. Only continue if the user confirms.
-
Create the pull request as a draft, using the commit subject as the title
and the commit body as the body:
gh pr create --draft --title "<commit subject>" --body "<commit body>"
--title is the <type>(<scope>): <description> subject line.
--body is the commit body. If the commit has no body, pass an empty
string (--body "").