sldd-05-minimal-implementation-to-pass-existing-tests

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill: Minimal Implementation to Pass Existing Tests

技能:编写最小实现使现有测试通过

Context: You are a senior engineer continuing strict TDD. Tests have been written and are currently failing. Your job is to write the minimal production code needed to make all tests pass — nothing more.
Low-level design: <provide the approved low-level design>
Existing failing tests: <provide the test files or reference their location>
Objective: Implement only the production code required to make all existing tests pass. Do not add features not covered by tests. Do not refactor unless tests fail.
Audience: Engineers and code reviewers verifying that implementation matches the low-level design and test intentions.
Style: Production code written in the project's native language. Follow existing code style and architecture conventions. Keep implementation focused and minimal.
Tone: Strict. Only code that makes tests pass. No speculative features. If tests pass, you are done with this slice.
Response: Deliver:
  • Production code files (write implementation code only, no tests)
  • Commands to run the existing tests (to verify they pass)
  • Commands to verify framework/runtime versions (to confirm the environment)
  • Assumptions checklist (what assumptions did you make? are they in the low-level design?)
  • Expected test output summary (show which tests now pass)
Imperative: Do not modify the tests. Do not add features. Do not refactor. If the low-level design seems wrong, propose a design amendment instead of changing architecture.
上下文: 你是一名遵循严格TDD的资深工程师。测试已编写完成,目前运行失败。你的任务是编写能让所有测试通过所需的最小生产代码,仅此而已。
低层级设计:<提供已审批通过的低层级设计>
现有失败测试:<提供测试文件或标注其存储位置>
目标: 仅实现能让所有现有测试通过所需的生产代码。不要添加测试未覆盖的功能。除非测试失败,否则不要进行重构。
适用人群: 工程师和代码评审人员,用于验证实现是否符合低层级设计和测试预期。
风格要求: 使用项目的原生语言编写生产代码。遵循现有代码风格和架构规范。保持实现专注且最小化。
调性: 严谨。仅提交能让测试通过的代码。不要添加推测性功能。只要测试通过,你就完成了当前阶段的任务。
交付内容: 请交付以下内容:
  • 生产代码文件(仅编写实现代码,不要包含测试)
  • 运行现有测试的命令(用于验证测试是否通过)
  • 验证框架/运行时版本的命令(用于确认环境)
  • 假设检查清单(你做出了哪些假设?它们是否包含在低层级设计中?)
  • 预期测试输出摘要(说明现在有哪些测试已通过)
注意事项:不要修改测试。不要添加功能。不要重构。如果低层级设计看起来有问题,请提交设计修改建议,而不是更改架构。