360 Secure SkillHub
360 安全技能中心

commit-helper

读取暂存区的 git diff,按 feat、fix、docs 等类型和变更路径推断 scope,生成不超过 72 字符的祈使语气提交标题,必要时补充说明动机的正文,展示后可选择执行提交。

terrycarter1985
terrycarter1985
热度 39.71
最近更新 2026-09-06 02:41:45
分类:开发依赖:代码执行应用场景:工作流 / 代码审查

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add terrycarter1985/commit-helper
Metadata
name
commit-helper
description
Generate conventional commit messages from staged git changes. Use when you need help writing a clear, structured commit message from git diff. Supports feat/fix/docs/refactor/chore/test/perf/ci/build/scopes.
metadata
{"openclaw":{"emoji":"📝"}}

Commit Helper

Generate a conventional commit message from your staged changes.

When to use

  • You have staged changes and need a commit message
  • You want structured conventional commits (feat:, fix:, etc.)
  • You're unsure what type or scope to use

Prerequisites

  • git available in PATH
  • Changes are staged (git add)

Steps

  1. Run git diff --cached --stat to see what changed
  2. Run git diff --cached for full staged diff
  3. Classify changes:
    • feat: new feature
    • fix: bug fix
    • docs: documentation only
    • refactor: code change that neither fixes a bug nor adds a feature
    • perf: performance improvement
    • test: adding or fixing tests
    • chore: build process, tooling, or library changes
    • ci: CI configuration changes
    • build: build system or dependency changes
  4. Determine scope from changed paths (e.g., auth, api, ui, deps)
  5. Write subject line in imperative mood, ≤72 chars
  6. Add body explaining why if the change is non-trivial
  7. Present the commit message and offer to commit

Output format

<type>(<scope>): <imperative-subject>

<optional body — explain motivation, not mechanics>

Examples

feat(auth): add email verification flow

fix(api): handle empty response from payment webhook

docs(readme): update installation instructions

refactor(db): extract query builder into separate module

Notes

  • Never use past tense ("added" → "add")
  • Don't end the subject line with a period
  • Keep the subject under 72 characters
  • Use the body to explain what and why, not how
  • If the diff is large, summarize major categories first