Agent skill

Git Workflow

by cat-xierluo in cat-xierluo/legal-skills

Git 工作流安全助手。用于分支与 worktree 管理、主目录 main 防切换保护、Skill 稀疏检出、PR 创建/审查/合并,以及提交身份和隐私检查;也支持 CI 额度治理、敏感文件历史撤回与仓库瘦身。不要用于批量生成提交信息、项目任务分配或本地 Agent 会话编排。

MITAuto-check passedDevelopment

Install Git Workflow

skills CLI
$ npx skills add cat-xierluo/legal-skills --skill git-workflow -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install cat-xierluo/legal-skills git-workflow --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/cat-xierluo/legal-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/git-workflow .claude/skills/git-workflow && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
git-workflow
GitHub stars
713
Token cost
~1.1k tokens
SKILL.md length
250 words
Files
41 (incl. scripts, references)
Skills in repo
62
Repo updated
First seen
Licence
MIT

At a glance

Git 工作流安全助手。用于分支与 worktree 管理、主目录 main 防切换保护、Skill 稀疏检出、PR 创建/审查/合并,以及提交身份和隐私检查;也支持 CI 额度治理、敏感文件历史撤回与仓库瘦身。不要用于批量生成提交信息、项目任务分配或本地 Agent 会话编排。

  • Works in 4 steps: 固定范围和原现场,读取相应合同;普通短分支以最新远端目标为基准,长期线固定本波… → 在允许范围执行,运行与产物匹配的验证,审完整 diff… → 进入提交、push、PR、合并等副作用前核相应授权和门禁;返回值不替代实际分支、P… → …
  • Tasks that involve Git workflow
  • SKILL.md covers 场景路由, 共同约束, 执行与收口 and 依赖, plus 1 more section
  • Runs Shell scripts from its folder; calls brew and apt

What it does

Git Workflow is an agent skill from cat-xierluo/legal-skills. Git 工作流安全助手。用于分支与 worktree 管理、主目录 main 防切换保护、Skill 稀疏检出、PR 创建/审查/合并,以及提交身份和隐私检查;也支持 CI 额度治理、敏感文件历史撤回与仓库瘦身。不要用于批量生成提交信息、项目任务分配或本地 Agent 会话编排。

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 42 other files, including scripts and reference files (for example `CHANGELOG.md`, `references/accident-recovery.md` and `references/branch-lifecycle-and-cleanup.md`).

It sits in Development, covering Git workflow and Git worktrees. It works with Git. The licence is MIT.

When your agent uses it

  • Tasks that involve Git workflow
  • Tasks that involve Git worktrees

Example prompts

  • “/git-workflow”

Requirements

  • Python 3
  • A Bash shell

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. 固定范围和原现场,读取相应合同;普通短分支以最新远端目标为基准,长期线固定本波 OID。共享源 dirty 时保持原状。
  2. 在允许范围执行,运行与产物匹配的验证,审完整 diff 和最终说明。候选变化后重跑受影响检查。
  3. 进入提交、push、PR、合并等副作用前核相应授权和门禁;返回值不替代实际分支、PR 元数据或服务端合并回执。
  4. 在项目既有任务源记录实际产物、退出状态、候选 OID、保留项及未验范围。分别报告本机采用、云端交付与清理状态,不把静态通过称为全流程稳定。

What it can do on your machine

Read from SKILL.md and the folder at commit c077fcc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell, from the files we listed), which the agent can run.

    Shell commands in SKILL.md call:

    • brew
    • apt

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Git Workflow loads about 1.1k tokens when it runs, and up to ~38k if it reads all its reference files. Until then it costs about 38 tokens; SKILL.md has 250 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~38k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from cat-xierluo/legal-skills at commit c077fcc, republished under its MIT licence (© cat-xierluo). 250 words, ~1,075 tokens.

