请问HN:你们是如何在大型混乱的遗留代码库中使用AI代码助手的?
我的公司开始探索人工智能编程。我是一名拥有20多年经验的开发人员,负责帮助公司了解如何利用这一工具。我只使用过Claude,因此我的经验仅限于此。
正如你可能猜到的,我发现人工智能在某些方面非常出色,而在其他方面则表现得相当糟糕。我所阅读的许多内容和观看的演示都与合理的代码库有关。然而,我们的代码库并不合理。它已有超过20年的历史,由多位不同的开发人员编写,风格、设计模式各异……这正是一个小公司经过数十年缓慢发展所能预期的情况。我还在医疗领域工作,因此缓慢演变的旧代码库是常态。
人工智能不断失败的原因之一是它无法理解整个代码库的上下文。它无法在每个会话中保持这种上下文。因此,除非有一位熟悉系统的技术开发人员进行指导,否则它会主动向系统添加冗余内容。我在尽可能的情况下使用记忆功能,但它必须定期读取大量代码,这会消耗很多令牌。我在专业账户上经常达到使用限制。
你对此有什么经验吗?有没有提高输出和降低成本的技巧或建议?任何帮助都非常感谢。谢谢!
查看原文
My company is starting to explore AI coding. I am a dev with 20+ years of experience and I am tasked with trying to help see how we can use this tool to help our company. I have only used Claude so my experience is limited to that.<p>As you might guess, I find AI to be extremely good at some things and actively terrible at others. A lot of the things I read and demos I watch all have to do with reasonable code bases. Our code base is not reasonable. It's over 20 years old, coded by a multitude of different developers with different coding styles, design patterns, etc... What you would expect from a small company that has been slowly growing for decades. I also work in the medical field so slow evolving old code bases are the norm.<p>One of the reasons the AI fails constantly is that it has no context of the entire code base. It simply can't keep that context in scope for every session. So it actively adds bloat to the system unless it's guided by a skilled developer who already knows the system. I am using memories where I can but it has to regularly read huge chunks of code and that uses a lot of tokens. I regularly hit my limit on a Pro account.<p>What are your experiences with this? Any tips or tricks to improve output and cost? Any help is most appreciated. Thanks!