商业产业 Hacker News AI 2026-08-25T04:21 正文 ok 883 words

🔶 AI 编程时代,代码可维护性大幅下滑

英文标题:🔶 Code maintainability plummets in the AI coding era

GitClear 与 GitKraken 对 2023 至 2026 年间 6.23 亿次真实代码变更的分析显示,AI 辅助提交已占全部提交的四分之一,同时多项可维护性指标恶化。与 AI 普及前相比,代码重复度上升 81%,对既有代码的重构和复用活动下降 70%,遗留代码重构自 2023 年以来下降 74%。研究还发现,AI 生成代码中用于掩盖而非诊断错误的模式增加 47%,可能导致技术债累积、应用架构变浅以及难以理解的用户行为。对开发团队而言,这意味着需要加强 AI 输出审查、持续监测错误掩盖模式,并将遗留系统维护重新纳入工程治理重点。
打开原文相关 3 · 机会 0
media23.0 KB media71.5 KB media9.4 KB media3.3 KB media4.9 KB media7.7 KB media50.0 KB

中文

预计阅读时间:4 分钟

核心要点:

  • AI 编程正在让代码库膨胀。代码重复率上升 81%,代码复用率下降 70%。
  • AI 正在掩盖错误,而不是修复错误:捕获错误却不评估其原因的代码增加了 47%,由此产生架构浅层、用户行为令人困惑的应用。
  • 遗留代码正被逐渐弃置。自 2023 年以来,遗留代码重构下降了 74%;开发者更倾向于构建新功能,而非维护既有代码。

如果你是一名 2026 年的开发者,你很可能已在日常工作流中使用大语言模型(LLM)。尽管 Agent 式编程工具能够创造惊人的效果,但其输出往往违背“不要重复自己”(DRY)这一软件开发核心原则。DRY 原则要求:系统中的每一项知识都必须只有一个明确且权威的表示。

GitClear 和 GitKraken 的研究分析了 2023 年至 2026 年间 6.23 亿次真实世界代码变更,并揭示了 AI“接管”前后代码提交形态的一些令人警醒的数据。

该研究发现,AI 辅助提交已占全部提交的四分之一;与此同时,在八项与可维护性相关的代码质量指标中,技术债均呈上升趋势。

最明确的信号是:代码复用相较于 AI 普及前的水平显著下降,表明行业正在远离共享库的做法。

GitClear CEO、该报告作者 Bill Harding 表示:“每当你想要某项功能时,AI 都会为它新建一个包。这种通用的构建方式会带来各种后果。”

代码重复正在增加

与 AI 普及前相比,代码重复增加了 81%。在这项研究中,重复被定义为连续出现五行或更多有意义的重复代码。

Harding 表示:“从长期来看,当你意识到同一件事竟然有五种不同实现——它们相似却又各不相同——问题就会开始变得棘手。”

代码复用正在减少

Move(重构)——一种衡量提交对既有代码库进行编辑频率的指标——下降了 70%,表明代码复用正在减少。

除了让代码库膨胀之外,这还可能迫使团队围绕新构建的内容重新开展测试、编写文档并提升代码可理解性。

Harding 补充道:“如果你不共享代码,那么每次重新实现它时,你实际上都在丢弃开发者此前在代码库中取得的全部进展。”

老代码积灰更严重

开发者维护和整合既有系统的频率正在降低。自 2024 年起,与长期更新相关的提交比例呈指数级下降。

GitClear 将这类工作称为“遗留代码重构”:即删除或更新最后一次修改时间超过 12 个月的代码。自 2023 年以来,该指标已下降 74%。

既有代码也越来越少被重新整合进新开发中。功能连接性(functional connectivity)——衡量新提交中编写了多少次对其他函数调用的指标——下降了 35%。

AI 正在掩盖错误

AI的目标是满足提示词要求,但要正确实现一个函数,需要推断可能传入哪些输入,而这会消耗时间和 token。

捷径是什么?无论输入多么不可能出现,都编写永远不会抛出错误的代码。

Harding 解释说:“这种捷径会成为维护者的技术债;他们最终需要判断,哪些错误处理是基于实际原因添加的,哪些只是为了方便 AI 生成代码而加入的。”

GitClear 发现,相对于基准年份,2026 年此类错误掩盖现象增加了 47%。该机构将其称为“混淆”(obfuscation):即 rescue/catch 块、安全导航运算符以及压制意外输入信号的桩方法密度。

Harding 补充道:“AI 强烈倾向于编写不会被标记为缺陷的代码。”结果便是,代码会悄无声息地捕获错误,却不评估其根本原因。

混淆程度逐年上升。Harding 表示,错误抑制的最终表现是:应用更为浅层、深层连接更少,且用户行为变得令人困惑。

指标是否正在趋于平稳?

在2025 年初,GitClear 的研究证实了AI 生成代码膨胀和技术债的上升。随后在2026 年初,他们证明顶尖开发者一直以来都最善于利用 AI,这也微妙地强化了旧有的“10 倍开发者”神话。

其他研究也追踪了 AI 对编程可靠性的影响。例如,Google 的年度 DORA 报告在 2024 年发现,AI 使用量每增加 25%,不稳定性便增加 7.2%。其 2025 年研究和 2026 年 ROI 分析同样指出,AI 使用与不稳定性存在关联。

