Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

kent-beck-style

БесплатноБез исполняемых скриптовНе проверен

Review code following Kent Beck's refactoring philosophy and simple design principles. Detects code smells, guides refactoring techniques, and promotes…

Hectr203от Hectr203★ 21 звезда на GitHub

Об этом скилле

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 Respo
Полный SKILL.md на GitHub

Установить kent-beck-style в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл 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.

Как установить скилл kent-beck-style?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл kent-beck-style запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить kent-beck-style с