ESC
开源 1 分钟阅读

ub-mode:强制执行软件工程纪律的智能体技能

ub-mode 是一个面向 AI 代理的技能,用于在编写或修改代码时强制执行软件工程纪律。它借鉴了 poteto 的部分规则,并结合确定性质量门禁工具:先使代码工作,再使其正确,然后进行实践。

来源:GitHub

ub-mode

ub-mode 是一个在编写或修改代码时执行纪律性软件工程原则的智能体技能。它大致基于 @poteto 的规则(poteto-mode / pstack),并与确定性质量门禁工具相结合:

  1. 先使其工作 — Laziness Protocol、Foundational Thinking、TDD、Redesign From First Principles、Attack the Premise、Subtract Before You Add、Outcome-Oriented Execution、Build the Lever,以及 Architecture(Model the Domain、Boundary Discipline、Type System Discipline、Make Operations Idempotent、Separate Before Serializing Shared State)。
  2. 再使其正确 — Fix Root Causes、Sequence Work into Verifiable Units、Test Behavior (Not Implementation)、Crapper(CRAP < 10)、Dryer(duplication < 0.8)、Mutator(cover the uncovered, kill the survivors, delete dead code),以及 Refactoring。
  3. Practice — Keep a Log、Guard the Context Window、Worktree Cleanup,以及 Commit and Push in small ordered commits。

Companion Tool Repositories

ub-mode 依赖确定性质量门禁工具来执行结构、复杂度、重复和测试充分性:

  • unclebob/crapper — 计算每个函数的循环复杂度、测试覆盖率和 CRAP 分数,使每个函数保持在 CRAP 阈值(< 10)以下。
  • unclebob/dryer — 检测结构化代码重复,以便消除重复代码块(相似度 >= 0.8)。
  • unclebob/mutator — 运行变异测试,以暴露未覆盖的代码和测试未能捕获的存活变异。
  • unclebob/uml-viewer — 可视化组件、覆盖率、CRAP、变异分数和依赖方向。

Installation

将 SKILL.md 复制到你的智能体技能目录作为 ub-mode/SKILL.md(例如 ~/.grok/skills/ub-mode/SKILL.md、~/.claude/skills/ub-mode/SKILL.md 或 ~/.cursor/skills/ub-mode/SKILL.md),然后调用 /ub-mode。