refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조

에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Antigravity Agent
2026-07-11 11:05:56 +09:00
parent 6549ead309
commit c24165b8bc
6193 changed files with 1717 additions and 31 deletions
@@ -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 |