Back to list
Fortiz2305

tidy-first

by Fortiz2305

Repository which contains my dotfiles

2🍴 0📅 Jan 24, 2026

SKILL.md


name: tidy-first description: Execute structural refactoring with test verification before behavioral changes - use when tidying code before features, cleaning up duplication, or improving clarity

Tidy First Skill

Execute structural changes BEFORE behavioral changes, following Kent Beck's Tidy First approach.

What Qualifies as "Structural"?

Structural changes rearrange code WITHOUT changing behavior:

Structural (Tidy First):

  • Rename variables, functions, classes for clarity
  • Extract methods/functions to reduce duplication
  • Move code to different files/modules for better organization
  • Reorder code for readability
  • Add type annotations
  • Split large functions into smaller ones
  • Consolidate duplicate code

NOT Structural (Behavioral):

  • Add new features
  • Fix bugs
  • Change logic or algorithms
  • Modify API contracts
  • Add/remove parameters
  • Change return types

The Tidy First Process

1. Capture Baseline

Before making ANY structural change, run tests to capture baseline:

# Run all tests
npm test

# Verify TypeScript compilation
tsc -b --noEmit

All tests MUST pass before proceeding. If tests fail, fix them first.

2. Make ONE Structural Change

Make exactly ONE type of structural change at a time:

  • Rename OR extract OR move (not multiple types at once)
  • Keep the change focused and small

Examples of ONE change:

  • Rename processData to validateUserInput across all files
  • Extract duplicate validation logic into validateInput() function
  • Move all repository interfaces to domain/repositories/ folder

3. Verify No Behavior Change

After the structural change, run tests again:

# Run all tests
npm test

# Verify TypeScript compilation
tsc -b --noEmit

Tests MUST still pass - this proves you didn't change behavior.

If tests fail:

  • ❌ You accidentally changed behavior
  • ⚠️ Revert the change and try again more carefully

4. Commit Separately

Commit the structural change with refactor: type:

git commit -m "refactor: rename processData to validateUserInput for clarity"
git commit -m "refactor: extract duplicate validation into validateInput"
git commit -m "refactor: move repository interfaces to domain layer"

Critical Rules

  • ✅ ALL structural changes BEFORE behavioral changes
  • ✅ ONE structural change type per commit
  • ✅ Tests must pass BEFORE the change
  • ✅ Tests must pass AFTER the change
  • ✅ If tests fail after, you changed behavior - REVERT
  • ✅ Use refactor: commit type for structural changes
  • ✅ Never mix structural and behavioral in same commit

Why Separate Structural from Behavioral?

  1. Easier to review: Reviewers can see structure changes vs logic changes separately
  2. Safer: If behavior breaks, you know it's from behavioral commits, not structural
  3. Easier to revert: Can revert behavioral changes without losing structural improvements
  4. Better history: Git history shows clear progression of work
  5. Less risky: Structural changes with passing tests are provably safe

Example Workflow

# WRONG: Mixed structural + behavioral
git commit -m "Add user validation and rename variables"  # ❌

# RIGHT: Separate commits
git commit -m "refactor: rename userData to userInput for clarity"  # ✅
git commit -m "feat: add user validation logic"  # ✅

Score

Total Score

45/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
言語

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

0/5
タグ

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

0/5

Reviews

💬

Reviews coming soon