/install ai-commit
Commit - Git Commit Generator
Analyze staged changes and generate semantic commit messages.
Commands
| Command | Description |
|---|---|
/commit |
Analyze staged changes and generate commit |
/commit -m "message" |
Commit with custom message |
/commit --amend |
Amend previous commit |
/commit --dry-run |
Preview commit message without committing |
Workflow
Step 1: Pre-flight Check
# Verify git repository
git rev-parse --is-inside-work-tree
# Check staged changes
git diff --staged --quiet
# Get staged files
git diff --staged --name-only
If no staged changes: Check git status, prompt user to stage changes first.
Step 2: Analyze Staged Changes
git diff --staged
git diff --staged --stat
Analysis Focus:
-
Change Type Detection
- New files →
feat - Modified files → Based on content
- Deleted files →
refactororchore
- New files →
-
Semantic Type Classification
feat: New feature/functionalityfix: Bug fixrefactor: Code restructuring without behavior changedocs: Documentation onlystyle: Formatting, whitespacetest: Testschore: Build, dependencies, toolingperf: Performance improvementsci: CI/CD changesbuild: Build system changes
-
Scope Identification
- Extract from file paths:
src/auth/login.ts→ scope:auth
- Extract from file paths:
Step 3: Generate Commit Message
Format:
\x3Ctype>(\x3Cscope>): \x3Csubject>
[optional body]
[optional footer(s)]
Rules:
- Subject in imperative mood: "add" not "added"
- No period at end
- Max 50 characters for subject
- Body wrap at 72 characters
- Footer:
BREAKING CHANGE:,Closes #123,Fixes #456
Examples:
feat(auth): add JWT token refresh mechanism
fix(payment): handle duplicate callback correctly
Payment callback was processing duplicates due to missing idempotency
check. Added unique constraint on (order_id, callback_id).
Fixes #234
refactor(db)!: migrate from MySQL to PostgreSQL
BREAKING CHANGE: Database migration required.
Step 4: Execute Commit
# Commit with generated message (author is global git user)
git commit -m "type(scope): subject" [-m "optional body"]
Or use heredoc for multi-line:
git commit -m "$(cat \x3C\x3C'EOF'
type(scope): subject
optional body
EOF
)"
Verify:
git log -1 --oneline
git show HEAD --stat
Best Practices
DO:
- ✅ Analyze ALL staged changes before generating
- ✅ Use imperative mood ("add" not "added")
- ✅ Keep subject under 50 characters
- ✅ Add body for complex changes
- ✅ Reference issues when applicable
- ✅ Group related changes in one commit
DON'T:
- ❌ Commit without staged changes
- ❌ Mix unrelated changes
- ❌ Use past tense
- ❌ End subject with period
- ❌ Include sensitive information
- ❌ Skip pre-commit hooks (unless explicitly requested)
Edge Cases
No Staged Changes
git status
# Prompt: "No staged changes. Would you like to stage all changes?"
Empty Repository (Initial Commit)
git rev-parse HEAD 2>/dev/null || git commit -m "chore: initial commit"
Large Diff (>500 lines)
git diff --staged --stat
git diff --staged --unified=1
# Suggest splitting into multiple commits
Merge Conflicts
git status | grep "both modified"
git commit -m "merge: resolve conflicts in \x3Cfiles>"
Hooks Integration
- pre-commit: Runs automatically
- commit-msg: Runs automatically
- If hooks fail: Report error, suggest fixes
- Bypass with
--no-verifyonly if explicitly requested
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install ai-commit - After installation, invoke the skill by name or use
/ai-commit - Provide required inputs per the skill's parameter spec and get structured output
What is AI Commit Message Generator?
Analyze staged changes and generate semantic commit messages automatically. Reads git diff --staged, analyzes code changes, generates conventional commit mes... It is an AI Agent Skill for Claude Code / OpenClaw, with 45 downloads so far.
How do I install AI Commit Message Generator?
Run "/install ai-commit" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is AI Commit Message Generator free?
Yes, AI Commit Message Generator is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does AI Commit Message Generator support?
AI Commit Message Generator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created AI Commit Message Generator?
It is built and maintained by afine907 (@afine907); the current version is v1.0.0.