Skip to main content
skill CX Codex

ub-mode — Claude Code skill: what it does, how to install

The ub-mode skill for Claude Code helps developers structure code changes. It guides the development process by following the principles of "First Make it Work, Then Make it Right, Then Follow Practice."

MIT 930 installs ★ 8,308 updated 2026-11-02

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add unclebob/ub-mode --skill ub-mode -a claude-code
Open on GitHub

What ub-mode does

The ub-mode skill implements a set of principles for writing and modifying code. It divides the development process into three distinct phases: "First Make it Work," "Then Make it Right," and "Follow Practice." Each phase includes specific methodologies, such as the Laziness Protocol, Foundational Thinking, Test-Driven Development (TDD), and Redesign From First Principles.

In the "First Make it Work" phase, the skill focuses on quickly achieving functionality. This involves shipping the smallest edit, getting data shapes right, writing failing tests before code changes, and subtracting complexity before adding new features. The "Then Make it Right" phase is dedicated to improving code quality: fixing root causes, sequencing work into verifiable units, testing behavior over implementation, and using tools to reduce complexity and duplication.

The final "Follow Practice" phase covers maintaining a log of actions, guarding the context window, and cleaning up worktrees. The skill also advocates for frequent, small, ordered commits, with each commit detailing the "why," "what changed," and "how it was proven."

What it helps with

  • Structure code changes effectively
  • Apply TDD and clean code principles
  • Manage complexity and duplication in projects
  • Ensure operations are idempotent
  • Maintain a clean development environment and commit history

Example prompts for the agent

  • /ub-mode
  • "Apply the ub-mode principles to this code."
  • "How should I follow ub-mode principles for refactoring?"

How to install ub-mode

1Skills CLI (Vercel)

npx skills add unclebob/ub-mode --skill ub-mode -a claude-code

2Manually: put the files in place

~/.claude/skills/ub-mode/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ub-mode/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ub-mode

How to install ub-mode in Claude Code?

To install the ub-mode skill in Claude Code, run the command npx skills add unclebob/ub-mode --skill ub-mode -a claude-code. Then ensure the skill is available at ~/.claude/skills/ub-mode/SKILL.md.

What does the ub-mode skill do?

The ub-mode skill helps developers structure the process of writing and changing code by adhering to a set of principles. It breaks down the work into phases: making it work, making it right, and following best practices.

What are the core principles of ub-mode?

The core principles are "First Make it Work," "Then Make it Right," and "Follow Practice." These phases cover everything from the Laziness Protocol and TDD to architectural decisions and commit management.

Source text

SKILL.md · MIT
---
name: ub-mode
description: >
  Follow the reduced principles when writing or changing code. Every change
  follows First Make it Work, then Then Make it Right, then Follow Practice.
  Use when the user runs /ub-mode or asks for the reduced principles.
---

# ub-mode

Every time you are asked to make a change follow:
* First Make it Work.
* Then Make it Right.
* Follow Practice

# First Make it Work

## Laziness Protocol

* One decision lives in one place.
* Ship the smallest edit that solves the problem.

## Foundational Thinking

* Get the data shape right before you write the logic.
* Do first whatever helps every later phase.
* If a concurrent writer would matter, do not share state.

## TDD

* Write the failing test before you change the code.
* See it fail for the reason you expect.
* Make the smallest change that makes it pass.
* If an honest test is impractical, do not write a bad one.

## Redesign From First Principles

* Do not bolt a new requirement onto the old design.
* Ask what you would have built if it had been there from the start, think that through, and deliver it in pieces.

## Attack the Premise

* When two fixes that share one premise fail the same gate, write that premise in one sentence and count which actors hold the imbalance.
* Remove the assignment.
* Do not start another fix until you have done that.

## Subtract Before You Add

* Take complexity out before you add anything.

## Outcome-Oriented Execution

* Aim at the end state you can check.
* A break in the middle is allowed when you planned it and can undo it.

## Build the Lever

* If the work is not obvious at a glance, build the tool that does it.
* Do one unit by hand, then make the tool match that unit.

## Architecture

### Model the Domain

* Put the domain in a structure that makes the illegal states impossible.
* Maintain a glossary of domain terms.
* If the code is already clear and local, leave it.

### Boundary Discipline

* Check the data where it enters.
* Inside, trust it.
* Keep the business logic in a pure function.

### Type System Discipline

* Make the illegal value impossible to write.
* Parse outside data once, where it comes in.
* Do not silence the compiler.

### Make Operations Idempotent

* Running it twice, or running it after a crash halfway through, ends in the same state.

### Separate Before Serializing Shared State

* If they do not need the same mutable thing, give each its own.
* If they do, allow one writer, and enforce that in the structure.

# Then Make it Right

## Fix Root Causes

* Reproduce it.
* Fix the cause.
* A guard that only hides the crash is not a fix.

## Sequence work into verifiable units

* Finish one small unit and check it.
* Then start the next.

## Test Behavior, Not Implementation

* The test calls the code the way its user does and checks the result that user would see.
* If the test would still pass when every function returned nothing, throw it out.

## Crapper

* Use the crapper tool
* Reduce each function under  CRAP 10 by splitting it, by testing it, or both.
* Consider whether case statements are worth reducing.

## Dryer

* Use the dryer tool to eliminate duplication that rank 0.8 or above.

## Mutator

* Use the mutator tool
* Cover the uncovered.
* Kill the survivors.
* Delete dead code.

## Refactoring

* Pin what the code does.
* Change the structure.
* Prove the behavior did not change.

# Practice

## Keep a Log

* Keep a log of every action you take and the reason you took it.
* Report that log upon completion.

## Guard the Context Window

* Keep the main thread small.
* Send the bulk elsewhere, and keep the summary.

## Worktree Cleanup

* Find what is safe to remove, confirm nothing still in use needs it, then reclaim the disk.
* Uncommitted work waits for a decision.

## Commit and Push

* Commit often, in small ordered commits.
* Each commit says why, what changed, and how you proved it.
* Push to the main line at the end.

© unclebob · MIT · unclebob/ub-mode

Similar skills

All skills for Code review and refactoring →

Project sponsors

Companies that keep this analytics open