ub-mode: Uncle Bob's Ruleset and Quality Gates for Coding Agents

X postUncle Bob MartinTool

Robert C. Martin ('Uncle Bob') has shared ub-mode, an agent skill combining software craftsmanship principles with deterministic quality gates such as CRAP thresholds, duplication checks, and mutation testing.

Key points

  1. ub-mode is loosely based on poteto-mode/pstack rules, trimmed down to avoid overwhelming model context windows.
  2. The workflow is split into three phases: 'First Make it Work' (including TDD and domain modelling), 'Then Make it Right' (root cause fixes, behavioural tests, refactoring), and 'Practice' (context guarding, logs, small commits).
  3. The ruleset pairs with dedicated companion CLI tools: crapper (keeps CRAP score < 10), dryer (eliminates duplicate blocks >= 0.8 similarity), mutator (mutation testing), and uml-viewer.
  4. Martin notes that engineers must still monitor bots to ensure rules are followed, though the skill now enables them to sequence CRAP, drying, and mutation automatically.
  5. The skill is configured via a SKILL.md file placed into agent skill directories for tools such as Grok, Claude, or Cursor.

Why it matters

Coding agents frequently write fragile tests and complex code if left unguided. ub-mode demonstrates how prompting rules combined with deterministic quality-gate tooling can enforce disciplined TDD and automated refactoring workflows in AI-assisted development.

Analysis

Uncle Bob tackles standard LLM coding pitfalls by pairing prompt instructions with strict, measurable boundaries. Rather than expecting LLMs to self-police quality through prose alone, ub-mode leverages hard metrics (CRAP thresholds, duplication limits, mutant survival). Martin highlights that human developers remain responsible for steering the agents and verifying compliance.

Original post

Uncle Bob Martin

@unclebobmartin · 25 October 2026

I composed this skill and have had pretty good luck with it. My grokbots use it when writing code. t.co/uUG29G2KPz

1.4k likes69 replies1.9k bookmarks93.3k views

View on X
More posts in the thread (4)
  1. @MyRandNickName You are the engineer. You have to monitor the bots to make sure they don't ignore/forget the rules. The size of that ruleset is small enough to be relatively insignificant for most models. I trimmed it down a lot to be sure of that.
  2. @TaeKahn t.co/SHHlb9eaoo
  3. @dusangran I used to manually direct them to do crap, dry, and mutate. They'd finish a task. Then I'd crap it. Then I'd dry it. Then I'd mutate it. Now they know how to do all three in sequence. No biggie.
  4. @codeitlikemiley That’s exactly what those rules do.
Selected replies (5)
  • @TaeKahn @unclebobmartin Some stuff in here worth porting to mine, thanks for sharing. I shouldn't be sharing this with you, but i got a sneak peak at casey muratori's skill file. t.co/U4nY2vKp9R
  • @TheMcGloneCode @unclebobmartin FWIW I have incorporated some of your principles into my agents skills and have also had good results. Another list you may want to look at is @elonmusk’s “algorithm”. It applies well to software imo t.co/pvcddEqt6V
  • @MarkThibault @unclebobmartin Hey @bot add the skill to my Grokbot. Also create a coding agent.
  • @dusangran @unclebobmartin Which rule in it did your grokbots keep ignoring before you wrote it down? 🤔
  • @dusangran @unclebobmartin Mutate is the step i'd never skip, agents love tests that check nothing

Links and tools from this entry

Summary generated by AI (Gemini 3.8 Flash, 27 October 2026). It may contain errors – the original source is authoritative.

Similar in content, found by the AI search.

  • Repository:unclebob/ub-mode

    ub-mode: Agent Skill Enforcing Software Craftsmanship and Quality Gates

    The unclebob/ub-mode repository introduces an agent skill designed to enforce strict software engineering principles during AI-assisted programming. It pairs TDD and clean architecture rules with deterministic quality-gate tooling.

    701stars

    AI & LLMs· Tool

  • Repository:obra/superpowers

    Superpowers: An Agentic Skills Framework and SDLC Methodology for Coding Agents

    Superpowers is an open-source development methodology and skills framework for AI coding agents. Instead of immediately writing code, agents clarify specifications, draft test-driven implementation plans, and execute tasks autonomously through subagents.

    285.9kstarsShell

    AI & LLMs· Tool

  • Repository:troopdegen/mucho-texto

    mucho-texto: Structured Output Compression for AI Coding Agents

    mucho-texto is a skill designed for AI assistants like Claude Code, Cursor, and AGENTS.md workflows. It prevents agents from outputting verbose reports by categorising finished work into four distinct buckets and requiring an uncompressed, durable artifact before summarising.

    Shell

    AI & LLMs· Tool

  • Repository:coleam00/skills

    Cole's AI Skills: Modular Skill Files for Coding Agents

    The GitHub repository 'coleam00/skills' provides a collection of 33 practical skills designed for AI coding agents such as Claude Code. Instead of maintaining a monolithic 2,000-line CLAUDE.md instruction file, each skill resides in a standalone folder with a SKILL.md file and is loaded on demand. The set revolves around a standard development cycle: prime, plan, implement, validate, review, commit, and PR.

    482starsPython

    AI & LLMs· Tool

Let's talk about your project

Locations

  • Mattersburg
    Johann Nepomuk Bergerstraße 7/2/14
    7210 Mattersburg, Austria
  • Vienna
    Ungargasse 64-66/3/404
    1030 Wien, Austria

Parts of this content were created with the assistance of AI.