# ub-mode

> An agent skill that guides software engineering practices and companion quality checks when a coding agent writes or changes code.

ub-mode is an agent skill published by the GitHub user unclebob. It guides an AI coding agent through a disciplined engineering workflow and pairs that guidance with deterministic quality-gate tools. The README says it is loosely based on portions of @poteto's rules (poteto-mode / pstack), reduced and combined with companion tools.

## What It Is

ub-mode is a SKILL.md file that an agent loads and invokes as /ub-mode when writing or changing code. It organizes its principles into three stages: make it work, make it right, and practice.

## How the Workflow Is Structured

The first stage, First Make it Work, covers the Laziness Protocol, Foundational Thinking, TDD, Redesign From First Principles, Attack the Premise, Subtract Before You Add, Outcome-Oriented Execution, Build the Lever, and Architecture topics such as Model the Domain, Boundary Discipline, Type System Discipline, idempotent operations, and separating shared state before serializing.

The second stage, Then Make it Right, covers Fix Root Causes, sequencing work into verifiable units, testing behavior rather than implementation, and refactoring. It sets a CRAP score threshold below 10 and a duplication threshold below 0.8, and it directs the agent to cover uncovered code, kill surviving mutants, and delete dead code.

The third stage, Practice, covers keeping a log, guarding the context window, worktree cleanup, and committing and pushing in small ordered commits.

## Companion Quality-Gate Tools

- Crapper computes cyclomatic complexity, test coverage, and CRAP score per function.
- Dryer detects structural code duplication.
- Mutator runs mutation testing to expose uncovered code and surviving mutants.
- UML Viewer visualizes components, coverage, CRAP, mutation scores, and dependency directions.

## Setup Path

Copy SKILL.md into the agent's skills directory as ub-mode/SKILL.md, for example under ~/.claude/skills, ~/.cursor/skills, or ~/.grok/skills, then invoke /ub-mode.

## Scope and license

This is an instruction document, not a standalone enforcement engine. Deterministic checks depend on separate companion tools and the agent following the guidance. The repository does not specify a license; public reading access does not establish redistribution rights.

## Features
- Agent skill invoked as /ub-mode
- TDD and test-behavior-not-implementation guidance
- Architecture principles including domain modeling and boundary discipline
- CRAP score threshold below 10 via Crapper
- Duplication threshold below 0.8 via Dryer
- Mutation testing guidance via Mutator
- Small ordered commits, logging, and worktree cleanup practices
- Context window guarding

## Integrations
Claude, Cursor, Grok, Crapper, Dryer, Mutator, UML Viewer

## Platforms
CLI

## Pricing
Free

## Links
- Website: https://github.com/unclebob/ub-mode
- Documentation: https://github.com/unclebob/ub-mode
- Repository: https://github.com/unclebob/ub-mode
- EveryDev.ai: https://www.everydev.ai/tools/ub-mode
