chenmijiang/ai-notebook
Overview
This skill generates git commit messages from staged changes following the Conventional Commits specification. It analyzes staged diffs and recent commit style, proposes a concise conventional commit message, and asks for user confirmation before committing. The goal is consistent, descriptive commits that improve changelog quality and automation.
How this skill works
The skill checks for staged changes with git status and exits if none are found. It inspects the staged diff (git diff --cached) and recent commits to infer style, selects an appropriate type and optional scope, and composes a subject line (imperative, <=50 chars). If needed it adds a body and footer, presents the message for confirmation or editing, and runs git commit only after user approval.
When to use it
- You have staged changes and want a Conventional Commits-compliant message.
- You need help writing a concise, imperative commit subject and optional body.
- You want consistent commit types for changelogs and automation (feat, fix, docs, etc.).
- You invoke a /commit command in a tool integration that expects a composed commit message.
- You want to standardize commit messages across a team or repository.
Best practices
- Stage only the relevant changes before generating a message to keep scope clear.
- Keep the subject line under 50 characters, imperative mood, no trailing period.
- Include a scope when it adds clarity (e.g., auth, api, docs).
- Add a short body for complex changes that need explanation or migration notes.
- Confirm and edit the suggested message to ensure accuracy before committing.
Example use cases
- Fixing a bug in authentication: generate fix(auth): resolve token refresh race condition
- Adding an API endpoint: generate feat(api): add user export endpoint with body explaining formats
- Documentation update: generate docs(guide): add Python async programming guide
- Small formatting change: generate style(ui): run prettier on button styles
- CI tweak: generate ci(actions): cache dependencies to speed up workflow
FAQ
The skill informs you there are no staged changes and exits without committing.
Can I edit the generated message before committing?
Yes. The skill presents the draft and asks you to confirm, edit, or cancel before running git commit.