Install
openclaw skills install ai-commitAnalyze staged changes and generate semantic commit messages automatically. Reads git diff --staged, analyzes code changes, generates conventional commit messages.
openclaw skills install ai-commitAnalyze staged changes and generate semantic commit messages.
| 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 |
# 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.
git diff --staged
git diff --staged --stat
Analysis Focus:
Change Type Detection
featrefactor or choreSemantic 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 changesScope Identification
src/auth/login.ts → scope: authFormat:
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
Rules:
BREAKING CHANGE:, Closes #123, Fixes #456Examples:
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.
# 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 <<'EOF'
type(scope): subject
optional body
EOF
)"
Verify:
git log -1 --oneline
git show HEAD --stat
DO:
DON'T:
git status
# Prompt: "No staged changes. Would you like to stage all changes?"
git rev-parse HEAD 2>/dev/null || git commit -m "chore: initial commit"
git diff --staged --stat
git diff --staged --unified=1
# Suggest splitting into multiple commits
git status | grep "both modified"
git commit -m "merge: resolve conflicts in <files>"
--no-verify only if explicitly requested