We are entering a hybrid era in which human developers and AI coding agents work in the same codebases. While industry practice has long optimized code for human comprehension, it is increasingly important to ensure that LLMs with different capabilities can edit code reliably. In this study, we investigate the concept of ``AI-friendly code'' via LLM-based refactoring on a dataset of 5,000 Python files from competitive programming. We find a meaningful association between CodeHealth, a quality metric calibrated for human comprehension, and semantic preservation after AI refactoring. Our findings confirm that human-friendly code is also more compatible with AI tooling. These results suggest that organizations can use CodeHealth to guide where AI interventions are lower risk and where additional human oversight is warranted. Investing in maintainability not only helps humans; it also prepares for large-scale AI adoption.
翻译:我们正步入一个混合时代,人类开发者与AI编码助手将在同一代码库中协同工作。尽管业界实践长期以来一直为人类理解而优化代码,但确保具备不同能力的LLM能够可靠地编辑代码正变得日益重要。本研究通过对竞争性编程中5,000个Python文件进行基于LLM的重构,深入探讨了"AI友好型代码"的概念。我们发现,专为人类理解校准的代码质量指标CodeHealth与AI重构后的语义保持之间存在显著关联。研究结果证实,对人类友好的代码同样与AI工具更具兼容性。这些发现表明,组织可利用CodeHealth来指导哪些区域的AI介入风险较低,哪些区域需要额外的人工监督。投资于代码可维护性不仅对人类有益,也为大规模AI应用做好了准备。