站内导读

中文

定位:ub-mode 是一个 Agent 技能,用于在写代码或改代码时约束工程习惯,基于 poteto 的部分规则精简,并搭配确定性质量门禁工具。

核心能力

  • 分三阶段推进:先让代码能跑(TDD、从第一性原理重设计、攻击前提),再让代码正确(修根因、行为测试、重构),最后落实实践(日志、上下文窗口管理、小步提交)。
  • 通过 CRAP 分数门禁把每个函数的圈复杂度与测试覆盖绑定,要求 CRAP < 10。
  • 用 Dryer 检测结构重复,相似度 >= 0.8 的重复块需消除;Mutator 做变异测试,暴露未覆盖代码和存活变异体。
  • 安装只需把 SKILL.md 复制到 Agent 的 skills 目录(如 ~/.claude/skills/ub-mode/),再调用 /ub-mode 即可。

适用人群:适合已在 Grok、Claude、Cursor 等 Agent 环境里写代码的开发者,需要能安装技能目录并运行 crapper、dryer、mutator 等配套工具。

注意:README 未写明具体工具版本与运行环境要求。

README · 详细文档

来源 · 查看原文

ub-mode

ub-mode is an agent skill that enforces disciplined software engineering principles when writing or changing code. It is loosely based on portions of @poteto's rules (poteto-mode / pstack), reduced and paired with deterministic quality-gate tools:

  1. First Make it Work — Laziness Protocol, Foundational Thinking, TDD, Redesign From First Principles, Attack the Premise, Subtract Before You Add, Outcome-Oriented Execution, Build the Lever, and Architecture (Model the Domain, Boundary Discipline, Type System Discipline, Make Operations Idempotent, Separate Before Serializing Shared State).
  2. Then Make it Right — 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), and Refactoring.
  3. Practice — Keep a Log, Guard the Context Window, Worktree Cleanup, and Commit and Push in small ordered commits.

Companion Tool Repositories

ub-mode relies on deterministic quality-gate tools to enforce structure, complexity, duplication, and test thoroughness:

  • unclebob/crapper — Computes cyclomatic complexity, test coverage, and CRAP score per function so every function stays under the CRAP threshold (< 10).
  • unclebob/dryer — Detects structural code duplication so duplicate blocks (>= 0.8 similarity) are eliminated.
  • unclebob/mutator — Runs mutation testing to expose uncovered code and surviving mutants that tests fail to catch.
  • unclebob/uml-viewer — Visualizes components, coverage, CRAP, mutation scores, and dependency directions.

Installation

Copy SKILL.md into your agent's skills directory as ub-mode/SKILL.md (for example ~/.grok/skills/ub-mode/SKILL.md, ~/.claude/skills/ub-mode/SKILL.md, or ~/.cursor/skills/ub-mode/SKILL.md), then invoke /ub-mode.

相关项目 · 新晋黑马

查看全部「新晋黑马」项目 →