本文由 AI 分析生成
建立時間: 2026-05-25 來源: https://x.com/Mnilax/status/2053116311132155938
Summary
Forrest Chang’s 4-rule CLAUDE.md (derived from Karpathy’s January 2026 complaints about Claude’s coding failures) achieved 120,000 GitHub stars by reducing mistake rates from ~41% to ~11%. After testing across 30 codebases over 6 weeks, this author added 8 more rules targeting failure modes specific to May 2026’s agentic, multi-step workflows that didn’t exist when Karpathy wrote his thread. The combined 12-rule template brings mistake rate to 3% with minimal compliance overhead (76% vs 78% for 4 rules alone).
由 Karpathy 的抱怨演變而來的 4 條 CLAUDE.md 規則使錯誤率從 41% 降至 11%,並獲 12 萬 GitHub 星。作者跨 30 個代碼庫測試 6 週後新增 8 條規則,針對 2026 年 5 月代理工作流特有的失效模式,最終使錯誤率降至 3%。
Key Points
- Original 4 rules: Think Before Coding (state assumptions), Simplicity First (minimum code), Surgical Changes (touch only what you must), Goal-Driven Execution (define success criteria, iterate until verified)
- 8 added rules: Use model only for judgment calls (not routing/retries), Hard token budgets (4k/task, 30k/session), Surface conflicts don’t average them, Read before you write, Tests verify intent not just behavior, Checkpoint after every significant step, Match codebase conventions, Fail loud
- Key finding: compliance drops sharply past 200 lines; testing 18 rules dropped compliance from 76% to 52%
- Anti-patterns: vague directives (“be careful”), identity prompts (“be senior”), examples instead of rules (heavier, Claude overfits), tooling-dependent rules
- “Fail loud” rule addresses the most expensive failure mode: silent successes hiding silent failures (migration “completed” but skipped 14% of records)
Insights
The compliance ceiling at ~200 lines means CLAUDE.md must be curated, not accumulated — every rule must earn its place by mapping to a real observed failure mode. The gap between thinking and doing (why identity prompts fail) explains why imperative behavioral rules outperform aspirational ones. Rule 12 (Fail loud) is the most non-obvious: “completed successfully” is dangerous language in agentic contexts where partial failures are common and silent.
Connections
Raw Excerpt
CLAUDE.md is not a wishlist. It’s a behavioral contract that closes specific failure modes you’ve observed. Every rule should answer: what mistake does this prevent?