Dev Git Guard
/install git-commit-guard
Git Commit Guard
Treat every coding task as operating on a potentially valuable worktree.
Start Of Turn
- Run
git status --short --branchfirst. - If the repository is clean, continue to the requested work.
- If the repository is dirty, stop new development first.
- Inspect modified, deleted, and untracked files with
git diff --stat,git diff, and targeted file reads. - Summarize what changed by file and by intent before editing anything else.
- Infer the strongest reasonable validation from the repo itself. Prefer existing test, lint, type-check, compile, or build commands over ad hoc checks.
- Use the narrowest command that gives real signal for the dirty changes, then broaden if the change is cross-cutting.
- If validation fails, surface the blocker immediately. Fix it only when that is in scope and safe; otherwise do not create a normal commit.
- If validation passes and the dirty changes are intentional, create a detailed Chinese git commit before starting the next implementation step.
Dirty Worktree Handling
When git status is not clean, do all of the following before new development:
- Review whether the changes look coherent, risky, incomplete, or broken.
- Inspect tests related to the changed files when feasible.
- Call out uncertainty if unrelated edits may have been mixed together.
- Preserve the user's existing work. Do not discard, overwrite, or silently clean up unrelated changes.
During Work
- Keep unrelated changes in separate commits whenever practical.
- Do not mix pre-existing dirty changes with new feature work without reviewing both scopes.
- Before starting a new logical phase that depends on a clean base, commit the validated current state.
- Avoid destructive git commands unless the user explicitly asks for them.
Verification Standard
Before committing existing dirty changes, prefer this order:
- Targeted tests for touched modules or packages
- Fast lint, type-check, or compile commands relevant to touched files
- Broader project test commands if the repository is small or the change is cross-cutting
Before the final commit, run a broader validation pass whenever practical:
- Full or broader unit test coverage
- Lint
- Type check
- Build or compile
- Targeted smoke test for the implemented flow
If the full sweep is not feasible, state exactly what was run and what was not run.
End Of Turn
- Re-read the final diff before the last commit.
- If files changed during the turn, run the strongest reasonable final validation.
- If the requested development is finished, or the conversation is likely ending, prefer comprehensive validation over a narrow spot check.
- If validation passes, stage the final diff and create a detailed Chinese git commit before sending the final response.
- If no files changed, do not create an empty commit.
- Confirm
git statusis clean after the final commit. - If the repository is not a git repo, say that this skill is not applicable.
Commit Policy
- Write every commit message in Chinese.
- Use a concise subject line plus a detailed body.
- Explain what changed, why it changed, implementation details, verification status, and any known limitation or follow-up.
- If a commit preserves user changes before new work begins, say that explicitly so the history remains auditable.
- When drafting the message, read
references/commit-template.mdfor the preferred structure and examples.
Recommended type values:
featfixrefactortestdocschore
Response Behavior
- Mention early when the worktree is dirty and what you are reviewing.
- Tell the user what you verified before each commit.
- Surface failures immediately with the likely cause.
- After each commit, report the commit purpose clearly in Chinese.
- In the final response, include the validation that ran, the commit hash or hashes created during the turn, and any residual risk.
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install git-commit-guard - 安装完成后,直接呼叫该 Skill 的名称或使用
/git-commit-guard触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Dev Git Guard 是什么?
Enforce a git-first workflow for repository coding tasks. Use when Codex is working inside a local git repository to inspect, modify, debug, refactor, implem... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 216 次。
如何安装 Dev Git Guard?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install git-commit-guard」即可一键安装,无需额外配置。
Dev Git Guard 是免费的吗?
是的,Dev Git Guard 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Dev Git Guard 支持哪些平台?
Dev Git Guard 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Dev Git Guard?
由 ontheway23333(@ontheway23333)开发并维护,当前版本 v1.0.0。