有人让遗留代码库对 AI 编码助手更具可读性吗?

2 分•作者: iacobandrei•10 天前
快速摘要:你是否曾优化过遗留代码/vibe 代码库以提高 AI 驱动的开发结果,并避免修复一个 bug 导致出现另外两个 bug?我想听听你的经验。 首先,一些背景。大约 7 个月前,我加入了这家(现已成立)2 年的初创公司,成为第一位工程师。代码库最初是由我们的低层 CTO 构建的一个可爱的 MVP。一个月前,我们招聘了第二位开发人员,我们正在进一步扩大我们的工程团队,并为我晋升为 Staff 工程师做准备。 现在,正如你可能预料到的那样,代码库是一团糟,因为我们只是在第一个 MVP 的基础上进行构建,而且完全没有文档。我在代码库中发现的主要问题是: * 重复的业务逻辑 → 没有单一事实来源/关注点分离不佳。 * 僵尸表和列 → 累积的模式/结构债务,其中大部分看起来是对的,但实际上并非如此。 * 我们手动跟踪下游影响,因为一切都以最混乱的方式分散和重复 → 隐含依赖、隐含架构和高变更耦合。在这里改变一个东西也需要在那里和那里改变(这主要可以通过代码库图索引器来修复)。 现在,为了不让你感到厌烦,我发现了一个介于速度和可靠性之间的最佳解决方案:为整个代码库进行适当的文档记录,并将其有效地存储为我们 AI 代理的“知识数据库”,这样它们至少能够了解已知的差距、约束、决策、业务逻辑、在哪里可以更改某物以及变更的原因和结果。 最接近且最有趣的文章,处理的是这个确切的问题,是这篇来自 Meta 的文章,我希望从这里开始我的方法。 现在我在这里询问的是一些类似的经验,其他初创公司的工程师是否经历过类似的方法,他们的方法、经验、结果是什么,以及关于我应该避免或注意的事项的任何建议。 任何帮助都将不胜感激。
查看原文
Quick Summary: Did you ever optimize a legacy&#x2F;vibe-coded codebase to improve AI driven development results and avoid fixing a bug for 2 more to appear? i want to hear what your experience was.<p>First, some context. ~7 months ago i was the first Engineering hire at a ( now ) 2 years old startup. The codebase started as a Lovable MVP built by our low level CTO, one month ago we hired a second dev and we are further expanding our engineering team and preparing the terrain for me to move to Staff. Now as you probably expected, the codebase is a mess since we simply built on top of the first MVP, of course with zero documentation, the main problems i identified in our codebase: - Duplicated business logic → no single source of truth &#x2F; poor separation of concerns. - Zombie tables and columns → accumulated schema&#x2F;structural debt, most of them look right, they are not - We manually track downstream effects since everything is scattered and duplicated in the most confusing way → implicit dependencies, implicit architecture and high change coupling. Changing a thing here also needs changing there and there ( this is mainly fixable by a codebase graph indexer )<p>Now quickly, so you dont get bored, ive identified as the sweet spot solution between speed and reliability to properly document the whole codebase and store that efficiently as a &#x27;knowledge database&#x27; for our AI agents, so they are at least aware of the known gaps, constraints, decisions, business logic, where else to change something and the causes and effects of changes.<p>The closest and most interesting article that treats this exact issue is this one from Meta, which i want to start my approach from.<p>Now what im asking here is for some similar experiences, other startup engineers that had to go through a similar approach, what was their approach, experience, outcome and any tips on what should i avoid or be aware of.<p>Any help will be much appreciated