draft-commit-message
npx machina-cli add skill geekswamp/agent-skills/draft-commit-message --openclawDraft a conventional commit message that matches the change summary provided by the user.
Requirements
- Use the Conventional Commits format:
type(scope): summary. - Use the imperative mood in the summary (for example,
feat,fix,refactor). - The supported types are
bump,feat,fix,docs,refactor,test,ci,chore,perf, andrevert. - The entire first line (including type and scope) must not exceed 72 characters.
- Do not wrap the summary line.
- If there are breaking changes, include a
BREAKING CHANGE:footer. - Always use English.
Script
- Run git-diff.sh before generating a commit message.
- From repository root, run:
bash skills/draft-commit-message/scripts/git-diff.sh- Optional scoped analysis:
bash skills/draft-commit-message/scripts/git-diff.sh <path>
- Use the script output as the primary source of truth for determining the commit type and summary.
- The script shows both staged and unstaged status, diff stats, full diffs, and untracked files.
- Prefer analyzing staged changes when drafting the commit message.
- If the script fails, fallback to
git --no-pager diff --cached.
Output Contract
- Return commit message text only (no explanation) unless user asks for reasoning.
- Follow the exact output format in REFERENCE.md:
- Subject:
type(scope): summary(<=72 chars) - Optional body: concise bullet points
- Optional footer:
BREAKING CHANGE: ...
- Subject:
Source
git clone https://github.com/geekswamp/agent-skills/blob/main/skills/draft-commit-message/SKILL.mdView on GitHub Overview
Drafts a Conventional Commit message based on the current git changes. It analyzes staged versus unstaged diffs to determine a suitable type and scope, then formats the message in the required type(scope): summary style. If changes include breaking changes, a BREAKING CHANGE footer is included.
How This Skill Works
Uses the git-diff.sh script to collect changes, then infers a commit type from the diff (feat, fix, docs, etc.) and an appropriate scope. It constructs the first line as type(scope): summary and keeps it under 72 characters; optional body lines and a BREAKING CHANGE footer may be added as needed. If the script fails, it falls back to git --no-pager diff --cached.
When to Use It
- You need a conventional commit message drafted from the current changes
- Preparing a feature or patch and want a consistent, scannable log
- You have staged changes and want the message to mirror them exactly
- You want to summarize unstaged changes before committing
- A breaking change is introduced and must be documented in the footer
Quick Start
- Step 1: From the repository root, run bash skills/draft-commit-message/scripts/git-diff.sh
- Step 2: Review the suggested Subject line and optional body for accuracy
- Step 3: Commit with git using the generated message, e.g. git commit -m 'type(scope): summary' -m 'body'
Best Practices
- Prefer analyzing staged changes to reflect what will be committed
- Keep the first line <= 72 characters and in type(scope): summary form
- Use a valid type from the allowed set: bump, feat, fix, docs, refactor, test, ci, chore, perf, revert
- Write in the imperative mood and provide a clear scope when helpful
- Add a BREAKING CHANGE footer whenever a breaking API or behavior change exists
Example Use Cases
- feat(auth): add OAuth login
- fix(ui): align button spacing
- docs(readme): update contributing guidelines
- refactor(network): simplify retry logic
- perf(cache): optimize cache invalidation