Skip to content

Commit e35469d

Browse files
Add Tidy First principles to AGENTS.md and CLAUDE.md
- Introduced "Tidy First" principles by Kent Beck to enhance code quality and maintainability. - Added guidelines for separating structural and behavioral changes, and practical techniques for tidying code. - Emphasized the importance of tidying before feature additions and bug fixes.
1 parent a094398 commit e35469d

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ SolapiMessageService → Fetcher (singleton) → Authenticator (static)
7878
- Full type hints on method params/returns
7979
- PHPDoc `@var`, `@param`, `@return`, `@throws` annotations
8080

81+
**Tidy First (Kent Beck):**
82+
- Separate structural and behavioral changes into distinct commits
83+
- Tidy related code before making feature changes
84+
- Guard clauses, helper variables/functions, code proximity, symmetry normalization, delete unused code
85+
8186
## ANTI-PATTERNS
8287

8388
- **Avoid catch-all nulls:** Many get* methods return `null` on any exception — check response validity

CLAUDE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,27 @@ SolapiMessageService → Fetcher (singleton) → Authenticator (static) → CURL
5252
- Default country code is "82" (Korea) in BaseMessage
5353
- Timezone hardcoded to Asia/Seoul in Authenticator
5454

55+
## Tidy First Principles
56+
57+
Follow Kent Beck's "Tidy First" principles when making code changes:
58+
59+
**Core Principles:**
60+
- **Separate Structure from Behavior**: Separate structural changes (tidying) and behavioral changes (features) into distinct commits
61+
- **Tidy First**: Tidy related code before making feature changes to improve changeability
62+
- **Small Steps**: Keep tidying work completable within minutes to hours
63+
64+
**Practical Techniques:**
65+
- Use guard clauses for early returns to eliminate nested if statements
66+
- Use helper variables/functions to clarify complex expressions
67+
- Keep related code physically close together
68+
- Express identical logic in identical ways (normalize symmetry)
69+
- Delete unused code immediately
70+
71+
**When to Apply:**
72+
- Before adding new features, tidy the affected area
73+
- Before fixing bugs, clarify related code
74+
- During code review, identify tidying opportunities
75+
5576
## Important Behaviors
5677

5778
- **Singleton State:** Fetcher singleton retains credentials - don't mix different API keys in the same process

0 commit comments

Comments
 (0)