Commit Diff
When to Apply
Use this skill when the user wants a commit message written from their git diff, or when they ask for a commit message for their changes without specifying
one.
Instructions
0) Confirm what the user wants to summarize
Default to what will be committed (staged changes). If the user's phrasing is ambiguous, pick the most likely intent from the table below.
| User intent (trigger phrases) | Use this command | Notes |
|---|---|---|
| "commit message", "save", "ready to commit", "staged", "what I'm about to commit" (default) | git diff --staged | Exactly what git commit would include right now. |
| "latest changes", "since last commit", "working tree", "everything I changed" | git diff HEAD | Includes staged + unstaged changes vs last commit. |
| "what's in my last commit", "latest commit", "changes in commit" | git show HEAD | Shows the patch for the last commit (includes new files). |
| "compare to main", "PR diff", "branch delta", "since branching" | git diff <base>...HEAD | Merge-base diff (commits on this branch). If <base> not given, assume main but ask once to confirm. |
If git diff --staged is empty, check git status. If there are only unstaged changes, either ask the user to stage what they want committed or switch to git diff HEAD to summarize the whole working tree.
1) Untracked files gotcha (new files)
Diffs only include tracked content.
- If
git statusshows?? some-file, that file will not appear ingit diff --stagedorgit diff HEADuntil you stage it. - If you want a diff that includes new files without fully staging them, use
git add -N <file>(intent-to-add), then rerun the chosen diff.
2) Write the commit message (Conventional Commits)
Output one subject line, plus an optional body when it helps explain "why".
Subject format:
type(scope): imperative summary
- type: prefer one of
feat,fix,docs,refactor,test,chore,build,ci - scope: optional, short (e.g.
sai,indexer,scripts,docs) - imperative: "add", "fix", "remove", "refactor" (not past tense)
- length: keep subject <= 72 chars; no trailing period
- breaking changes: add
!after type/scope when clearly breaking (feat!: …,feat(api)!: …)
Body (optional):
- Blank line after subject
- 1–3 bullets focusing on why and any non-obvious behavior changes
Examples
feat(sai): add vault OI query helpers
fix(indexer): query staking data via staking container
- Avoid deprecated root-level fields
- Clarify amount units (unibi) in output
chore(scripts): align tx query output formatting