arXiv:2604.26615cs.SEcs.AI2026-04被引 1

用提示工程实现AI代码生成的测试驱动治理,提升稳定性与可复现性。

TDD Governance for Multi-Agent Code Generation via Prompt Engineering

论文配图:TDD Governance for Multi-Agent Code Generation via Prompt Engineering
图 1 · 摘自论文原文
  • 将TDD原则转化为分阶段的提示与流程约束机制。
  • 通过验证门禁和原子修改控制,实现稳定可复现的代码生成。
  • 适合追求高质量、可审计AI辅助开发的工程师与团队。

大型语言模型(LLMs)加速软件开发,但在无约束工作流中常表现出不稳定性、非确定性和对开发规范的弱遵循。尽管测试驱动开发(TDD)提供红-绿-重构的结构化流程,现有基于LLM的方法通常仅将测试作为辅助输入,而非可执行的流程约束。本文提出一种原生面向AI的TDD框架,将经典TDD原则形式化为提示级与工作流级的治理机制。提取的原则被编纂为机器可读宣言,并分布于规划、生成、修复和验证各阶段的分层架构中,实现模型提议与确定性引擎权威的分离。系统强制执行阶段顺序、有限修复循环、验证门禁和原子变异控制,显著提升稳定性与可复现性。我们描述了该架构,并讨论将软件工程规范直接嵌入提示编排的可行性,认为这是可靠LLM辅助开发的有前景方向。

原文摘要 · Abstract (English)

Large language models (LLMs) accelerate software development but often exhibit instability, non-determinism, and weak adherence to development discipline in unconstrained workflows. While test-driven development (TDD) provides a structured Red-Green-Refactor process, existing LLM-based approaches typically use tests as auxiliary inputs rather than enforceable process constraints. We present an AI-native TDD framework that operationalizes classical TDD principles as structured prompt-level and workflow-level governance mechanisms. Extracted principles are formalized in a machine-readable manifesto and distributed across planning, generation, repair, and validation stages within a layered architecture that separates model proposal from deterministic engine authority. The system enforces phase ordering, bounded repair loops, validation gates, and atomic mutation control to improve stability and reproducibility. We describe architecture and discuss encoding software engineering discipline directly into prompt orchestration, which we think offers a promising direction for reliable LLM-assisted development.

代码生成TDD提示工程AI治理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。