← 返回 Skills 市场
afine907

AI Commit Message Generator

作者 afine907 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
45
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ai-commit
功能描述
Analyze staged changes and generate semantic commit messages automatically. Reads git diff --staged, analyzes code changes, generates conventional commit mes...
使用说明 (SKILL.md)

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:

  1. Change Type Detection

    • New files → feat
    • Modified files → Based on content
    • Deleted files → refactor or chore
  2. Semantic Type Classification

    • feat: New feature/functionality
    • fix: Bug fix
    • refactor: Code restructuring without behavior change
    • docs: Documentation only
    • style: Formatting, whitespace
    • test: Tests
    • chore: Build, dependencies, tooling
    • perf: Performance improvements
    • ci: CI/CD changes
    • build: Build system changes
  3. Scope Identification

    • Extract from file paths: src/auth/login.ts → scope: auth

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-verify only if explicitly requested
安全使用建议
This looks safe for normal Git commit assistance. Before installing or using it, make sure you are comfortable with the agent reading your staged diff and potentially creating or amending a local commit; use dry-run and review staged files if there is any uncertainty.
功能分析
Type: OpenClaw Skill Name: ai-commit Version: 1.0.0 The skill bundle is a standard utility for generating semantic git commit messages based on staged changes. It uses common git commands (e.g., git diff, git commit) and follows conventional commit standards without any signs of data exfiltration, malicious execution, or prompt injection in SKILL.md or _meta.json.
能力标签
cryptocan-make-purchases
能力评估
Purpose & Capability
The documented behavior matches the stated purpose: it reads staged Git changes, generates a conventional commit message, and can run git commit.
Instruction Scope
The workflow is scoped to the current Git repository and staged changes, with a dry-run option, but the default /commit workflow includes executing a commit.
Install Mechanism
No installer, package, helper script, or executable code is provided; this is an instruction-only skill.
Credentials
Using git diff and git commit is proportionate for a commit helper, but users should recognize that staged source code is brought into the agent context for analysis.
Persistence & Privilege
The skill does not add background persistence or elevated privileges, but it can create persistent local Git commits and optionally amend the previous commit.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ai-commit
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ai-commit 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: automatic conventional commit message generation from git diff
元数据
Slug ai-commit
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

AI Commit Message Generator 是什么?

Analyze staged changes and generate semantic commit messages automatically. Reads git diff --staged, analyzes code changes, generates conventional commit mes... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 45 次。

如何安装 AI Commit Message Generator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install ai-commit」即可一键安装,无需额外配置。

AI Commit Message Generator 是免费的吗?

是的,AI Commit Message Generator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

AI Commit Message Generator 支持哪些平台?

AI Commit Message Generator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 AI Commit Message Generator?

由 afine907(@afine907)开发并维护,当前版本 v1.0.0。

💬 留言讨论