iterate-tdd
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIterate TDD
迭代 TDD
Keep an existing Technical Design Document (TDD) aligned with the latest decisions and repository reality. Work in lockstep with the user: resolve one design decision, repaint the affected design, report it, and stop.
使现有技术设计文档(TDD)与最新决策和代码仓库实际情况保持一致。与用户紧密协作:解决一个设计决策,重绘受影响的设计,汇报结果,然后停止。
Operating contract
操作约定
- Ask exactly one question per message. A choice among two or three options is one question; independent decisions are separate turns.
- Treat pushback, thinking aloud, and questions from the user as discussion. A decision is resolved only when the user accepts a direction or the evidence makes the disposition explicit.
- Edit only after resolution. Repaint the affected section into a coherent design; keep feedback threads, decision logs, and patch chronology out of the design narrative.
- Verify claims about existing behavior, files, interfaces, or conventions before using them. User feedback is an input, not automatically repository fact.
- Keep System Design and Program Design distinct, then reconcile their shared names, boundaries, contracts, and flows.
- After one incorporated decision or one answered question, stop for user direction.
- 每条消息恰好提出一个问题。在两三个选项中选择也算一个问题;相互独立的决策应分轮处理。
- 将反对意见、思考过程和用户提问视为讨论。只有当用户接受某个方向,或证据明确表明处置结果时,决策才算已解决。
- 仅在决策解决后编辑。将受影响章节重写为连贯的设计;设计叙述中不要保留反馈线程、决策日志和补丁变更记录。
- 在采用关于现有行为、文件、接口或惯例的说法之前,先进行验证。用户反馈是输入,不自动等同于代码仓库事实。
- 保持系统设计与程序设计彼此区分,然后协调两者共享的名称、边界、契约和流程。
- 每纳入一个决策或回答一个问题后,停止并等待用户指示。
Entry branch
入口分支
If the invocation contains no feedback, comment set, or requested direction, send this and stop:
text
How should we continue the technical design: apply a concrete change, examine
one unresolved decision in depth, or identify the next missing design question?Otherwise classify the turn as direct feedback, artifact comments, continued grilling, or completion. Follow only that branch through the runbook.
如果调用中没有反馈、评论集或指定方向,发送以下内容并停止:
text
How should we continue the technical design: apply a concrete change, examine
one unresolved decision in depth, or identify the next missing design question?否则,将本轮归类为直接反馈、artifact 评论、持续追问或完成。执行手册时只沿对应分支继续。
Runbook
执行手册
1. Establish the complete working set
1. 建立完整工作集
Identify the task directory from the invocation or conversation. If it remains ambiguous, ask one question for the exact task or TDD path and stop.
For , use on the exact directory because it may be a symlink; enumerate that task directory without recursive glob or grep traversal. Read every file in it in full, including the current TDD and any ticket/task, research, design discussion, PRD, mockup, implementation note, or earlier artifact. Read every path or source named in the feedback in full as well.
.agent-work/tasks/<task>/ls -LaBefore processing feedback or comments, read Feedback intake and resolution. It defines the exhaustive source inventory, artifact-comment retrieval branch, separate design/comment states, and the one-decision resolution loop.
This step is complete when every available input is represented in the feedback inventory, the current TDD is identified, and missing or inaccessible inputs are named.
从调用或对话中识别任务目录。如果仍不明确,提出一个关于准确任务或 TDD 路径的问题并停止。
对于 ,由于该目录可能是符号链接,应在准确目录上使用 ;枚举该任务目录时不要使用递归 glob 或 grep 遍历。完整读取其中每个文件,包括当前 TDD,以及任何工单或任务、研究、设计讨论、PRD、mockup、实现说明或早期 artifact。也完整读取反馈中提到的每个路径或来源。
.agent-work/tasks/<task>/ls -La处理反馈或评论前,完整阅读反馈接收与解决。它定义了详尽的来源清单、artifact 评论获取分支、设计与评论的独立状态,以及单决策解决循环。
当所有可用输入都已纳入反馈清单、当前 TDD 已确定,并且缺失或无法访问的输入已列明时,本步骤完成。
2. Verify the active item
2. 验证当前事项
Select the one open item that blocks the most downstream design work. When it asserts repository behavior, requests detail about existing functionality, or depends on an implementation pattern, read Code research and evidence before proposing or editing anything.
Trace the item to every potentially affected surface: component boundary, data/control flow, public contract, persistence/schema, failure behavior, program structure, product behavior, verification, migration, rollout, and backout. Mark a surface not applicable only after checking it.
This step is complete when the active item is supported by cited evidence, established as a product/design choice, or explicitly blocked on one missing fact.
选择阻塞最多下游设计工作的一个未决事项。如果它断言代码仓库行为、要求了解现有功能详情,或依赖某种实现模式,在提出建议或进行任何编辑前,阅读代码研究与证据。
将该事项追踪到所有潜在受影响层面:组件边界、数据或控制流、公共契约、持久化或 schema、失败行为、程序结构、产品行为、验证、迁移、发布和回退。只有检查过后,才能将某个层面标记为不适用。
当当前事项有引用证据支持、已确定为产品或设计选择,或明确因缺少一个事实而受阻时,本步骤完成。
3. Resolve exactly one decision
3. 恰好解决一个决策
For direct feedback, test the requested correction against the evidence and discuss any conflict. For artifact comments, preserve the comment thread's identity and state while resolving its design claim. For continued grilling, find the next unresolved or sparse part of System Design or Program Design without expecting a prewritten question list.
When a decision is still open:
- State one concrete question.
- Offer two or three materially different options and their tradeoffs.
- Recommend one option from repository evidence and upstream requirements.
- Show system-design choices as a focused Mermaid diagram, high-level type, schema, or RPC/API signature; show program-design choices as a call-stack tree, component tree, file-tree diff, dependency-injection map, or method signature.
- Stop and wait.
Answer clarifying questions without editing. Continue the same decision on the next turn until it reaches an explicit disposition.
This step is complete when the item is accepted, accepted with an evidence-backed adjustment, rejected, superseded, or blocked—or when the single question has been sent and the turn has ended.
对于直接反馈,根据证据检验所请求的修正,并讨论任何冲突。对于 artifact 评论,在解决其设计主张时保留评论线程的身份和状态。对于持续追问,找出系统设计或程序设计中下一个未解决或内容稀疏的部分,不要预设问题列表。
当决策仍未解决时:
- 提出一个具体问题。
- 提供两到三个实质不同的选项及其权衡。
- 根据代码仓库证据和上游需求推荐一个选项。
- 以聚焦的 Mermaid 图、高级类型、schema 或 RPC/API 签名展示系统设计选项;以调用栈树、组件树、文件树 diff、依赖注入映射或方法签名展示程序设计选项。
- 停止并等待。
回答澄清问题时不要编辑。在下一轮继续处理同一决策,直至形成明确的处置结果。
当事项被接受、在有证据支持的情况下调整后被接受、被拒绝、被取代或被阻塞,或者已提出唯一问题且本轮结束时,本步骤完成。
4. Repaint the resolved decision
4. 重绘已解决的决策
Before editing, read TDD design and visual language. It defines document precedence, System Design versus Program Design, selective diagrams and code-shape views, product-document propagation, consistency checks, and Markdown fencing.
Edit the TDD at its original path. Preserve its YAML frontmatter and every
metadata value unless the user explicitly authorized a metadata correction.
Rewrite the smallest complete affected section so it reads as intentional
current design, not appended feedback. Update adjacent prose, diagrams,
signatures, examples, and cross-references whenever the changed decision
invalidates them.
If the decision changes product scope or UX, update the PRD and/or mockup in the same turn. If Mermaid or plain text cannot communicate the decision clearly, take the HTML branch: read the artifact template, copy its complete block into , add focused realistic content, and link it beside the TDD section it explains. If the current host supports inline previews, it may additionally preview that same file.
<style>.agent-work/tasks/<task>/diagram-<description>.htmlFor artifact comments, change comment state or post a reply only when the user authorized that action. Design incorporation and comment resolution are separate outcomes.
This step is complete when the resolved choice is woven into every affected document and visual, with no question log or stale alternative left in the current-design prose.
编辑前,完整阅读TDD 设计与视觉语言。它定义文档优先级、系统设计与程序设计的区别、图表与代码形态视图的选择性使用、产品文档传播、一致性检查及 Markdown 围栏。
在原始路径编辑 TDD。除非用户明确授权修正元数据,否则保留其 YAML frontmatter 和每个元数据值。
重写受影响范围内最小但完整的章节,使其呈现为有意采用的当前设计,而不是附加的反馈。若变更决策使相邻正文、图示、签名、示例或交叉引用失效,则一并更新。
如果决策改变产品范围或 UX,则在同一轮更新 PRD 和/或 mockup。如果 Mermaid 或纯文本无法清晰传达该决策,则采用 HTML 分支:完整阅读artifact 模板,将其完整的 块复制到 ,添加聚焦且真实的内容,并将其链接到其所解释的 TDD 章节旁。如果当前宿主支持内联预览,还可以额外预览同一文件。
<style>.agent-work/tasks/<task>/diagram-<description>.html对于 artifact 评论,只有在用户授权时才可更改评论状态或发布回复。设计纳入与评论解决是彼此独立的结果。
当已解决的选择被整合到所有受影响文档和视觉内容中,且当前设计正文中不存在问题日志或过时备选方案时,本步骤完成。
5. Run the coherence gate
5. 执行一致性门禁
Audit every surface marked affected in step 2. Confirm:
- System Design and Program Design describe the same boundaries, names, contracts, data, and control flow.
- Diagrams, code shapes, file paths, and examples agree with the prose and verified repository patterns.
- Failure handling, compatibility, migration, rollout/backout, and verification reflect the revised risks; unchanged areas are deliberately unchanged.
- PRD/mockup behavior agrees with the TDD where the technical choice affected product behavior.
- Open items remain visibly unresolved rather than being written as decisions.
- The precedence rule explains any surviving conflict.
TDD > PRD > design discussion > research > ticket/task - The file remains at its original path, its YAML parses, and its metadata is unchanged except for explicitly authorized corrections.
- Every explicitly requested comment reply or state mutation was attempted in thread order, re-read afterward, and reached the requested observable state; unrequested comment state is unchanged.
This step is complete when every affected surface passes or is explicitly recorded as an open blocker. Do not declare the design complete with an unaccounted contradiction.
审核步骤 2 标记为受影响的所有层面。确认:
- 系统设计与程序设计对相同边界、名称、契约、数据和控制流的描述一致。
- 图示、代码形态、文件路径和示例与正文及经验证的代码仓库模式一致。
- 失败处理、兼容性、迁移、发布或回退以及验证反映了修订后的风险;未变更区域保持原样。
- 在技术选择影响产品行为之处,PRD 或 mockup 的行为与 TDD 一致。
- 未决事项仍清晰标记为未解决,而不是写成已决策。
- 优先级规则 能够解释任何仍然存在的冲突。
TDD > PRD > design discussion > research > ticket/task - 文件仍位于原始路径,YAML 可解析,且除明确授权的修正外,元数据未发生变化。
- 所有明确要求的评论回复或状态变更均已按线程顺序尝试,并在之后重新读取,达到请求的可观察状态;未经请求的评论状态保持不变。
当每个受影响层面均通过检查或被明确记录为未解决的阻塞项时,本步骤完成。不得在存在未解释矛盾的情况下宣布设计完成。
6. Stop or complete
6. 停止或完成
After one incorporated decision, report the changed section and its local path or optional artifact permalink. Ask one specific next-step question, naming the next unresolved decision when one exists, and stop.
When research or an authorized comment operation is blocked, name the missing
evidence or failed thread action, state what remains unchanged, ask one question
that can unblock it, and stop. A successful design edit does not hide a failed
comment operation.
Only when the coherence gate finds the design fully resolved—whether the user said they are done or the design naturally reached closure—read the resolved TDD handoff and follow it exactly. Add no preamble or trailing summary. Use an artifact permalink when the environment provides one; otherwise substitute the local TDD path.
纳入一个决策后,报告变更章节及其本地路径或可选的 artifact 永久链接。提出一个具体的下一步问题;如存在下一个未解决决策,应指出该决策,然后停止。
当研究或已授权的评论操作受阻时,指出缺失的证据或失败的线程操作,说明哪些内容保持不变,提出一个可解除阻塞的问题,然后停止。设计编辑成功不能掩盖评论操作失败。
只有当一致性门禁确认设计已完全解决时——无论用户表示已完成,还是设计自然达到收束状态——才完整阅读已解决的 TDD 交接并严格遵循。不要添加任何前言或结尾总结。环境提供 artifact 永久链接时使用该链接;否则使用本地 TDD 路径替代。
Output contract
输出约定
Every turn ends in exactly one of these observable states:
- Awaiting direction: the initial three-choice prompt was sent.
- Awaiting decision: one question with options, tradeoffs, recommendation, and the appropriate visual was sent; no document changed.
- Blocked: one missing-evidence or failed-comment-action question was sent; no unsupported design change was made, and any completed edit is identified accurately.
- Incorporated: one resolved decision was repainted, all affected surfaces and authorized comment operations passed the coherence gate, and one next-step question was sent.
- Complete: no unresolved design item, contradiction, or failed authorized comment action remains, and the resolved handoff template was used exactly.
每轮结束必须处于以下恰好一种可观察状态:
- 等待指示: 已发送最初的三选一提示。
- 等待决策: 已发送一个包含选项、权衡、建议和适当视觉内容的问题;未更改文档。
- 受阻: 已发送一个针对缺失证据或评论操作失败的问题;未进行缺乏支持的设计更改,并准确标明任何已完成的编辑。
- 已纳入: 一个已解决决策已重绘,所有受影响层面和已授权评论操作均通过一致性门禁,并已提出一个下一步问题。
- 完成: 不存在未解决的设计事项、矛盾或失败的已授权评论操作,并且严格使用了已解决的交接模板。