Files
2nd/10_Wiki/Topics/Domain_Programming/AI_and_ML/코드베이스 읽기 지식.md
T
Antigravity Agent c24165b8bc 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>
2026-07-11 11:05:56 +09:00

5.8 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-코드베이스-읽기-지식 코드베이스 읽기 지식 10_Wiki/Topics verified self
Codebase Reading
Code Comprehension
코드 읽기
none A 0.9 applied
code-reading
comprehension
onboarding
software-engineering
2026-05-10 pending
language framework
Polyglot Any

코드베이스 읽기 지식

매 한 줄

"매 code 읽기 = 매 entry point → 매 data flow → 매 state mutation 의 매 trace". 매 senior engineer 가 매 unfamiliar repo 에 매 30분 안 에 매 mental model 을 매 구축 하는 매 능력 의 매 backbone — 매 entry point 식별, 매 data shape 추적, 매 boundary 파악, 매 test 의 매 활용. 매 2026 의 매 LLM (Claude Opus 4.7, GPT-5) 은 매 powerful assistant 이지만 매 humans 가 매 framing 을 매 driver.

매 핵심

매 4-step approach

  1. 매 Entry point 식별 — main(), index.ts, route handler, CLI command.
  2. 매 Data shape 추적 — type / schema / DB model 의 매 핵심 entity.
  3. 매 Boundary 파악 — module / service / network / DB의 매 split.
  4. 매 Test 활용 — 매 의도 의 매 executable spec.

매 도구

  • 매 LSP / IDE: go-to-definition, find-references, call-hierarchy.
  • 매 Search: ripgrep, ast-grep, sourcegraph, GitHub code search.
  • 매 Git: blame, log -S "", bisect.
  • 매 LLM: Claude Opus 4.7 of Cody / Cursor / Continue 의 매 codebase context.
  • 매 Visualization: dependency-cruiser, madge.

매 응용

  1. 매 onboarding (new repo 의 매 30min mental model).
  2. 매 bug 추적 (root cause).
  3. 매 refactor / migration 계획.
  4. 매 security review.

💻 패턴

Pattern 1: 매 Entry Point 매핑

# 매 Node.js
cat package.json | jq '.main, .scripts'
# → 매 index.ts? bin/cli.ts? server.ts?

# 매 Python
grep -r "if __name__" --include="*.py" | head
cat pyproject.toml | grep -A2 "scripts"

# 매 Go
grep -r "func main" --include="*.go"

Pattern 2: 매 Data Shape Discovery

# 매 Type / interface 의 매 enumerate
rg "^(export\s+)?(interface|type|class|struct)\s+\w+" -t ts -t go -t rust

# 매 DB schema
find . -name "schema.prisma" -o -name "*.sql" -path "*migration*"

# 매 OpenAPI / GraphQL
find . -name "openapi.yaml" -o -name "*.graphql"

Pattern 3: 매 Call Hierarchy via ast-grep

# 매 ast-grep 으로 매 specific call 의 매 추적
ast-grep --pattern 'fetch($URL)' --lang ts

# 매 React component usage
ast-grep --pattern '<UserCard $$$/>' --lang tsx

Pattern 4: 매 Git Archaeology

# 매 매 phrase 가 매 언제 매 들어왔나
git log -S "calculatePrice" --source --all

# 매 매 함수 의 매 history
git log -L :calculatePrice:src/pricing.ts

# 매 매 file 의 매 contributor
git shortlog -sn -- src/pricing.ts

Pattern 5: 매 Dependency Graph

# 매 dependency-cruiser
npx dependency-cruiser --output-type dot src | dot -Tsvg > deps.svg

# 매 madge — 매 circular dep
npx madge --circular --extensions ts,tsx src/

Pattern 6: 매 Test-First Reading

# 매 test 가 매 의도 의 매 spec — 매 implementation 전 에 매 test 부터
find . -path "*test*" -name "*.test.ts" | head
# 매 read describe / it 의 매 outline → 매 module purpose 파악

Pattern 7: 매 LLM-Assisted (Claude Opus 4.7)

// 매 Cursor / Cody / Continue 에 매 context 제공:
// "매 Read src/payment/*.ts and explain the entry point + main data flow.
//  매 List the top 5 functions by call frequency.
//  매 Identify any cross-module side effects."

// 매 LLM 의 매 strength: 매 fast summary, 매 pattern recognition.
// 매 LLM 의 매 weakness: 매 long-tail bug, 매 implicit assumption — 매 verify with test.

매 결정 기준

상황 Approach
매 First contact README → entry point → top-level routes
매 Bug hunt Failing test 부터, git bisect, log -S
매 Refactor planning dependency-cruiser, find-references
매 Security review Input boundary (network, file, env), trust traversal
매 LLM 활용 Claude Opus 4.7 의 매 codebase context for summary

기본값: 매 entry → 매 data shape → 매 test → 매 LLM 의 4-step.

🔗 Graph

🤖 LLM 활용

언제: 매 unfamiliar repo onboarding, 매 large refactor planning, 매 cross-module dependency mapping, 매 bug root cause hypothesis. 언제 X: 매 trivial change (1줄 fix), 매 매 own 의 매 maintained file, 매 highly proprietary codebase 의 매 LLM 외부 전송 금지.

안티패턴

  • 매 line-by-line 처음 부터: 매 mental model 의 매 부재 — 매 6시간 후 도 매 lost.
  • 매 implementation-first (test 무시): 매 의도 misunderstand.
  • 매 LLM 의 매 blind trust: 매 hallucinated function / file path 의 매 무비판 수용.
  • 매 dependency graph 의 매 무시: 매 circular dep 의 매 hidden cost.
  • 매 git log 의 매 unused: 매 "왜 이렇게 되었나" 의 매 history 의 매 답.

🧪 검증 / 중복

  • Verified (Code Reading by Diomidis Spinellis, GitHub repo onboarding studies, Sourcegraph engineering blog 2026).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — codebase reading 4-step + 도구 정리