← 返回 Skills 市场
zenoleee

git-commit-ai

作者 ZenoLeee · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
343
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install git-commit-ai
功能描述
根据暂存区 git diff 自动生成符合 Angular 规范的详细中英文 commit message,支持语言自动检测和参数指定。
使用说明 (SKILL.md)

git-commit-ai\r

\r 根据 git diff 自动生成符合规范的 commit message\r \r

功能说明\r

\r 这个 skill 会分析当前 Git 仓库的暂存改动,使用 AI 生成详细、准确的 commit message。\r \r 主要特性:\r

  • 📝 从 diff 中提取具体信息(函数名、组件名、注释等)\r
  • 🌐 智能语言检测(根据代码注释自动选择中文/英文)\r
  • ✅ 符合 Angular commit 规范\r
  • 🎯 详细的描述,不再只说"新增功能"\r \r

使用方法\r

\r

基本使用\r

\r

/git-commit-ai\r
```\r
\r
### 带参数使用\r
\r
```bash\r
# 强制使用中文\r
/git-commit-ai --language zh\r
\r
# 强制使用英文\r
/git-commit-ai --language en\r
\r
# 自动检测(默认)\r
/git-commit-ai --language auto\r
```\r
\r
## 参数说明\r
\r
| 参数 | 说明 | 默认值 |\r
|------|------|--------|\r
| `--language` | commit message 语言 (auto/zh/en) | auto |\r
\r
## 使用示例\r
\r
### 示例 1: 中文代码\r
\r
**Git Diff**:\r
```diff\r
+// 添加用户登录验证\r
+export function validateLogin(email, password) {\r
+  // 验证邮箱格式\r
+  if (!email.includes('@')) {\r
+    throw new Error('邮箱格式不正确');\r
+  }\r
+}\r
```\r
\r
**生成结果**:\r
```\r
feat(auth): 添加用户登录验证功能,支持邮箱格式校验\r
```\r
\r
### 示例 2: 英文代码\r
\r
**Git Diff**:\r
```diff\r
+// Add user login validation\r
+export function validateLogin(email, password) {\r
+  // Validate email format\r
+  if (!email.includes('@')) {\r
+    throw new Error('Invalid email format');\r
+  }\r
+}\r
```\r
\r
**生成结果**:\r
```\r
feat(auth): add user login validation with email format check\r
```\r
\r
## 工作原理\r
\r
1. **获取 Git diff** - 读取暂存区的改动\r
2. **分析变更内容** - 识别变更类型、提取关键信息\r
3. **智能语言检测** - 根据代码注释语言自动选择\r
4. **生成 message** - 使用 AI 生成详细的 commit message\r
\r
## 分析能力\r
\r
### 从 diff 中提取的信息\r
\r
- ✅ 函数名和组件名\r
- ✅ 代码注释(用于语言检测和意图理解)\r
- ✅ 文件路径(用于确定 scope)\r
- ✅ API 端点和路由\r
- ✅ 具体的改动内容\r
\r
### 支持的 commit 类型\r
\r
- `feat`: 新功能\r
- `fix`: Bug 修复\r
- `docs`: 文档变更\r
- `style`: 代码格式\r
- `refactor`: 重构\r
- `perf`: 性能优化\r
- `test`: 测试\r
- `chore`: 构建/工具\r
\r
## 输出格式\r
\r
生成的 commit message 符合 Angular commit 规范:\r
\r
```\r
\x3Ctype>(\x3Cscope>): \x3Cdescription>\r
```\r
\r
**示例**:\r
- `feat(auth): 添加用户登录验证功能`\r
- `fix(api): 修复 getUser 接口的空指针异常`\r
- `refactor(utils): 提取邮箱验证逻辑到独立函数`\r
\r
## 注意事项\r
\r
1. **需要有暂存的改动** - 运行前请先 `git add`\r
2. **自动语言检测** - 根据代码注释智能选择语言\r
3. **详细描述** - 会从代码中提取具体信息,不会只说"新增功能"\r
\r
## 常见问题\r
\r
### Q: 为什么没有暂存的改动时会报错?\r
\r
A: 工具需要分析 git diff --cached 的内容,所以需要先 `git add` 暂存改动。\r
\r
### Q: 如何强制使用特定语言?\r
\r
A: 使用 `--language zh` 或 `--language en` 参数。\r
\r
### Q: 生成的 message 不够准确怎么办?\r
\r
A: 可以尝试添加更多代码注释,帮助 AI 理解改动的意图。\r
\r
## 技术实现\r
\r
- 使用 Git 命令获取 diff\r
- 通过 Claude AI 分析内容\r
- 智能提取代码信息\r
- 生成符合规范的 message\r
\r
## 相关资源\r
\r
- [Angular Commit 规范](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit)\r
- [Git diff 文档](https://git-scm.com/docs/git-diff)\r
\r
## 更新日志\r
\r
### v1.0.0\r
- ✅ 初始版本\r
- ✅ 支持中英文自动检测\r
- ✅ 详细的 diff 分析\r
- ✅ 符合 Angular commit 规范\r
安全使用建议
This skill appears to do what it says: it reads your staged git diff, generates an Angular-style commit message, and can optionally install a local prepare-commit-msg hook. Before installing or running: 1) Review the generated hook content (the skill backs up existing hooks unless you use --force). 2) Confirm you are comfortable with the skill reading files in your repository (it reads package.json and optional config files in the repo root). 3) Note the SKILL.md includes explicit prompt instructions for the model — ensure your environment’s model invocation and policy enforcement are acceptable, since prompt text from skills can affect model outputs. 4) No API keys are requested by the skill; if a future version asks for external credentials (Claude API keys, etc.), treat that as a separate risk and verify why they are needed. To uninstall the hook, remove .git/hooks/prepare-commit-msg or restore the backup the tool created.
功能分析
Type: OpenClaw Skill Name: git-commit-ai Version: 1.0.0 The skill is a legitimate utility for generating Git commit messages using AI. It includes proactive security features such as scanning `git diff` for sensitive patterns (passwords, API keys) in index.js to warn the user before submission. The Git hook installation (prepare-commit-msg) is transparent, user-initiated via the --install flag, and performs a benign action of echoing a reminder to the console.
能力评估
Purpose & Capability
Name/description match the implementation: the code reads staged git diff, extracts context, supports language selection, and can install a prepare-commit-msg hook. There are no unrelated required binaries, env vars, or external installers requested.
Instruction Scope
SKILL.md and index.js instruct the agent to read git staged diffs, optional repo config (package.json or .gitcommitairc), and to optionally install a git hook — all within expected scope. SKILL.md and the code include explicit system-prompt style instructions (a system prompt for the AI to generate commit messages); a static scan flagged a 'system-prompt-override' pattern. That is expected for a tool that crafts prompts for a model, but be aware platform-level prompt handling may treat skill prompts differently.
Install Mechanism
No install spec that downloads arbitrary code. The skill is instruction+code only; it writes a local git hook under .git/hooks when run with --install, which is expected for this functionality. There are no external URL downloads or archive extractions.
Credentials
The skill requests no environment variables or credentials. It mentions using 'Claude AI' in docs but does not require external API keys in the code; presumably it relies on the host/agent model invocation capabilities. No unrelated secrets are requested.
Persistence & Privilege
The skill is not always-enabled and does not modify other skills or system-wide settings. The only persistent change it can make is installing a prepare-commit-msg hook in the repository (done only when user runs --install, and the code backs up existing hooks unless --force is used).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install git-commit-ai
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /git-commit-ai 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of git-commit-ai. - Generates detailed, conventional commit messages from git diffs using AI analysis - Automatically detects message language (Chinese/English) based on code comments - Supports Angular commit convention and multiple commit types (feat, fix, etc.) - Extracts and summarizes specific changes, such as function names, components, and scope - Command-line arguments for language selection (auto/zh/en)
元数据
Slug git-commit-ai
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

git-commit-ai 是什么?

根据暂存区 git diff 自动生成符合 Angular 规范的详细中英文 commit message,支持语言自动检测和参数指定。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 343 次。

如何安装 git-commit-ai?

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

git-commit-ai 是免费的吗?

是的,git-commit-ai 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

git-commit-ai 支持哪些平台?

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

谁开发了 git-commit-ai?

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

💬 留言讨论