总体而言,这些趋势指向即将到来的技术债问题。不过,一些信号似乎正在趋于平缓。Harding 表示:“令人鼓舞的是,代码重复没有增长得那么快,而代码变动(churn)也只是略有增加。”

这是否意味着 AI 生成代码的负面影响将最终进入平台期?人们只能希望如此。对于 Harding 来说,情况远未结束。

“更出乎意料的是,这种模式的表现范围如此之广。它不只是代码重复的问题,也关乎人们没有维护遗留代码。”他说。

AI 辅助开发中的漏洞仍在不断出现:从 Moltbook token 泄露,到 Agent 在 Replit 和 PocketOS 删除生产数据库。

未来,管理者应提升对 AI 编程最佳实践的认识,审查输出结果,并衡量常见的混淆模式。Harding 还建议关注更容易产生此类问题的特定 LLM 或初级开发者群体,并及时纠偏。

English / 原文

You have 1 article left to read this month before you need to register a free LeadDev.com account.

Estimated reading time: 4 minutes

Key takeaways:

  • AI coding is bloating codebases. Duplication is up 81%, reuse down 70%.
  • AI hides errors rather than fixing them : code that catches errors without evaluating their cause is up 47%, producing shallow apps with confusing user behavior.
  • Legacy code is being left to rot. Legacy refactoring has fallen 74% since 2023, and developers are building new rather than tending what exists.

If you’re a developer in 2026, you’re most likely using large language models (LLMs) in your flow. While agentic coding tools can work wonders, their output often flies in the face of do not repeat yourself (DRY), a core software development principle stating that every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

GitClear and GitKraken research analyzed 623 million real-world code changes from 2023 to 2026, and discovered some sobering data on the shape of code commits “before” and “after” the AI takeover.

The study found AI-assisted commits make up one quarter of all commits, alongside rising technical debt across eight maintainability-related code quality metrics.

The clearest signal? Code reuse is down significantly from pre-AI levels, marking a shift away from shared libraries.

“Every time you want something, AI creates a new package for it,” says Bill Harding, CEO of GitClear and author of the report. “That general approach to building has all sorts of consequences.”

Your inbox, upgraded.

Receive weekly engineering insights to level up your leadership approach.

Code duplication is in

Compared to pre-AI times, code duplication is up 81%. In this study, duplication was tracked as occurrences of five or more consecutive repeated meaningful lines.

“In the long term it starts to get painful when you realize you have five different implementations of the same thing that are similar yet different,” says Harding.

Code reuse is out

Move (refactor) – a measurement of how often commits edit existing codebases – is down 70%, indicating declining code reuse.

Beyond bloating codebases, this can force teams to rework testing, documentation, and code understandability around new builds.

“If you don’t share code, every time you implement it you’re discarding all the prior progress the developers have made in the repository,” adds Harding.

Old code gets dustier

Developers are maintaining and incorporating past systems less often. The degree of commits related to long-term updates has exponentially dropped since 2024.

GitClear calls this “legacy refactoring;” changes that remove or update code last touched more than 12 months ago. Since 2023, it has fallen 74%.

Pre-existing code is also getting reworked into new development less and less. Functional connectivity – a measure of how many times calls to other functions are programmed into new commits – has fallen by 35%.

AI is hiding errors

AI’s goal is to satisfy a prompt, but implementing a function properly means inferring which inputs might be passed in, which takes time and tokens.

The shortcut? Write code that never throws an error, no matter how unlikely the inputs.

“That shortcut becomes tech debt for the maintainers, who eventually need to ascertain which error handling was added for cause, versus those added for AI expediency,” explains Harding.

GitClear found 47% more of this error masking in 2026 relative to the base year. It calls this obfuscation: the density of rescue/catch blocks, safe-navigation operators, and stubbed methods that squelch unexpected-input signals.

“AI strongly prefers to write code that won’t be labeled as a defect,” adds Harding. The result is code that silently catches errors without evaluating their underlying cause.

Obfuscation has increased year over year. The end manifestation of error suppression? Shallow apps with fewer deep connections, and confusing user behavior, says Harding.

Are metrics plateauing?

In early 2025, GitClear research validated the rise in AI-generated code bloat and technical debt. Later, in early 2026, they proved that top performers were making the most of AI all along, subtly reinforcing the old 10x developer myth.

Other studies have traced AI’s impact on coding reliability. Take Google’s yearly DORA report, which in 2024 found that every 25% of additional AI usage creates 7.2% more instability. Its 2025 research and 2026 ROI analysis also pointed to instability tied to AI usage.

All in all, the trends point to looming technical debt problems. Yet, some signals seem to be flattening. “It’s encouraging that the duplication didn’t increase as much and churn only somewhat,” says Harding.

Could this see the final plateau of the downsides of AI-generated code? One can only hope so. For Harding, it’s far from over.

LDX3 New York is live

New York • September 15 & 16, 2026

Don’t figure it out alone. Learn what works at LDX3 New York.

“What’s less expected is how broad this pattern manifests itself. It’s not just duplication, it’s about not tending to legacy code,” he says.

Bugs in AI-assisted development keep cropping up, from the Moltbook token leak to agents deleting production databases at Replit and PocketOS.

Going forward, leaders should build awareness of AI-coding best practices, review outputs, and measure common obfuscation patterns. Harding also recommends keeping an eye on certain LLMs or junior cohorts that are more prone to producing these faults, and course-correcting.