docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
---
|
||||
id: wiki-2026-0508-보이스카우트-규칙-boy-scout-rule
|
||||
title: 보이스카우트 규칙 (Boy Scout Rule)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Boy Scout Rule, Campsite Rule, Leave It Better, 점진적 개선]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [clean-code, refactoring, software-craftsmanship, principles]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: language-agnostic
|
||||
framework: refactoring
|
||||
---
|
||||
|
||||
# 보이스카우트 규칙 (Boy Scout Rule)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 check in 한 코드 의 check out 한 코드 보다 cleaner 의 leave."**. Robert C. Martin (*Clean Code*, 2008) 의 popularize — 매 boy scout motto "leave the campsite cleaner than you found it" 의 software 의 apply. 2026 modern context 는 매 LLM-assisted refactor (Claude, Cursor) 의 cost 의 dramatic 의 lower — 매 rule 의 practice 의 ever-easier.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 핵심 아이디어
|
||||
- 매 touch 한 file 에 매 small improvement.
|
||||
- 매 variable rename · dead code 의 delete · 매 magic number 의 const · 매 function 의 split.
|
||||
- 매 commit 의 scope 의 keep small — 매 unrelated cleanup 의 separate commit.
|
||||
|
||||
### 매 왜
|
||||
- **Entropy 와 fight**: 매 code 의 자연 의 decay — 매 active counter-force 의 필요.
|
||||
- **Compound interest**: 매 small fix × N developer × M commit = 매 substantial improvement.
|
||||
- **Cognitive load 의 lower**: 매 next reader 의 효과.
|
||||
|
||||
### 매 응용
|
||||
1. 매 PR 의 작은 cleanup 의 같이 include (그러나 main change 의 separate commit).
|
||||
2. 매 LLM 의 통한 매 mechanical refactor 의 batch.
|
||||
3. 매 lint/format 의 pre-commit 의 enforce — 매 baseline 의 raise.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 매 commit 의 separate (git)
|
||||
```bash
|
||||
# Main change
|
||||
git add src/feature.ts
|
||||
git commit -m "feat: add export to PDF"
|
||||
|
||||
# Boy scout cleanup
|
||||
git add src/utils.ts # 매 touched file 의 cleanup
|
||||
git commit -m "refactor: extract date formatter, rename ambiguous vars"
|
||||
```
|
||||
|
||||
### 매 magic number 의 const 의 promote
|
||||
```typescript
|
||||
// Before
|
||||
if (user.failedAttempts > 5) lockout(user);
|
||||
|
||||
// After
|
||||
const MAX_FAILED_LOGIN_ATTEMPTS = 5;
|
||||
if (user.failedAttempts > MAX_FAILED_LOGIN_ATTEMPTS) lockout(user);
|
||||
```
|
||||
|
||||
### Dead code 의 delete (with tooling)
|
||||
```bash
|
||||
# TypeScript — ts-prune
|
||||
npx ts-prune | grep -v "(used in module)"
|
||||
|
||||
# Python — vulture
|
||||
vulture src/ --min-confidence 80
|
||||
```
|
||||
|
||||
### 매 long function 의 extract
|
||||
```python
|
||||
# Before — 매 80-line function
|
||||
def process_order(order):
|
||||
# validate
|
||||
if not order.items: raise ...
|
||||
if order.total < 0: raise ...
|
||||
# apply discount
|
||||
...
|
||||
# charge
|
||||
...
|
||||
|
||||
# After
|
||||
def process_order(order):
|
||||
_validate(order)
|
||||
discounted = _apply_discount(order)
|
||||
return _charge(discounted)
|
||||
```
|
||||
|
||||
### 매 LLM-assisted batch refactor
|
||||
```bash
|
||||
# Cursor / Claude Code — 매 file 의 select 후
|
||||
# "매 magic number 의 const 의 extract, 매 var 의 const 의 promote, 매 docstring 의 add"
|
||||
```
|
||||
|
||||
### Pre-commit hook (ratchet)
|
||||
```yaml
|
||||
# .pre-commit-config.yaml
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.5.0
|
||||
hooks: [{ id: ruff, args: [--fix] }]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: complexity-check
|
||||
entry: radon cc -n C src/
|
||||
language: system
|
||||
```
|
||||
|
||||
### 매 TODO/FIXME 의 ticket 의 promote
|
||||
```bash
|
||||
# 매 grep 의 FIXME 의 collect → 매 issue tracker 의 file
|
||||
rg -n "FIXME|HACK|XXX" --json | jq -r '.data.lines.text'
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| 매 typo · rename · dead code | 매 fix on sight |
|
||||
| 매 architectural smell | Ticket 의 file — 매 separate effort |
|
||||
| 매 PR 매 already large | Cleanup 의 follow-up PR 의 defer |
|
||||
| 매 hot path performance | Benchmark first — 매 cleanup 의 not change behavior 의 verify |
|
||||
| 매 legacy code 의 untested | Test 의 add first → 매 then refactor |
|
||||
|
||||
**기본값**: 매 touch 했으면 매 5분 cleanup 의 add — 매 separate commit, 매 PR description 의 mention.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Clean_Code]]
|
||||
- 응용: [[Refactoring_Best_Practices|Refactoring]] · [[Code_Review]] · [[Technical_Debt]]
|
||||
- Adjacent: [[YAGNI]] · [[Single_Responsibility]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 file 의 read 한 후 매 "이 file 의 small improvement 5개 의 suggest" — 매 LLM 의 human eye 보다 빠르게 spot.
|
||||
**언제 X**: 매 critical path · 매 high-stakes module — 매 unintended behavior change 의 risk.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Big bang refactor**: 매 PR 매 unrelated cleanup × 50 — 매 review 의 impossible.
|
||||
- **Drive-by style change**: 매 team convention 의 무시 한 personal preference.
|
||||
- **Cleanup commit 매 mix**: 매 main change 와 cleanup 의 same commit — 매 git blame 의 noise.
|
||||
- **Test 의 break**: 매 cleanup 의 behavior 의 change — 매 test 의 guard.
|
||||
- **Scope creep**: 매 5분 cleanup 매 2시간 rabbit hole — stop · ticket · commit.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Robert C. Martin *Clean Code* ch1; Kent Beck *Tidy First?* 2024).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — patterns, LLM-assisted refactor, anti-patterns |
|
||||
Reference in New Issue
Block a user