commit skill
A Claude Code skill that analyzes staged changes, selects the right gitmoji, and produces a clean, atomic commit message in lowercase imperative mood — modeled on fastapi/fastapi conventions.
features
- checks staged files before doing anything; proposes what to stage if nothing is staged
- runs pre-commit checks (lint, build, type-check) by default
- selects the appropriate gitmoji based on the nature of the diff
- enforces lowercase imperative message style
- suggests splitting when staged files span unrelated concerns
- shows the draft message and waits for confirmation before committing
usage
/commit # with pre-commit checks
/commit --no-verify # skip pre-commit checks
/commit --push # push to current branch after committing
workflow
Commit messages use this format:
<emoji> <lowercase imperative summary>
For complex changes, add a body after a blank line explaining what changed and why — not how. No trailing period. No type prefix; the emoji carries that signal. Read reference/gitmoji.md when selecting the emoji.
- run
git diff --cached --name-onlyto inspect staged files - if nothing is staged:
- run
git statusto show unstaged and untracked files - propose a logical grouping of files to stage
- wait for user confirmation before running
git add
- run
- run
git diff --cachedto read the full diff - if the staged diff spans unrelated concerns, suggest splitting into separate commits
- unless
--no-verifyis passed, run available pre-commit checks (lint, build, type-check) and surface any failures before proceeding - select the single most appropriate emoji from reference/gitmoji.md
- draft the commit message:
<emoji> <lowercase imperative summary>— keep the summary short (under 60 chars); name the outcome, not the mechanism — write "fix crash when user has no email" not "add null check before accessing user.email"; avoid listing every changed file or detail in the summary - only add a body when the why is non-obvious and cannot be inferred from the diff; skip the body for straightforward changes
- show the complete draft message and ask for confirmation or edits
- on approval, execute:
git commit -m "<message>" - if
--pushwas passed, immediately rungit pushto push to the current branch after committing
best practices
- atomic commits — one logical change per commit; if the diff touches unrelated things, offer to split
- imperative mood — "add feature" not "added feature" or "adding feature"
- summary names outcomes — describe what changes, not how: "fix crash when X" not "add null check for X"; "simplify token parser" not "replace for loop with list comprehension"
- all lowercase — summary and body both lowercase; no trailing period
- body explains why — the diff shows what changed; the body explains the motivation
- reference issues — mention related issues or PRs in the body when relevant (
closes #123) - no --no-verify by default — only skip checks when the user explicitly passes the flag
- --push — runs
git pushafter committing; combine with--no-verifyto also skip pre-commit checks