단원 — Karpathy 4 원칙 (Think · Simplicity · Surgical · Goal-Driven)
별칭: karpathy 4 principles · think-simplicity-surgical-goal · 65-line claudemd
요약
entity/karpathy 의 2026-01-26 viral thread 를 entity/forrest-chang 가 65 줄 CLAUDE.md 로 정립. 4 원칙 = LLM 코딩 실수 방지 매니페스토. case/karpathy-109k-stars 의 지적 본체.
★ Karpathy 의 3 LLM 실패 모드 (영문 직접 인용)
| # | 영문 원문 | 대응 원칙 |
|---|---|---|
| 1 | "The models make wrong assumptions on your behalf and just run along with them without checking." | Think Before Coding |
| 2 | "overcomplicate code and APIs, bloat abstractions" | Simplicity First |
| 3 | "They still sometimes change/remove comments and code they don't sufficiently understand." | Surgical Changes |
| 4 | "LLMs are exceptionally good at looping until they meet specific goals." | Goal-Driven Execution |
원칙 1 — Think Before Coding
표어: "Don't assume. Don't hide confusion. Surface tradeoffs."
- 가정을 명시적으로 진술
- 불확실하면 질문
- 여러 해석이 있으면 제시
- 더 단순한 방식이 있으면 언급
원칙 2 — Simplicity First
표어: "Minimum code that solves the problem. Nothing speculative."
- 요청된 기능만 구현
- 단일 용도 코드에 추상화 ❌
- 불가능한 시나리오 오류 처리 ❌
- "200줄이 50줄로 가능하면 다시 쓸 것"
원칙 3 — Surgical Changes
표어: "Touch only what you must. Clean up only your own mess."
- 인접 코드·주석·포맷 개선 ❌
- 작동하는 코드 리팩토링 ❌
- 발견한 미사용 코드는 언급만 — 삭제 ❌
- 판단 기준: 변경된 모든 줄 = 사용자 요청과 직접 연결
원칙 4 — Goal-Driven Execution
표어: "Define success criteria. Loop until verified."
| 작업 | 변환 |
|---|---|
| "검증 추가" | 잘못된 입력 테스트 → 통과 |
| "버그 수정" | 재현 테스트 → 통과 |
| "리팩토링 X" | 전후 테스트 통과 |
Karpathy 핵심: "Don't tell it what to do, give it success criteria and let them work."
★ 작동 신호 3
- diff 의 불필요한 변경 ↓
- 과한 복잡화로 인한 재작성 ↓
- 실수 후 가 아니라 시작 전 명확화 질문 ↑
트레이드오프 (Karpathy 명시)
"These guidelines bias toward caution over speed. For trivial tasks, use judgment."
강의 활용
- Ch7 — 본 단원 전체 활용. 4 원칙 + 영문 직접 인용 + 작동 신호.
- 권장 배치: 전역 CLAUDE.md (
~/.claude/CLAUDE.md).