ub-mode, Robert C. Martin’s (Uncle Bob) skill for your agent to code with TDD and clean code, is installed in OpenCode by copying a single file to ~/.config/opencode/skills/ub-mode/. If you already have it in Claude Code, OpenCode detects it without any extra steps. We tested it in OpenCode 1.19.5 and 2.0.29, including a real session with DeepSeek V4 Pro.
yoDEV Tested · November 1, 2026
We installed ub-mode in five ways in OpenCode 1.19.5 and tested it in a real session in OpenCode 2.0.29 with DeepSeek V4 Pro, with and without the rule in AGENTS.md. The results we report as ours come from that test.
The repository’s README only indicates installation paths for Claude Code, Cursor, and Grok. The answer for OpenCode came from the community: issue #6, “Add to OpenCode”, gathered three methods in two days, including a complete configuration that its author describes as verified. Here’s what that configuration does, what we confirmed, and the only part we couldn’t execute.
What is ub-mode, Uncle Bob’s clean code skill?
ub-mode is a single 152-line SKILL.md file that tells your code agent how to work every time it touches code. Martin published it on October 25 and explains that it’s loosely based on part of @poteto’s rules (poteto-mode / pstack), trimmed down and combined with deterministic tools. It works in three phases:
- First Make it Work: write the failing test before changing code, define data shape well before logic, remove complexity before adding anything, validate data where it enters the system and trust it inside, and make operations idempotent.
- Then Make it Right: reproduce a bug before fixing it, test behavior not implementation, refactor only with behavior fixed by tests, and pass three quality checks.
- Practice: keep a record of each action and its reason, keep the main context window small, and make small, organized commits.
What sets it apart from most “clean code” skills are those quality checks. ub-mode tells the agent to run three tools that Martin also published:
| Tool | What it measures | Threshold in ub-mode |
|---|---|---|
| crapper | CRAP score per function (cyclomatic complexity × lack of test coverage) | every function below 10 |
| dryer | Structural duplication between functions | eliminate pairs with 0.8 or higher similarity |
| mutator | Mutation testing: mutants your tests don’t detect | cover what’s uncovered, kill survivors, delete dead code |
All three support Clojure, Java, Go, TypeScript, Rust, and Python, and require Python 3.11 or higher to run.
Does ub-mode work in OpenCode?
Yes, in both 1.x and 2.x. OpenCode reads skills from its own folder and also from Claude Code and generic agent folders, so the same SKILL.md works without changes. We installed it five different ways in a clean OpenCode 1.19.5 environment and verified each with opencode debug skill, which lists all skills OpenCode can load. ub-mode appeared in all cases:
| Installation method | Where the file ends up | Result |
|---|---|---|
| curl (issue #6) | ~/.config/opencode/skills/ub-mode/SKILL.md |
|
| Existing Claude Code installation | ~/.claude/skills/ub-mode/SKILL.md |
|
git clone + move (issue #6) |
~/.config/opencode/skills/ub-mode/ |
|
| Project-only | .opencode/skills/ub-mode/SKILL.md |
|
npx skills add |
~/.agents/skills/ub-mode/SKILL.md |
In OpenCode 2.0.29 we tested the project path (.opencode/skills/) with a real agent session: it loaded the skill, as you’ll see below.
How do you install skills in OpenCode?
The global installation from issue #6 is two commands:
mkdir -p ~/.config/opencode/skills/ub-mode
curl -fsSL https://raw.githubusercontent.com/unclebob/ub-mode/master/SKILL.md \
-o ~/.config/opencode/skills/ub-mode/SKILL.md
For a single project, place the file at .opencode/skills/ub-mode/SKILL.md inside the repository.
If you prefer a package manager, the skills CLI installs it for OpenCode globally without prompting:
npx skills add unclebob/ub-mode@ub-mode -g -a opencode -y
It copies the skill to ~/.agents/skills/ub-mode, a folder that OpenCode reads. The CLI itself reminds you that skills run with all your agent’s permissions, something worth keeping in mind with this one in particular (we explain why below).
And if you already followed the README for Claude Code, you don’t have to do anything: OpenCode loads ~/.claude/skills/ automatically. The same Claude Code skills work in both agents.
How do you verify that OpenCode sees the skill?
In OpenCode 1.x, run:
opencode debug skill
It prints in JSON the list of skills it can load. You should see an entry called ub-mode with the path where you installed it. OpenCode reads the configuration on startup, so restart any open session after installing.
That command only exists in OpenCode 1.x. In 2.0.29, opencode debug offers agents, config, and paths, with no skill listing. In v2, the practical check is asking the agent to load ub-mode in a new session.
How do you make OpenCode use the skill on every code change?
By default it won’t. The skill’s own description says to use it when the user runs /ub-mode or asks for the principles, and OpenCode decides which skill to load by reading that description. So the agent only uses ub-mode when you ask it to.
The configuration from issue #6 solves this with a rule in AGENTS.md, the file OpenCode reads as standing instructions. This is the text we used, taken from the issue:
Every time you write, modify, refactor, or fix code — in any session, without waiting for a command —
first load skill `ub-mode` (skill tool, id: `ub-mode`) and follow its rules:
First Make it Work → Then Make it Right → Practice.
The same user also suggests editing the description field in the SKILL.md to present the skill as mandatory on every code change.
That rule makes the difference. We ran the same request twice in OpenCode 2.0.29 with DeepSeek V4 Pro, in a new repository with ub-mode installed at project level: “add a subtract function to calc.py, no commit or push”.
| Run | Configuration | Did it load ub-mode? | Tools it used |
|---|---|---|---|
| A | Skill installed, no rule | No | read, edit |
| B | Skill + rule in AGENTS.md |
Yes | read, skill, shell, edit |
Without the rule, the agent ignored the skill completely. With it, it called OpenCode’s skill tool on its own to load ub-mode, made the change, and verified it by running Python.
We tested the rule in an AGENTS.md at the project root. For a global rule, OpenCode’s documentation points to ~/.config/opencode/AGENTS.md as the file that applies to all sessions.
Does the agent really do TDD with ub-mode?
Not entirely, at least in our test. In run B, the agent verified the change with an inline Python command instead of writing a test first, which is exactly ub-mode’s first rule. The rule in AGENTS.md gets the skill to load; how strictly it’s followed depends on the model. If TDD is what matters most to you, ask for it explicitly in the same AGENTS.md.
How do you install crapper, dryer, and mutator?
This is where most people will go wrong. There are two conditions, and we verified both in the source code of the tools:
- mutator needs crapper as a sibling folder. If crapper isn’t installed as a package, mutator looks for it at
../crapper, next to its own directory, and stops with an error asking you to clone it there. That’s why it’s best to clone all three in the same folder:
mkdir -p ~/.local/share/ub-tools && cd ~/.local/share/ub-tools
git clone https://github.com/unclebob/crapper
git clone https://github.com/unclebob/dryer
git clone https://github.com/unclebob/mutator
- Use wrapper scripts in your PATH, not symlinks. Each tool’s launcher creates its virtual environment in the directory from which it’s run. If you call it through a symlink, that directory becomes your
binfolder, not the tool’s. A two-line wrapper avoids this; create one per tool, calledcrapper,dryer, andmutator:
#!/bin/sh
exec "$HOME/.local/share/ub-tools/crapper/crapper" "$@"
The first run of each tool creates its .venv and installs itself. Issue #6 suggests testing them with crapper --help, dryer, and mutator --scan <file>. We couldn’t run them in our test environment: the two conditions above come from reading their launchers and code.
Without these tools in the PATH, ub-mode still works as a set of principles, but the agent will waste turns looking for commands that don’t exist, as issue #3 notes.
What risks does ub-mode have?
Two rules in the skill let the agent act without you. Issue #2 flags them: the “Commit and Push” section ends with a push to the main branch, and “Worktree Cleanup” lets the agent decide what’s safe to delete to free up disk. If you don’t want either one, say so in the same AGENTS.md where you activate the skill: for example, have the agent commit but never push, and list what it would delete and wait for your approval.
There are two more things that depend on the date. At the time of publishing this note (November 1, 2026):
- The repository has no license. Issue #5 asks what’s planned and still has no answer. It matters if you plan to use it in a company.
- The file may move. Pull request #1, still open, moves
SKILL.mdtoskills/ub-mode/SKILL.md. If it merges, the curl URL above will give a 404; in that case, thenpx skills addpath is the one to use.
ub-mode or Superpowers?
They solve the same problem at different scales. Superpowers is a complete framework of skills and workflows that prevents the agent from coding before planning. ub-mode is a single file of rules plus three measurement tools: less process, but with numeric thresholds (CRAP below 10, no duplication above 0.8, no surviving mutants) that the agent can’t argue around. If you already use Superpowers, ub-mode’s controls are the piece worth adding.
What about you? What rule do you always require from your agent before letting it touch your code?
- Yes, I always require it
- Only when I ask
- No, I write the tests
- I prefer another option (tell us which)
Comment below or, if you got this article by email, reply directly to the email: your reply gets published here.
Related: The best skills for AI agents: 21 that make your AI code like a senior