AI & Machine Learning

Clean Code Author Robert Martin Releases ub-mode for AI Coding Agents

Robert Martin’s ub-mode pairs engineering rules with complexity, duplication and mutation-testing tools to help AI coding agents produce maintainable code.

By Daniel Mercer Edited by Samantha Reed Published: Updated:
Clean Code Author Robert Martin Releases ub-mode for AI Coding Agents
Clean Code author Robert Martin has published ub-mode to bring testing, code-quality checks and small commits to AI coding workflows. Photo: Angelacleancoder / Wikimedia Commons

Key Notes

  • Robert Martin’s ub-mode combines written engineering principles with separate tools that measure complexity, identify structural duplication and test whether tests detect code changes.
  • The skill emphasizes meaningful tests before implementation, fixes that address root causes, and small documented changes that reviewers can inspect.
  • Installing the instruction file does not automatically configure its companion tools or prove better outcomes, so teams still need to evaluate the resulting code and adapt the workflow.

Robert C. Martin, the author of Clean Code, has published ub-mode, an agent skill that asks AI coding assistants to work with the discipline he has long advocated for human programmers. The aim is to make generated code easier to test, understand and maintain, rather than simply produce more of it.

The public repository combines a compact instruction file with links to separate tools for complexity, duplication and mutation testing. It is a workflow for an existing coding agent, not a new model. Its README also credits portions of developer poteto’s earlier rules as an influence.

That distinction matters amid increasingly ambitious AI-built projects. In our Goose coverage, the interesting division of labor was between a person supplying the language design and AI handling much of the implementation. ub-mode addresses a related question: what standards should govern all that implementation work?

Tests Before Code, Then Fix the Cause

The skill instructions put test-driven development near the start: write a failing test, confirm that it fails for the expected reason, and make the smallest change needed to pass it. There is an explicit exception when a meaningful test is impractical, rather than a demand to manufacture a weak one.

For bugs, the agent is told to reproduce the problem and address its cause. Adding a guard that merely conceals a crash is not enough. Refactoring should preserve observable behavior, while tests should exercise code as a user would encounter it instead of mirroring internal implementation details.

The wider design rules favor removing unnecessary complexity, validating data at system boundaries and organizing changes into small units that can be checked. They also ask for an action log explaining the reasons behind the work and frequent, ordered commits. The emphasis is on leaving evidence a reviewer can follow.

Three Tools Give the Rules Something to Measure

Crapper combines control-flow complexity with test coverage in a per-function CRAP score. A function with many branches and little coverage scores worse than a straightforward, well-tested one. ub-mode asks the agent to bring each function below a score of 10 by simplifying it, improving tests or both.

Dryer looks for structurally similar code, normalizing details such as local names to expose possible duplication. Its output is a list of candidates for review. Similar structure is useful evidence, but deciding whether two functions should share an abstraction still requires understanding what they do.

There is a small configuration detail worth noticing: ub-mode calls for addressing duplication at 0.8 similarity and above, while Dryer documents a default reporting threshold of 0.82. Copying the instruction file therefore does not, by itself, configure every tool to match the stated policy.

Mutator checks tests by making controlled changes to the code. If the tests fail, they have detected the mutation; if they still pass, the change survives and deserves investigation. The tool separately records uncovered sites, which it normally skips rather than executing.

Its documented language support includes Clojure, Java, Go, TypeScript, Rust and Python, matching the broad scope of the companion tools. Mutator also uses Crapper’s function information. These are separate projects with their own setup requirements, rather than executables bundled inside the two-file ub-mode repository.

An Agent Skill Is Still a Policy, Not a Quality Guarantee

The README describes installation as placing the instruction file in an agent’s skills directory and invoking /ub-mode. That makes the guidance available to the assistant; it does not establish that the assistant follows every rule or that the measurement tools are correctly integrated with a project’s build and tests.

Metrics also answer narrower questions than whether a product is good. Strong coverage can coexist with mistaken requirements. Low duplication does not demonstrate a sound architecture, and a small function can still return the wrong result. The tools provide review signals rather than a substitute for deciding what the software should accomplish.

The skill’s instructions extend to version control, including a final push to the main line. Teams adopting it would need to reconcile that step with their own branch and review process. The published file describes Martin’s preferred workflow; a project’s maintainers still set the conditions for accepting changes.

The Point Is What Happens After the First Working Version

Our examination of PhotoCraft explored the gap between an impressive AI-assisted build and a tool ready for dependable work. ub-mode targets the less spectacular part of that gap: checking behavior, reducing avoidable complexity and making subsequent changes understandable.

We reviewed the repositories and their documentation, without installing the skill or running a comparative evaluation. The materials support describing ub-mode as a concrete, inspectable approach to AI-assisted engineering. Whether it improves a particular team’s code will depend on how it is applied, what the tests actually check and what reviewers find in the resulting changes.

Disclaimer: AIstify is an independent media brand owned and operated by NuvexMedia LLC, publishing news, research, and insights on artificial intelligence, emerging technologies, automation, and related industries. NuvexMedia LLC invests in and collaborates with companies across the AI, technology, software, and digital innovation sectors. These relationships do not influence AIstify’s editorial coverage, and the publication maintains full editorial independence to provide accurate, timely, and objective information. © 2026 NuvexMedia LLC. All rights reserved. This content is for informational purposes only and should not be considered legal, tax, investment, financial, or other professional advice.

AI & Machine Learning, News