Back to list
seungwonme

tdd

by seungwonme

0🍴 0📅 Dec 14, 2025

SKILL.md


name: tdd description: Test-Driven Development following Kent Beck's TDD and Tidy First principles. Use when implementing features with test-first approach, following Red-Green-Refactor cycle, or separating structural changes from behavioral changes in commits.

Test-Driven Development

Follow the TDD cycle: Red → Green → Refactor

Core Principles

  1. Write the simplest failing test first
  2. Implement minimum code to make tests pass
  3. Refactor only after tests are passing
  4. Separate structural changes from behavioral changes

TDD Workflow

  1. Write a failing test (Red)
  2. Write just enough code to pass (Green)
  3. Refactor while keeping tests green
  4. Repeat
// 1. Write failing test
test('shouldSumTwoPositiveNumbers', () => {
  expect(sum(2, 3)).toBe(5);
});

// 2. Write minimum code to pass
function sum(a: number, b: number): number {
  return a + b;
}

// 3. Refactor if needed (tests still pass)

Tidy First Approach

Separate commits into two types:

Structural Changes (First)

  • Renaming, extracting methods, moving code
  • No behavior change
  • Run tests before AND after

Behavioral Changes (Second)

  • Adding or modifying functionality
  • Commit separately from structural changes

Commit Discipline

Only commit when:

  1. ALL tests pass
  2. ALL linter warnings resolved
  3. Single logical unit of work
  4. Message states if structural or behavioral

Code Quality Standards

  • Eliminate duplication ruthlessly
  • Express intent through naming
  • Make dependencies explicit
  • Keep methods small (single responsibility)
  • Minimize state and side effects
  • Use simplest solution that works

Refactoring Guidelines

  • Only refactor in Green phase
  • Use established refactoring patterns
  • One refactoring at a time
  • Run tests after each step

Score

Total Score

50/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon