ub-mode

Enforce disciplined software engineering principles through structured code review and quality gates.

6.4k|358|Updated Oct 25, 2026
Ready to run
npx skills add https://github.com/unclebob/ub-mode --skill ub-mode-unclebob
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: ub-mode
Source: https://github.com/unclebob/ub-mode
Command: npx skills add https://github.com/unclebob/ub-mode --skill ub-mode-unclebob

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? This Skill eliminates ad-hoc code changes by enforcing a repeatable, principled workflow that catches structural issues, complexity bloat, and insufficient test coverage before code ships. It coordinates three phases—Make it Work, Make it Right, and Practice—to ensure every change is verifiable and sustainable. ## Core Features & Use Cases - First Make it Work: Apply foundational thinking, TDD, architecture principles, and domain modeling to build correct solutions. - Then Make it Right: Use deterministic quality gates (CRAP score, duplication detection, mutation testing) to eliminate complexity and improve test effectiveness. - Practice Discipline: Log every action, manage context window size, and commit in small, ordered units with clear justification. - Use Case: A team modifying a payment processor adds a new fee calculation. Instead of merging immediately, they follow ub-mode: write failing tests first, refactor the domain model to make illegal states impossible, run mutation testing to expose untested code paths, then commit in three ordered changesets with detailed logs. ## Quick Start When beginning a code change, first write a failing test that captures the desired behavior, then make the smallest change to pass it, then refactor to reduce cyclomatic complexity below ten and eliminate duplication above eighty percent similarity.

Frequently Asked Questions about ub-mode

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce cyclomatic complexity below CRAP 10?â–¼

Split functions into smaller units with single responsibility, convert nested conditionals to guard clauses or early returns, and extract switch statements into polymorphic types. Each refactored function should handle one logical path clearly.

What does the CRAP score measure and why does it matter?â–¼

CRAP (Change Risk Analysis and Predictions) combines cyclomatic complexity and test coverage into a single metric. A score below 10 indicates low defect risk; scores above 10 signal functions likely to introduce bugs during maintenance.

How do I eliminate code duplication detected by dryer?â–¼

Identify blocks with 0.8 or higher structural similarity, extract them into a shared function or base class, parameterize differences, and replace all occurrences. Test that behavior remains identical after extraction.

What does mutation testing reveal that unit tests miss?â–¼

Mutation testing runs your test suite against modified (mutated) code to find assertions that don't catch errors. Surviving mutants show weak test cases; killing all mutants proves tests validate actual behavior, not just happy paths.

Why sequence work into small, verifiable units instead of one big commit?â–¼

Small commits isolate changes, making root causes obvious during debugging, allow targeted rollback without affecting unrelated code, and force clear separation of concerns—each commit tells a story about why that change was necessary.