/vault-software-development:multi-agent-repo-governancefrom vault-software-development
给「多个 AI agent 并行改同一个 GitHub 仓」的仓装上一整套可复用的治理骨架:五条硬规则 (合并前冲突检查 / 默认分支停止条件 / issue 纪律 / 单 issue 多切片多 worktree / 绿黄红分级授权)、 五个会真跑命令的 PR 闸门(提交格式 / 所有权越界 / 脚本语法 / PR 模板 / 文档引用可达)、 一份 AGENTS.md 模板与配套脚本(pre-merge-check、new-slice、pr-grade、check-refs)。 适用于:新仓要让多个 agent 并行提交、agent 合并事故频发、CI 全绿但合并后文档链接 404、 agent 把「未验证」写成「已完成」、PR 模板与提交格式反复不合规、需要把人工门禁固化成机器闸门。 不适用于:单人单分支的小仓、纯代码风格/测试框架类规范、已有成熟治理体系且不想改动的仓。
Ships in vault-software-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
一句话:把「agent 能不能合、合了会不会出事」从靠自觉变成靠机器判定,并给出可复制的文件。
这个 skill 交付的是一套可拷进新仓的文件,不是一个流程说明:
AGENTS.md 模板 + 5 个脚本 + 2 个 workflow + 1 个配置 + 1 个文档骨架。
拷完就能用;换项目只改 .agent-gate.conf。
不调用:单人单分支的小仓(用不上五层门禁);纯代码风格 / 测试框架规范; 已有成熟治理体系且用户不想改动的仓(先问,别去覆盖别人的 AGENTS.md)。
multi-agent-repo-governance/
├── SKILL.md ← 本文件
├── references/
│ ├── governance-model.md ← 五条规则为什么这样定(判据、失效条件、授权矩阵)
│ ├── ci-gates.md ← 五个闸门怎么接、required checks、账单假红排障、七个自举陷阱
│ ├── doc-layout-rules.md ← 目录职责、一份正本、引用检查三级分类、忽略清单
│ └── anti-patterns.md ← 10 个真实踩过的坑:症状 → 根因 → 对策
└── templates/ ← 拷进目标仓的文件(相对路径引用,可直接复制)
├── AGENTS.md ← 治理文件模板(五条硬规则 + 提交格式 + 命名 + §1.5 引用检查归属)
├── .agent-gate.conf ← 项目相关项:治理面路径 / 共享正本 / 默认 issue / 分支前缀
├── .refcheck-ignore ← 引用忽略清单样例
├── .github/workflows/
│ ├── pr-gate.yml ← 每 PR 的 5 道机器闸门
│ └── dev-sync.yml ← main → dev 自动同步(不需要 dev 分支可删)
├── scripts/
│ ├── pre-merge-check.sh ← R1:冲突试算 + 主线脏检查 + 基线包含 + 三件套
│ ├── new-slice.sh ← R4:建 worktree + 分支(唯一写操作是 git worktree add)
│ ├── pr-grade.sh ← R5 机判引擎 + 5 个子检查
│ └── check-refs.py ← 文档引用可达性检查器(零依赖,只标准库)
└── docs/README.md ← 文档目录骨架与写法要求
整套骨架已经做成一个 GitHub 模板仓,可直接 "Use this template" 或 clone 后改名:
templates/ 已落成
一个完整仓(R1~R5 规则 + 5 道机器闸门 + 引用可达性检查 + 4 个常驻 skill + .agent-gate.conf)。
模板仓的 .claude/skills/ 是随模板分发的副本,不是 vault 的 curated 技能——vault 的
build-manifest.ps1 会跳过 TEMPLATE* 目录,避免同名技能被扫成重复副本。templates/ 整个拷进目标仓根(.github/、scripts/、docs/README.md 都要),
或直接用上面那个模板仓。templates/.agent-gate.conf → 仓根 .agent-gate.conf:
GOV_PATHS_RE:治理面文件(改了就必须 admin 批准)。默认含 AGENTS.md、scripts/pre-merge-check.sh、scripts/new-slice.sh、.github/**SHARED_ORIGIN_RE:共享正本目录(默认只读,要写必须登记为切片独占)DEFAULT_ISSUE:PR 正文没写 Refs: 时的兜底 issueBRANCH_PREFIX / WORKTREE_DIR:默认 feat / wttemplates/AGENTS.md 拷成仓根 AGENTS.md,按项目改写 {占位符} 与规则细节。.github/workflows/pr-gate.yml 已含 5 个 job;再到仓库 Settings → Branches →
main 加 branch protection,把 5 个 job 勾成 required checks + 禁 force push。
没有 branch protection 时,绿级只是靠 agent 自觉。bash scripts/pr-grade.sh --selftest(机判引擎自测)、
python scripts/check-refs.py --all(引用可达性,应输出 0 处)。| 层 | 管什么 | 判据 | 谁执行合并 |
|---|---|---|---|
| H1 冲突与基线 | 能不能合 | scripts/pre-merge-check.sh → SAFE_TO_MERGE + 三件套(TTL 10 分钟) | —— |
| H2 所有权与正本 | 该不该合 | pr-grade.sh --check-ownership(越界 0 处) | —— |
| H3 分级与授权 | 谁来合 | 绿=agent 自动;黄=要 user 批准(agent 可代执行并留引用);红=只有 admin 执行 | 见下 |
三层不互相豁免,每层单独出结论,结论有保质期。 详情见 references/governance-model.md。
| job | 抓什么 |
|---|---|
commit-lint | 主题格式 / Refs: #N / 禁 Closes / ≤72 字符 |
ownership-check | 改了本切片独占范围之外的文件 |
syntax | 改动的 *.sh 过 bash -n |
template-check | PR 模板小节齐全 + pre-merge 三件套原文 |
refs-check | 文档引用可达:路径 / md 锚点 / file:line 越界 |
每个 job 都必须真跑命令。判据抽自 PR 正文的地方只能当「人已声明的事实」,不能当机器检查——
这条是从真实事故里换来的(test_fail 一度是从正文 grep「失败 N 个」,死链一路放行)。
接线与排障见 references/ci-gates.md。
| 类别 | 谁查 |
|---|---|
| 可达性(路径/锚点/行号) | 机器必查:scripts/check-refs.py(pr-grade.sh --check-refs) |
| 内容相符(列名/措辞/版本号对不上) | 独立 reviewer subagent——机判读不出语义 |
| 跨正本口径(两份正本说法相反) | 独立评审 + 状态标记 + 正本单一化 |
别指望 agent 每次自己记得查:实测「机器查不到」的两类必须由独立 reviewer 兜底, 实现者不得给自己的 PR 出评级。规则见 references/doc-layout-rules.md。
| 任务 | 做法 |
|---|---|
| 开一个新切片 | bash scripts/new-slice.sh <slice> [base] → 在 issue 切片表登记 - \` → `<独占目录>`→ 写码 → 提交带Refs: #` |
| 提交前自检 | bash scripts/pr-grade.sh --pr <N>(机判)+ 独立 reviewer 出 GRADE= 块 |
| 合并前 | bash scripts/pre-merge-check.sh origin/<branch> main → 贴完整输出(含 SAFE_TO_MERGE / CHECK_TIMESTAMP / MAIN_HEAD)→ TTL 内执行合并 |
| 文档引用报错 | python scripts/check-refs.py --pr <N> 看清单;确实是外部仓路径或待产出物料 → 写进 .refcheck-ignore 并在 PR 正文说明理由;整篇在讲「还缺什么」→ 文件头加 refcheck:skip-file 声明 |
| CI 全员红但没报错 | 看 check-run 注解原文;started_at 与 completed_at 只差 1~2 秒 = 没拿到 runner = 账单封锁,不是权限问题(见 references/ci-gates.md) |
| 黄/红 PR 卡住、自己又无法 Approve | 单管理员仓的死锁:作者不能审自己。见 ci-gates 的「七个自举陷阱」第 1 条(评论授权协议) |
| 关掉闸门后 PR 反而合不进去 | 跳过的 required check = 永久 Expected。开关要做进检查内部,不做成 job 级 if:(陷阱 2) |
| 修好闸门、重跑仍是旧报错 | rerun 重放原 workflow 且检查代码取自 PR head → gh pr update-branch 或开新 PR(陷阱 3、4) |
| 同步基线后 commit-lint 红了 | 用合规 merge message:git merge origin/main -m "chore(<slice>): 同步 main 基线" -m "Refs: #<issue>" |
python templates/scripts/check-refs.py --root templates --dir # 本 skill 自己的引用必须全通
bash -n templates/scripts/pr-grade.sh && bash -n templates/scripts/pre-merge-check.sh
bash -n templates/scripts/new-slice.sh
refs-check 两道就够references/anti-patterns.md (opens in a new tab)references/ci-gates.md (opens in a new tab)references/doc-layout-rules.md (opens in a new tab)references/governance-model.md (opens in a new tab)templates/AGENTS.md (opens in a new tab)templates/docs/README.md (opens in a new tab)templates/scripts/check-refs.py (opens in a new tab)templates/scripts/new-slice.sh (opens in a new tab)templates/scripts/pr-grade.sh (opens in a new tab)templates/scripts/pre-merge-check.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub yhyu13/agentskillsvault --plugin vault-software-development25 skills in this plugin
/agent-desktopOperate desktop applications on macOS, Windows and Linux through native accessibility trees, using the agent-desktop CLI. Use when an AI agent must see or act on a desktop GUI: click buttons, fill forms, read UI state, navigate menus, toggle checkboxes, scroll, drag, type text, press shortcuts, take screenshots, manage windows, use the clipboard, launch or close apps, read notifications. Triggers on: "click button", "fill form", "open app", "read UI", "computer use", "operate desktop", "accessibility tree", "snapshot app", "type into field", "navigate menu", "toggle checkbox", "take screenshot", "desktop automation", "agent-desktop", or any desktop GUI task on macOS, Windows or Linux.
/agent-eval-loopBuild a Skill + Eval + Verification triad for any agent workflow, then
ascend the trust curve from local observation to cloud automation. Use
this when the user wants to (1) encode a team best practice as a reusable
skill, (2) write a unit test for an agent skill ("skill is hallucinating,
how do I check?"), (3) establish a trust loop before running cloud agents
at scale, or (4) move from "agent I have to babysit" to "agent I trust
to ship PRs to main." This skill teaches the methodology distilled from
the Cursor team's public talk by a SpaceXAI engineer.
/apk-ndk-version-checkCheck which Android NDK / clang version built an APK's native library (libUE4.so, lib*.so) — works even when the ELF section table is stripped (UE Shipping builds), maps "based on rXXXXXX" revisions to NDK releases via changelog, and cross-validates with libc++_shared.so. Use when asked to check NDK version, clang version, compiler version of an APK or .so, or to figure out which toolchain built a native library./brainstormingYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation)./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary./code-reviewReview the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding standards?) and Spec (does the code match what the originating issue/spec asked for?). Runs both reviews in parallel sub-agents and reports them side by side. Use when the user wants to review a branch, a PR, work-in-progress changes, or asks to "review since X".