← 返回 Skills 市场
wlykan

git commit skill

作者 Kk_xx · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
158
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gitcommit
功能描述
Generate precise git commit messages following Conventional Commits with auto language detection, scope inference, and multi-module support.
使用说明 (SKILL.md)

Git Commit Message Generator

Generate conventional commit messages with automatic language style detection.

Commit Format

\x3Ctype>[optional scope]: \x3Cdescription>

[optional body]

[optional footer(s)]

Types: feat fix docs style refactor perf test build ci chore revert

Rules:

  • Type: lowercase English
  • Description: \x3C72 chars, imperative mood, no period
  • Body: explain what/why, not how

Content Requirements:

  • Concise: Summarize clearly, no redundant words
  • Complete: Don't omit important changes
  • Numbered: Multiple changes use 1. 2. 3. format
  • Specific: Must clearly indicate which modules/files were modified

Module Reference Format:

  • For each change, specify the affected module or file
  • Format: \x3CAction> \x3Cmodule/file>
  • Example: Fix bug in UserService, Update Button component

Language Detection

Auto-detect by checking recent commits:

git log -10 --oneline

Detection Logic:

  1. If recent commits contain Chinese characters → Use Chinese
  2. If unable to determine → Default to Chinese
Style Format Example
English feat(api): add user authentication endpoint
Chinese feat(用户管理): 添加登录功能

Language Rules:

  • Type: Always English (feat, fix, refactor)
  • Scope: Follow project style (English/Chinese)
  • Description/Body: Chinese by default, or match project language

Workflow

1. Parallel Analysis (single response)

git status
git diff --staged
git log -10 --oneline

2. Smart Type Inference

Pattern Type
*.test.*, *.spec.*, __tests__/ test
package.json, *.lock build
.github/, *.yml (CI) ci
*.md, docs/, README* docs
Only whitespace changes style
Keywords: fix/bug/resolve fix
Keywords: add/implement/create feat
Keywords: refactor/extract refactor
Keywords: optimize/cache/performance perf

3. Scope Inference

Extract from file paths:

  • src/api/user/*(api) or (user)
  • src/components/Button/*(Button)
  • src/views/目标管理/*(目标管理)

4. Present & Confirm

Show the generated message and await user approval before committing.

Examples

English

feat(api): add user authentication endpoint

1. Implement JWT-based authentication in AuthService for login/logout.
2. Add token refresh mechanism and session management in TokenManager.
3. Update routes/auth.ts with authentication middleware.

Closes #123

Chinese

feat(用户管理): 添加登录功能

1. AuthService实现基于JWT的用户认证,支持登录和登出。
2. TokenManager添加令牌刷新机制和会话管理。
3. routes/auth.ts更新API路由增加认证中间件。

关联 #123

Multi-Module Example

fix: resolve null pointer and update UI

1. UserService修复空指针异常,添加用户数据验证。
2. components/UserList.vue更新列表渲染逻辑。
3. utils/validator.ts添加空值检查工具函数。

关联 #456

Git Safety

  • NEVER use --no-verify unless explicitly requested
  • NEVER amend commits - create NEW commits
  • NEVER force push without explicit request
  • ALWAYS use HEREDOC for commit messages
  • Prefer git add \x3Cfiles> over git add .

Commit Command

git commit -m "$(cat \x3C\x3C'EOF'
\x3Ccommit message>

Co-Authored-By: Claude code \[email protected]>
EOF
)"
安全使用建议
This skill appears to do what it says: inspect the repository and generate Conventional Commit messages. Before installing or using it: (1) Confirm you are OK with the default language behavior — the skill falls back to Chinese if it can't detect language. (2) Remove or change the example Co-Authored-By line if you do not want an automatic attribution added to your commits. (3) Test the skill in a disposable/local repo first to verify the exact commit commands it runs. (4) If you do not want automatic commits, keep agent autonomous invocation disabled or ensure the skill respects the 'await user approval' step.
功能分析
Type: OpenClaw Skill Name: gitcommit Version: 1.0.0 The git-commit skill is designed to automate the generation of Conventional Commit messages by analyzing git diffs and logs. It includes explicit safety constraints in SKILL.md, such as forbidding force pushes and the use of the --no-verify flag, and employs safe shell practices like HEREDOC for commit message construction to prevent injection. The behavior is entirely consistent with its stated purpose.
能力评估
Purpose & Capability
Name/description line up with the runtime instructions: the skill inspects git status/diff/log and generates Conventional Commit messages. The requirement to analyze repo files and git history is expected. Unusual but not breaking: it defaults to Chinese when language cannot be detected and mandates including a Co-Authored-By line (Claude code <[email protected]>) in every commit message by example — this is not necessary for core functionality and is unexpected.
Instruction Scope
SKILL.md limits actions to git commands (git status, git diff --staged, git log) and message generation, and instructs to present results for user approval before committing. It does not ask to read unrelated system files or environment variables. The notable scope creep is the built-in policy to always use a HEREDOC and to include a Co-Authored-By attribution in the commit message by default; that is a behavioral choice (affects commit content) rather than an external data exfiltration step, but you should verify you want that attribution inserted.
Install Mechanism
Instruction-only skill with no install spec and no code files — lowest-risk installation footprint (nothing is written to disk by an installer).
Credentials
The skill requests no environment variables, no credentials, and no config paths. It only reads repository-local git state (diffs/logs) which is appropriate for commit message generation.
Persistence & Privilege
Skill is not always-enabled and does not request system-wide persistence. It does, however, include instructions to create new commits (and a sample commit command that injects a Co-Authored-By line). If the agent is allowed to invoke skills autonomously, it could create commits; ensure autonomy settings and the SKILL.md's 'await user approval' step are enforced to avoid unexpected commits.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gitcommit
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gitcommit 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of git-commit skill - Generate git commit messages following the Conventional Commits specification. - Automatically detects project language (Chinese/English) from recent commits and adapts message format. - Supports both automatic diff analysis and interactive guided commit message generation. - Enforces best practices: clear type, scope, specific module/file references, numbered multi-change summaries. - Ensures safe commit workflow (no amend/force push unless requested, uses HEREDOC, never --no-verify by default). - Smart commit type and scope inference from file patterns and paths.
元数据
Slug gitcommit
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

git commit skill 是什么?

Generate precise git commit messages following Conventional Commits with auto language detection, scope inference, and multi-module support. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 158 次。

如何安装 git commit skill?

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

git commit skill 是免费的吗?

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

git commit skill 支持哪些平台?

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

谁开发了 git commit skill?

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

💬 留言讨论