Download SKILL.mdSave it as .claude/skills/git-workflow/SKILL.md (or your agent's skills folder). This skill also uses 40 other files; get the full folder from GitHub.
name
git-workflow
description
Git 工作流安全助手。用于分支与 worktree 管理、主目录 main 防切换保护、Skill 稀疏检出、PR 创建/审查/合并,以及提交身份和隐私检查;也支持 CI 额度治理、敏感文件历史撤回与仓库瘦身。不要用于批量生成提交信息、项目任务分配或本地 Agent 会话编排。
license
MIT
metadata.version
1.23.1
metadata.homepage
https://github.com/cat-xierluo/legal-skills
metadata.author
杨卫薪律师(微信ywxlaw)

Git 工作流

维护 Git 的范围、身份、候选和交付规则。先读取用户授权、项目规则与完整任务卡,确定仓库、允许路径、目标分支、预期身份和验收;只加载当前场景需要的参考文档。

场景路由

在相应操作前读取该行的合同;跨场景任务按执行顺序读取,不一次性加载全部 references。

当前需求读取与执行入口
本地隔离开发到交付、基准落后或共享主树被占用本地 Worktree SOP
新建或限缩 Skill/套件工作树、跨目录占用审计稀疏工作树;创建用 scoped-worktree.py,完整登记只读审计用 sparse-worktree-audit.py
提交身份、Co-authored-by 污染、已合历史回执、完整 PR 范围推送身份与推送,再按内容读取隐私预检
PR 创建/审查/合并、CI 未知、冲突或更新 basePR 流程;文本与完整历史核验读取隐私预检
主目录固定 main、所有 Agent 独立 worktree 开发、具名集成主目录分支保护;主目录默认只读、具名采用的命令前门禁用 main-git-gate.py / test-main-git-gate.py;历史索引锁只核验/解除
Monorepo 窄采用、cherry-pick 与冲突改动集成
误 amend / stash / 删分支 / reset 的事故恢复事故恢复;先定位证据,再按授权恢复
Skill 连续迭代、候选观察、长期功能线或里程碑长期集成分支
分支/工作树清理、批量验收或取代关闭旧 PR生命周期与清理;只读盘点用 branch-audit.sh / worktree-audit.sh
短任务/里程碑/子分支命名,Commit / Issue / PR 标题与关闭语义命名与提交格式
GitHub Actions 分钟耗尽、停挂或恢复CI 额度治理
敏感/私有材料已经发表,需从历史撤回历史撤回
仓库或对象库膨胀、配置同步仓瘦身膨胀审计;先区分历史、检出、缓存和任务材料
查 gh 参数gh 速查,命令示例仍受对应合同约束

本 Skill 内脚本名均相对技能目录。执行时将 git_workflow_dir 设置为本技能安装目录的绝对路径,在目标仓库运行;不要为了调用脚本切换到技能源码仓库。本文及参考文档提供方法,不能代替用户对外部写入或破坏性操作的授权。

共同约束

  • 保留现有改动、暂存状态、任务材料及其他会话归属。优先复用适合的隔离检出;不通过 stash/reset/切换共享主树清掉别人的现场。提交前核实际分支和身份,worktree 默认共享 repo-local Git 配置,worker 不写 user.name/email。
  • 单 Skill/具名套件默认创建时稀疏检出。副作用前固定目标、真实依赖、基准与磁盘预算,入口不支持目录范围时停在创建前,不把缺少参数当作全量许可。已有树限缩先保护 dirty/index、ignored/untracked 和 Session;详细方法只在稀疏合同维护。
  • force push、reset --hard、丢弃修改、clean -f、强删分支、跳过 hooks/签名及改写历史须有具体明确授权。锁先查持有者,不直接删;hook 失败修复后新建提交,不绕过。默认新建 commit,amend 须用户要求;精确暂存文件。
  • 普通提交发表走 safe-push.sh,身份和隐私核验完整 PR range并绑定不可变 OID;不得只查 HEAD、用 HEAD~1 缩窄范围或裸 push 绕门。创建/合并 PR 用 safe-pr.py 核最终完整文本与精确 head,不使用未经检查的自动说明。已明确授权的历史重写与精确 ref 删除按对应专页执行,不能借该例外绕过普通发表门禁。
  • 合并须绑定授权、可读 diff、允许范围、独立 review 和最终 checks。未知、失败、缺失或候选漂移时停止;helper 不代替这些门禁。不绕仓库保护、自 approve 限制或用 admin override。
  • Monorepo 不在本地直接 feature→main merge。按实际允许范围窄采用或正式 PR 保留目标侧其他模块;主干→长期功能线同步属于另一个方向,遵循功能线合同。
  • 单任务清理绑定生命周期及精确 tip;长期分支与固定树不随子 PR 删除。已合并后的清理失败记录 CLEANUP_PENDING,不重放 push/merge;批量候选不等于删除授权。
  • 依赖缺失、验证失败或网络结果不明时保留首失败及现场;先核真实结果再重试。缺工具不自动安装、不降级绕过门禁,环境安装沿用户及项目已有授权。

所有项目的 Agent 开发、修改、测试和提交在各自独立 worktree 中完成。主目录固定 main,仅用于稳定加载和具名集成者串行采用;禁止为了修复漂移切回 main。采用须绑定完整候选、当前 HEAD、逐文件范围和原 index/dirty,遇到并发变化停止该次采用。命令门禁默认拒绝主目录 add/commit,只有具名 owner 与匹配的 expected HEAD 可进入采用路径;这不是对任意程序的强制安全边界。GUI/绝对路径/旧 runtime 未接入仍为 NOT_VERIFIED;不重装常驻 index.lock,不擅自删除现存他人锁。

执行与收口

  1. 固定范围和原现场,读取相应合同;普通短分支以最新远端目标为基准,长期线固定本波 OID。共享源 dirty 时保持原状。
  2. 在允许范围执行,运行与产物匹配的验证,审完整 diff 和最终说明。候选变化后重跑受影响检查。
  3. 进入提交、push、PR、合并等副作用前核相应授权和门禁;返回值不替代实际分支、PR 元数据或服务端合并回执。
  4. 在项目既有任务源记录实际产物、退出状态、候选 OID、保留项及未验范围。分别报告本机采用、云端交付与清理状态,不把静态通过称为全流程稳定。

依赖

系统依赖
依赖使用范围与安装方式
Git全部 Git 操作;macOS 可用 Command Line Tools 提供的 Git,Linux 使用发行版包管理器
Bash.sh 门禁与审计;使用系统 Bash
Python 3.10+隐私、PR、稀疏创建/审计脚本;macOS: brew install python,Linux: apt install python3
GitHub CLI(gh)GitHub PR/CI 与远端状态查询,先核已有认证;macOS: brew install gh,Linux 按 GitHub CLI 官方安装说明
Python 包

Python 入口只依赖标准库,不需要 pip 安装。稀疏审计的 du / lsof 与分支盘点的 gh 降级边界见各自合同;降级后的缺失证据必须显式保留,不能追认通过。

协作边界

git-batch-commit 负责用户明确要求的提交拆分与说明生成,沿本 Skill 的身份/隐私与 Issue 关闭规则;项目任务源维护状态,multi-agent-orchestration 负责 worker 派发和会话,继续引用同一稀疏合同;release-workflow 负责发版与资产,本 Skill 负责日常 Git/CI 治理。

项目文档体检只在项目已有流程及授权内衔接;Git Workflow 不规定其阈值、目录、任务状态或维护 PR 副作用,也不因当前请求自动派发或发布维护任务。

© cat-xierluo, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 40 other files (scripts, references) in skills/git-workflow of cat-xierluo/legal-skills.

  • SKILL.md
  • CHANGELOG.md
  • LICENSE.txt
  • references/accident-recovery.md
  • references/branch-lifecycle-and-cleanup.md
  • references/change-integration.md
  • references/gh-cli-quickref.md
  • references/github-actions-quota-guard.md
  • references/history-rewrite-and-removal.md
  • references/identity-and-push.md
  • references/issue-pr-format.md
  • references/local-worktree-sop.md
  • references/long-lived-integration-branch.md
  • references/main-directory-protection.md
  • references/pr-workflow.md
  • references/privacy-preflight.md
  • references/repo-bloat-audit-and-slim.md
  • references/sparse-worktree.md
  • scripts/branch-audit.sh
  • … and 22 more

Open the folder on GitHubat commit c077fcc

Compare with similar skills

Git Workflow next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Git Workflow compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Workflow this skillcat-xierluo/legal-skills713—~1.1kAutomated safety check: PassMIT
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Git Worktree Cleanuplobehub/lobehub83k—~2.8kAutomated safety check: PassCustom licence
Ccmanager Configkbwo/ccmanager1.3k—~1.5kAutomated safety check: PassMIT
Git Worktree Managermicrosoft/WindowsAppSDK4.7k—~2kAutomated safety check: PassMIT
Git Committisfeng/Easydict15k—~535Automated safety check: PassGPL-3.0

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Git Worktree Cleanup

    lobehub/lobehub

    Audits stale Git worktrees and branches with a bundled script, classifies each one, and deletes only after you approve the exact candidates.

    83k GitHub stars~2.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Ccmanager Config

    kbwo/ccmanager

    Set up, review, or repair a CCManager config — .ccmanager.json at a git repository root, or the global ~/.config/ccmanager/config.json.

    1.3k GitHub stars~1.5k tokensUpdated today
    DevelopmentAuto-check passed
  • Git Worktree Manager

    microsoft/WindowsAppSDK

    Official

    Creates and manages Git worktrees with PowerShell scripts so separate issues and Copilot sessions each get an isolated branch, build and test environment.

    4.7k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed
  • Git Commit

    tisfeng/Easydict

    起草、创建或汇报 Angular-style 本地 Git 提交。用于明确的提交交付;分支集成使用 worktree-rebase-merge,不 push。

    15k GitHub stars~535 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Git Worktree Isolation

    jnMetaCode/superpowers-zh

    Sets up an isolated workspace before feature work or plan execution, preferring native worktree tools and falling back to git worktree, with instructions in Chinese.

    8.3k GitHub starsUsed in 1 repo~982 tokens
    DevelopmentAuto-check passed

More from cat-xierluo/legal-skills

All 62 skills in this repo
  • Elements-Style Complaint Generator

    cat-xierluo/legal-skills

    Converts a lawyer's ordinary complaint or a described case into the Supreme People's Court's elements-style Word template, with layout checks on the result.

    713 GitHub stars~2.5k tokensUpdated today
    Auto-check: notes
  • Lecture Performance Review

    cat-xierluo/legal-skills

    Analyzes raw lecture transcripts for verbal tics, pacing, time use and promise follow-through, with optional slide-by-slide comparison and cross-session tracking.

    713 GitHub stars~2.2k tokensUpdated today
    Auto-check passed
  • De-AI Polish for Chinese Articles

    cat-xierluo/legal-skills

    Detects and rewrites machine-sounding patterns in the body text of Chinese articles while keeping the author's facts, headings and legal terms intact.

    713 GitHub stars~2.9k tokensUpdated today
    Auto-check passed
  • GitHub Star Manager

    cat-xierluo/legal-skills

    Finds GitHub projects mentioned in articles or screenshots and stars them, tracks updates to your starred repos, and builds an HTML dashboard to browse them.

    713 GitHub stars~2k tokensUpdated today
    Auto-check: notes
  • Legal Harness Initializer

    cat-xierluo/legal-skills

    Sets up or incrementally updates AGENTS.md and CLAUDE.md for legal professionals, with a minimal safety baseline and a check that a new session loads and follows the rules.

    713 GitHub stars~2.3k tokensUpdated today
    Auto-check passed
  • Moot Court Simulation Builder

    cat-xierluo/legal-skills

    Chinese-language skill that organizes a case file into a multi-role mock trial with judge, parties and clerk, producing a transcript, issue review and a to-strengthen list.

    713 GitHub stars~1.4k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Git Workflow

What does Git Workflow do?

Git 工作流安全助手。用于分支与 worktree 管理、主目录 main 防切换保护、Skill 稀疏检出、PR 创建/审查/合并,以及提交身份和隐私检查;也支持 CI 额度治理、敏感文件历史撤回与仓库瘦身。不要用于批量生成提交信息、项目任务分配或本地 Agent 会话编排。. Git Workflow is an agent skill from cat-xierluo/legal-skills.

When should I use Git Workflow?

Git Workflow fits situations like: tasks that involve Git workflow; tasks that involve Git worktrees.

How do I install Git Workflow in Claude Code?

Run `npx skills add cat-xierluo/legal-skills --skill git-workflow -a claude-code`. Or copy the skill folder (skills/git-workflow in cat-xierluo/legal-skills) into .claude/skills/git-workflow in your project. Claude Code loads it when a task matches its description.

How do I install Git Workflow in Codex?

Run `npx skills add cat-xierluo/legal-skills --skill git-workflow -a codex`. Or copy the skill folder (skills/git-workflow in cat-xierluo/legal-skills) into .agents/skills/git-workflow in your project. Codex loads it when a task matches its description.

Can I use Git Workflow in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add cat-xierluo/legal-skills --skill git-workflow -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/git-workflow, .gemini/skills/git-workflow, .github/skills/git-workflow and .opencode/skills/git-workflow in your project.

What does Git Workflow need to run?

Going by SKILL.md and its folder, Git Workflow needs a shell for the scripts in its folder and the command-line tools its instructions call (brew and apt). Our summary lists: Python 3; A Bash shell.

Does Git Workflow access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Git Workflow safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Git Workflow use?

Git Workflow is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Git Workflow use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 37k tokens, read only when the agent opens those files.

What are the alternatives to Git Workflow?

Skills that share tags, products or a category with Git Workflow: Finishing a Development Branch (obra/superpowers, 296k stars), Git Worktree Cleanup (lobehub/lobehub, 83k stars), Ccmanager Config (kbwo/ccmanager, 1.3k stars) and Git Worktree Manager (microsoft/WindowsAppSDK, 4.7k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Workflow?

cat-xierluo (a GitHub user) maintains it in cat-xierluo/legal-skills, which has 713 GitHub stars. The repository holds 62 skills in this directory. The repository was last updated on October 7, 2026.

Source: cat-xierluo/legal-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.