Skip to content
OpenAgentSkill
Browsing is open · Catalog captured 2026-11-21 · Automatic updates and account services are paused.
Design & UI

kent-beck-style

Review code following Kent Beck's refactoring philosophy and simple design principles. Detects code smells, guides refactoring techniques, and promotes incremental improvement (YAGNI, KISS). Use when reviewing code quality, refactoring, or improving code readability.

nathankim0 · Static checks on file

Installation

Read the source and dependencies before running a command. Copying does not install or execute anything.

npx skills add nathankim0/clean-architecture-skills --skill kent-beck-style

About this skill


name: kent-beck-style description: Review code following Kent Beck's refactoring philosophy and simple design principles. Detects code smells, guides refactoring techniques, and promotes incremental improvement (YAGNI, KISS). Use when reviewing code quality, refactoring, or improving code readability.

Kent Beck Style Coding Review Skill

Overview

This skill analyzes and reviews code based on Kent Beck's refactoring philosophy and simple design principles. It focuses on code smells detection, refactoring techniques, and incremental design improvement.

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler (Refactoring, foreword by Kent Beck)

When to Use

  • When user requests "code smell" detection or "refactoring" guidance
  • When asked about "code quality", "readability", or "maintainability"
  • When reviewing code for improvement opportunities
  • When asked about "YAGNI", "KISS", or "simple design"
  • When improving naming, extracting methods, or removing duplication

Core Design Principles

Simple Design (4 Rules of Simple Design)

Kent Beck's rules in priority order:

  1. Passes the Tests - Code must work correctly
  2. Reveals Intent - Code should clearly express its purpose
  3. No Duplication - DRY (Don't Repeat Yourself)
  4. Fewest Elements - Minimize classes, methods, and code

YAGNI (You Aren't Gonna Need It)

  • Don't add functionality until it's actually needed
  • Avoid speculative generality
  • Build for today's requirements, not imagined futures
// Bad: Speculative generality
interface DataProcessor<T, U, V> {
  process(input: T, options: U): V;
  processAsync(input: T, options: U): Promise<V>;
  processBatch(inputs: T[], options: U): V[];
  // We only need one sync method right now!
}

// Good: Build what you need
interface DataProcessor {
  process(input: string): Result;
}

KISS (Keep It Simple, Stupid)

  • Prefer simple solutions over clever ones
  • Complexity is the enemy of maintainability
  • If it's hard to explain, it's probably too complex

Incremental Design

  • Make small, safe changes
  • Refactor continuously as you code
  • Design emerges through refactoring

Code Smells Catalog

1. Bloaters

Code that has grown too large to handle.

Long Method

  • Methods doing too many things
  • Difficult to understand at a glance
  • Refactoring: Extract Method, Replace Temp with Query
// Bad: Long method doing many things
function processOrder(order: Order) {
  // Validate order (10 lines)
  // Calculate discount (15 lines)
  // Apply tax (10 lines)
  // Update inventory (20 lines)
  // Send notification (15 lines)
  // Generate invoice (25 lines)
}

// Good: Extracted into focused methods
function processOrder(order: Order) {
  validateOrder(order);
  const discount = calculateDiscount(order);
  const total = applyTax(order.subtotal - discount);
  updateInventory(order.items);
  sendOrderConfirmation(order);
  generateInvoice(order, total);
}

Large Class

  • Class with too many responsibilities
  • Too many instance variables
  • Refactoring: Extract Class, Extract Subclass

Primitive Obsession

  • Overuse of primitives instead of small objects
  • Using strings for phone numbers, money, etc.
  • Refactoring: Replace Primitive with Object, Introduce Parameter Object
// Bad: Primitive obsession
function createUser(
  name: string,
  email: string,
  phone: string,
  street: string,
  city: string,
  zipCode: string
) { ... }

// Good: Value objects
function createUser(
  name: Name,
  email: Email,
  phone: Phone,
  address: Address
) { ... }

Long Parameter List

  • Methods with too many parameters
  • Hard to understand and call correctly
  • Refactoring: Introduce Parameter Object, Preserve Whole Object

Data Clumps

  • Groups of data that always appear together
  • Refactoring: Extract Class, Introduce Parameter Object

2. Object-Orientation Abusers

Improper application of OO principles.

Switch Statements

  • Complex switch/case or if/else chains
  • Often indicates missing polymorphism
  • Refactoring: Replace Conditional with Polymorphism, Replace Type Code with Subclasses
// Bad: Switch statement
function calculateArea(shape: Shape): number {
  switch (shape.type) {
    case 'circle':
      return Math.PI * shape.radius ** 2;
    case 'rectangle':
      return shape.width * shape.height;
    case 'triangle':
      return (shape.base * shape.height) / 2;
  }
}

// Good: Polymorphism
interface Shape {
  calculateArea(): number;
}

class Circle implements Shape {
  calculateArea(): number {
    return Math.PI * this.radius ** 2;
  }
}

Temporary Field

  • Fields only set in certain circumstances
  • Refactoring: Extract Class, Introduce Null Object

Refused Bequest

  • Subclass doesn't use inherited methods
  • Refactoring: Replace Inheritance with Delegation

Alternative Classes with Different Interfaces

  • Classes doing the same thing with different method names
  • Refactoring: Rename Method, Extract Superclass

3. Change Preventers

Code that makes changes difficult.

Divergent Change

  • One class changes for multiple reasons
  • Violates Single Responsibility Principle
  • Refactoring: Extract Class

Shotgun Surgery

  • One change requires modifications in many classes
  • Refactoring: Move Method, Move Field, Inline Class

Parallel Inheritance Hierarchies

  • Creating a subclass requires creating another subclass elsewhere
  • Refactoring: Move Method, Move Field

4. Dispensables

Code that is unnecessary.

Duplicate Code

  • Same code structure in multiple places
  • Refactoring: Extract Method, Extract Class, Pull Up Method
// Bad: Duplicate code
function validateEmail(email: string): boolean {
  const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
  return regex.test(email);
}

function isValid
Read the complete source ↗