boxmoe_header_banner_img

Hello! 欢迎来到阿虪的开发世界~

加载中

文章导读

ub-mode:Uncle Bob 的 agent 技能,用确定性质量门管住 AI 写代码


avatar
阿虪 1 11 月, 2026 296
ub-mode

中文版

ub-mode(GitHub:https://github.com/unclebob/ub-mode ,2026-10-25 创建,今晨抓取时已 5,817★)是 Robert C. Martin(Uncle Bob,《代码整洁之道》作者)放出的 agent 技能:让 agent 写代码、改代码时强制遵守一套严明的软件工程纪律,并配上确定性的质量门工具来验收。

它的三段式是:先“让它跑起来”——懒人协议、第一性原理重设计、先减后加、领域建模、边界纪律、操作幂等;再“把它做对”——修根因、按可验证单元排工作、测行为不测实现,配三个硬指标:CRAP 指数 < 10(Crapper 工具)、重复度 < 0.8(Dryer 工具)、变异测试杀光存活变异体并删掉死代码(Mutator 工具),最后重构;最后是“养成习惯”——记日志、守好上下文窗口、清理 worktree、小步有序提交推送。

为什么值得了解

  • 这是“AI 写代码质量不行”问题的一个严肃答案:不是靠提示词玄学,而是把 Uncle Bob 几十年的工程纪律 + 可量化的质量门直接钉进 agent 的工作流
  • 三个质量门工具(Crapper、Dryer、Mutator)本身就是能独立用的小工具,CRAP < 10、重复度 < 0.8、变异全杀这些标准可以直接借用到自己的项目里
  • 对正在求职的开发者尤其有启发:面试和作品集里能讲清楚“怎么保证 AI 辅助下代码质量不滑坡”,本身就是一个很加分的故事

English Version

ub-mode (GitHub: https://github.com/unclebob/ub-mode , created 2026-10-25, 5,817 stars at this morning’s fetch) is an agent skill from Robert C. Martin (Uncle Bob, author of “Clean Code”): it forces an agent writing or changing code to follow a strict discipline of software engineering, checked by deterministic quality-gate tools.

Its three phases are: first “Make it Work” — Laziness Protocol, redesign from first principles, subtract before you add, domain modelling, boundary discipline, idempotent operations; then “Make it Right” — fix root causes, sequence work into verifiable units, test behaviour not implementation, with three hard gates: CRAP index < 10 (the Crapper tool), duplication < 0.8 (the Dryer tool), and mutation testing that kills surviving mutants and deletes dead code (the Mutator tool), then refactor; finally "Practice" — keep a log, guard the context window, clean up worktrees, and commit and push in small ordered commits.

Why it’s worth knowing

  • This is a serious answer to “AI-written code isn’t good enough”: not prompt mysticism, but Uncle Bob’s decades of engineering discipline plus measurable quality gates bolted straight into the agent’s workflow
  • The three quality-gate tools (Crapper, Dryer, Mutator) are independently usable little tools in their own right — standards like CRAP < 10, duplication < 0.8 and kill-all-mutants can be borrowed directly into your own projects
  • Especially instructive for developers on the job market: being able to explain “how I keep code quality from sliding under AI assistance” in interviews and portfolios is itself a strong story


评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字

插入代码