Git Commit Guard for Openclaw

A protective git-first workflow skill for AI agents that ensures repository integrity through rigorous pre-work inspection, multi-stage validation, and structured commits.

ontheway23333
v1.0.0
Mar 19, 2026
0
801
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install git-commit-guard

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install git-commit-guard using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Git Commit Guard?

Git Commit Guard is a specialized extension within the Openclaw Skills ecosystem designed to enforce a disciplined, git-first methodology for AI coding agents. It prevents the common pitfall of AI agents overwriting unsaved work or polluting repositories with unverified changes. By prioritizing worktree health, the skill ensures that every coding task—from debugging to feature implementation—starts with a clear understanding of the current repository state.

This skill is particularly valuable for developers working in multilingual environments or those who prefer high-context version histories. It mandates that agents inspect dirty worktrees, infer the correct validation commands from the local environment, and document all changes using detailed commit messages in Chinese. This approach maintains a high-quality, auditable project history while minimizing the risk of regression or lost code.

Git Commit Guard Use Cases

  • Managing dirty worktrees by inspecting existing changes before an AI agent starts new development tasks.
  • Enforcing rigorous testing and linting standards before any code is committed to the repository.
  • Standardizing project history with high-detail Chinese commit messages that explain the 'why' behind implementation.
  • Safeguarding existing user work by preventing destructive git commands or silent overwrites.
  • Providing a clean hand-off at the end of an AI session with a fully validated and committed state.

How Git Commit Guard Works

  1. The agent executes git status at the start of the turn to determine if the repository is clean or dirty.
  2. If dirty, the agent performs a deep dive using git diff and file reads to summarize existing changes and intent.
  3. The skill identifies existing test suites, linters, or build tools within the repo to establish a validation baseline.
  4. Before new work begins, existing intentional changes are committed to ensure a clean base for the next logical phase.
  5. During development, changes are isolated and validated using a tiered verification standard (targeted tests first, then broader sweeps).
  6. Upon completion, a final validation pass is run, and a comprehensive commit is generated following the Chinese commit policy.

Git Commit Guard Setup

To integrate this workflow into your AI agent environment using Openclaw Skills, ensure your local repository is initialized and your configuration points to the standard commit templates.

# Ensure you are in a git repository
git init

# The skill will automatically reference your template if located at:
# references/commit-template.md

# Check status to see the skill in action
git status --short --branch

Git Commit Guard Data Schema & Taxonomy

The skill organizes its operations around the standard Git metadata and a specific template structure for documentation:

Data Type Source/Location Purpose
Worktree State git status Determines initialization logic (clean vs. dirty).
Diff Logs git diff --stat Used for summarizing intent and impact of changes.
Commit Template references/commit-template.md Provides the structural blueprint for Chinese commit messages.
Validation Output Local CLI (npm, pytest, etc.) Logs the success/failure of verification steps before committing.
Commit History .git/logs Stores the final auditable hashes and detailed Chinese descriptions.

Git Commit Guard Advanced Features

  • Multi-stage validation: Automatically escalates from targeted unit tests to full system smoke tests based on the scope of the change.
  • Auditable user-change preservation: Explicitly identifies and commits pre-existing user changes before AI intervention to maintain a clear audit trail.
  • Smart verification inference: Dynamically detects whether to use linting, type-checking, or compiling based on repository contents.
  • Chinese localization: Enforces a strict Chinese-language commit policy for teams requiring standardized documentation in that language.
  • Residual risk reporting: Summarizes exactly what was and wasn't tested in the final turn response for better developer oversight.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*