Eight years of wanting, three months of building with AI
作者:Lalit Maganti (Google Perfetto维护者)
来源:lalitm.com + Hacker News (526 points)
核心观点
这是目前最系统、最诚实的AI编程实战复盘。作者是Google工程师,用AI构建了一个真正的SQLite解析器/格式化器项目syntaqlite。
AI帮助了什么
- 克服惯性:AI把"我需要理解SQLite解析"这样的抽象问题,变成"让AI给我一个方法"的具体问题
- 代码生成速度:对于明显的代码,AI写得比作者快,且风格一致、文档完整
- 重构能力:AI擅长大规模重构(但需要频繁重构,否则代码会失控)
- 研究助手:压缩"一天两天"的阅读为"一次对话",比如Wadler-Lindig漂亮打印算法
- 跨领域迁移:C++/Android专家用AI在1小时内写出VS Code扩展
- 最后的里程:编辑器扩展、Python绑定、WASM playground、文档网站——AI让这些"重要但不紧急"的功能变得可行
AI在哪里失败了
- vibe-code陷阱:1月份完全委托AI的代码在1月底变成"complete spaghetti",不得不重写
- 标准化的诅咒:AI偏好"标准方言",但项目的价值来自"非 obious"的部分(提取管道、解析器架构)
- 需要人类判断力的地方:架构决策、大规模抽象、核心设计——这些AI无法看到
- 上下文获取:代码review时AI会"发明"不存在的bug或忽略真实的问题
关键模式
1. 从vibe-code到"autocomplete on steroids"
"More importantly, I completely changed my role in the project. I took ownership of all decisions and used it more as 'autocomplete on steroids' inside a much tighter process: opinionated design upfront, reviewing every change thoroughly, fixing problems eagerly as I spotted them, and investing in scaffolding..."
2. 必须投资于脚手架
没有自动检查,AI输出会很快失控:
- linting
- 验证
- "non-trivial testing"
3. refactoring是核心工作流
"after every large batch of generated code, I'd step back and ask 'is this ugly?' Sometimes AI could clean it up. Other times there was a large-scale abstraction that AI couldn't see but I could..."
时间线
- 12月:决定用AI构建syntaqlite
- 1月:vibe-code模式 → 代码变成spaghetti
- 1月底:决定重写 + 切换到Rust
- 2月:核心功能完成
- 3月中:0.1版本发布
结论
AI是强大的加速器,但不是替代品。关键:
- 人类做架构决策,AI执行
- 频繁重构 + 自动检查
- ownership of all decisions
- 投资脚手架(linting, testing, validation)
没有AI,这个项目不会存在;没有人类决策,AI构建的东西无法维护。