← 返回 Skills 市场
yiiknow

Structuring Git Workflow

作者 小易 · GitHub ↗ · v0.1.1 · MIT-0
cross-platform ✓ 安全检测通过
65
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install structuring-git-workflow
功能描述
Use when working in a git repository and about to start new work, complete a module, commit, push, merge, or rebase. Use before any destructive git operation...
使用说明 (SKILL.md)

Structuring Git Workflow

Overview

Imposes branch discipline, commit structure, and safety checks at every git decision point. The skill acts as a gate: it does not execute commands, it asks the right questions before you do.

Violating the letter of these rules is violating the spirit of these rules.

When to Use

Starting new work?
  ├─ Yes → Create branch (Rule 1)
  └─ No → Continue

Module/feature complete?
  ├─ Yes → Remind about commit (Rule 2)
  └─ No → Continue

About to commit/push/merge/rebase?
  ├─ Yes → Run safety checklist (Rule 4)
  └─ No → Continue

Core Rules

Rule 1: Never Commit to Main/Master

All work happens on branches. When starting any task (feature, fix, refactor), create a branch first:

Task type Branch pattern Example
Feature feature/\x3Cname> feature/user-login
Bug fix fix/\x3Cname> fix/login-timeout
Refactor refactor/\x3Cname> refactor/auth-middleware

If you catch yourself about to commit on main/master, stop and create a branch. If work already started on main, stash it, create a branch, then unstash.

Rule 2: Remind About Commit at Module Boundaries

When a discrete unit of work is complete (a function, a component, a feature slice), proactively ask: "This module is complete. Commit it?"

Do not wait for the user to remember. The default answer is yes — most modules should be committed. If the user says no, respect it and move on.

Rule 3: Structured Commit Messages

Commit messages follow a consistent format. The default format is:

\x3Ctype>: \x3Cdescription>

Types: feat, fix, refactor, style, docs, test, chore

  • First line under 72 characters
  • Use imperative mood ("add" not "added")
  • If the project CLAUDE.md or CONTRIBUTING.md specifies a different convention, follow that instead

Rule 4: Safety Checklist Before Destructive Operations

Before reset --hard, rebase, force push, or branch -D:

  1. Is this a shared branch? → Do not rewrite history
  2. Do I have uncommitted changes? → Stash or commit first
  3. Am I on the right branch? → git branch to verify
  4. Is remote up to date? → git fetch first

State each check result explicitly before proceeding.

Rule 5: Push Is a Separate Decision

Commit and push are distinct steps. Commit accumulates locally. After commits are verified (tests pass, no regressions), ask: "Ready to push?"

Never push automatically after commit. Never force-push to shared branches. Use --force-with-lease on feature branches only.

Quick Reference

Trigger Action
Starting new work Create feature/ or fix/ branch from main
Module complete Remind user about commit
About to commit Use structured message format
About to push Verify first, ask user
Force push needed --force-with-lease on feature branches only
Destructive operation Run 4-point safety checklist
Work accidentally on main Stash → create branch → unstash

Common Mistakes

Mistake Fix
Committing directly to main Always create a branch first
Commit message "fix stuff" Describe the specific change
Pushing immediately after commit Accumulate, verify, then push
Force push without checking Run safety checklist first
Skipping branch for "small fix" Small fixes go on fix/ branches too
Amend pushed commits Only amend local, unpushed commits

Edge Cases

Scenario Handling
User insists on committing to main Push back once: "This should go on a branch. Sure you want it on main?" If they confirm, comply.
Project initialization (first commit) The initial commit (README, scaffold) is the only exception to Rule 1
Collaborating on an existing branch No need to create a new branch — commit to the existing feature/fix branch
Local repo, no remote Rules 1-3 still apply. Rules 4-5 (push safety) are dormant until a remote is added
User's CLAUDE.md specifies different convention Follow the project convention. This skill is the default, not an override

Red Flags — STOP

  • "This is too small for a branch" → Even one-line fixes go on a branch
  • "I'll branch after I start" → Branch first, then work
  • "Nobody else works on this repo" → Discipline is habit, not circumstance-dependent
  • "The user seems in a hurry" → Urgency is when mistakes happen. Follow the rules
  • "The user told me to skip the branch" → Push back once, then comply if they insist
  • "It's just a config tweak" → Config changes can break things. Use a branch

All of these mean: Create the branch. Write the structured message. Run the checklist.

安全使用建议
Install this if you want your agent to apply opinionated Git discipline across repositories. Review whether its branch naming, commit timing, and push/rebase rules fit your project practices, especially in repos with existing CONTRIBUTING.md or CLAUDE.md guidance.
能力评估
Purpose & Capability
The skill's purpose is to impose branch discipline, structured commit messages, and safety checks around Git operations; the reviewed instructions match that purpose.
Instruction Scope
The activation scope is broad across routine Git work, including commit, push, merge, rebase, and destructive operations, but the instructions emphasize checks, user confirmation for pushing, and deference to project conventions.
Install Mechanism
The artifact contains only README.md and SKILL.md text files; no scripts, dependencies, binaries, package installs, or executable hooks are present.
Credentials
The skill may influence repository state by guiding branch creation, commits, and Git safety checks, which is proportionate for a Git workflow skill but should match the user's team workflow.
Persistence & Privilege
Persistence is limited to installed skill instructions; there is no background process, privilege escalation, credential handling, local indexing, or network behavior in the artifact.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install structuring-git-workflow
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /structuring-git-workflow 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.1
- Added a README.md file with documentation for the skill. - No changes to core logic or rules. All existing functionality remains the same.
v0.1.0
Initial release of the Structuring Git Workflow skill. - Introduces clear guidelines for disciplined git branching and commit practices. - Enforces structured commit messages and regular reminders to commit at logical work boundaries. - Implements a safety checklist before destructive git operations (e.g., reset, rebase, force push). - Separates commit and push as distinct steps, with explicit checks before pushing. - Includes quick reference tables, examples, edge cases, and common mistakes.
元数据
Slug structuring-git-workflow
版本 0.1.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Structuring Git Workflow 是什么?

Use when working in a git repository and about to start new work, complete a module, commit, push, merge, or rebase. Use before any destructive git operation... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 65 次。

如何安装 Structuring Git Workflow?

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

Structuring Git Workflow 是免费的吗?

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

Structuring Git Workflow 支持哪些平台?

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

谁开发了 Structuring Git Workflow?

由 小易(@yiiknow)开发并维护,当前版本 v0.1.1。

💬 留言讨论