Install
openclaw skills install precise-coding-principles编程原则技能,源于 Andrej Karpathy 的 LLM 编程四大通病与核心原则。 Use when: (1) writing or reviewing code, (2) user asks to build/create/refactor a feature, (3) code is becoming over-engineered, (4) unsure about what to implement and should ask first, (5) any non-trivial coding task. Not for: one-liner fixes, obvious typos. This skill keeps coding precise, minimal, and goal-driven.
openclaw skills install precise-coding-principlesLLM coding四大通病:
不假设、不藏困惑、主动暴露权衡。
用最少的代码解决问题。不做 speculative 的事。
只碰该碰的。只清理自己造成的垃圾。
定义成功标准,循环直到验证通过。
把命令式任务变成可验证的目标:
| 而不是... | 变成... |
|---|---|
| "修这个 bug" | "写一个能复现它的测试,然后让它通过" |
| "添加验证" | "写无效输入的测试,然后让它们通过" |
| "重构 X" | "确保重构前后测试都通过" |
| 任务类型 | 是否启用完整流程 |
|---|---|
| 简单 typo 修复 | ❌ 直觉判断 |
| 明显 one-liner | ❌ 直觉判断 |
| 新功能/复杂重构 | ✅ 完整四原则 |
| 不确定用户意图 | ✅ Think Before Coding |
| 代码突然变得很复杂 | ✅ Simplicity First |
| 要改多个文件 | ✅ Surgical Changes |
| Bug 修复 | ✅ Goal-Driven Execution |
详细原则与案例:见 references/karpathy-principles.md