implementation-planner
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementation Planner
实现规划器
Plan only. Do not edit files, apply patches, commit, or implement unless the user explicitly changes the request.
仅做规划。除非用户明确修改需求,否则不得编辑文件、应用补丁、提交代码或执行实现。
Goal
目标
Produce one repository-grounded plan that another engineer can implement without reconstructing the conversation or rediscovering the relevant code path.
生成一份基于代码仓库的规划方案,其他工程师无需回溯对话上下文或重新梳理相关代码路径即可直接执行。
Establish the Contract
明确约定
Identify:
- the authoritative requirements and acceptance criteria
- the concrete outcome the implementation must produce
- non-goals and behavior that must remain unchanged
- material assumptions, unresolved decisions, and authorization boundaries
Treat examples, suggestions, rejected approaches, and future ideas as context unless the source explicitly adopts them. Do not weaken requirements to make the implementation easier.
需确认以下内容:
- 权威需求与验收标准
- 实现必须产出的具体结果
- 非目标项及必须保持不变的行为
- 重要假设、未决决策与权限边界
除非来源明确采纳,否则示例、建议、被否决的方案及未来构想仅作为上下文参考。不得为了降低实现难度而放宽需求标准。
Gather Enough Evidence
收集充分依据
Start from the request, issue or specification, repository instructions, glossary, ADRs, and prior decisions. Search by domain concept, then inspect only the code needed to understand the current path, ownership, stable seams, consumers, relevant tests, and repository validation commands.
Trace at least one representative path from its caller or entry point to the behavior, state change, or output being modified. Distinguish confirmed repository facts from inferences and unknowns. Stop inspecting once the plan's change boundary and validation path are supported by evidence.
从需求、Issue 或规范、仓库说明、术语表、ADRs 及既往决策出发。按领域概念进行搜索,仅查看理解当前代码路径、权责归属、稳定接缝、调用方、相关测试及仓库验证命令所需的代码。
从调用方或入口点开始,至少追踪一条通往待修改行为、状态变更或输出的代表性路径。区分已确认的仓库事实与推论、未知项。一旦规划的变更边界和验证路径有充分依据支撑,即可停止代码探查。
Draft the Smallest Complete Change
起草最小完整变更方案
Choose one primary implementation path. Prefer existing modules, interfaces, helpers, types, and data shapes when they can satisfy the requirement cleanly.
Every proposed file, abstraction, dependency, schema change, state mechanism, configuration option, or public interface must have a direct requirement or repository-based reason to exist. Preserve essential complexity that represents real domain rules, compatibility, durability, recovery, security, or operational behavior.
Name the expected files and symbols to change and why. Treat that list as the evidence-backed expected surface, not certainty that later implementation may never challenge. Identify protected contracts or consumers when the change could affect them.
When planning to replace an interface, find everything that uses it, including tests. Include steps to update those callers and remove the old interface. Plan to update tests while keeping the behavior they check. If external callers, mixed versions, or a gradual rollout require keeping the old interface, explain why and when any temporary adapter can be removed. Leaving tests unchanged is not enough reason to keep an old production API.
Plan checks through a user action or a module interface expected to remain stable. Each proposed test must name the realistic regression it would catch. Include exact existing commands when they can be established from the repository; do not invent commands or require tests that merely mirror implementation details.
For behavioral changes, order each practical test before its implementation and state the expected failure and relevant starting conditions. If no meaningful automated check is practical, explain why and plan alternative evidence. For behavior-preserving refactors, plan baseline checks and preservation of existing failure cases. Identify any intended expectation change and the requirement authorizing it.
Check that required coverage runs in the proposed validation command, including relevant opt-ins, exclusions, and infrastructure prerequisites. Do not plan setup that silently supplies readiness the supported workflow lacks. Name any decision or prerequisite that could prevent a valid regression from passing; direct implementation to preserve that failure and report the blocker rather than weaken acceptance.
选择一条主要实现路径。若现有模块、接口、辅助函数、类型及数据结构能简洁地满足需求,则优先复用。
每一个拟新增的文件、抽象层、依赖、schema 变更、状态机制、配置项或公共接口,都必须有直接的需求依据或基于仓库现状的存在理由。保留体现真实领域规则、兼容性、持久性、可恢复性、安全性或运维行为的必要复杂度。
列出预期需要修改的文件和符号,并说明原因。这份清单是有依据的预期变更范围,而非后续实现绝对不能调整的定论。若变更可能影响受保护的契约或调用方,需明确指出。
若计划替换某个接口,需找出所有使用该接口的代码,包括测试。包含更新这些调用方及移除旧接口的步骤。规划测试更新时需保留其校验的行为。如果外部调用方、版本兼容或灰度发布要求保留旧接口,需说明原因,以及临时适配器可被移除的时机。仅为了不修改测试,不足以成为保留旧生产环境 API 的理由。
通过用户操作或预期保持稳定的模块接口来规划校验方式。每一个拟新增的测试都必须明确其能够捕获的实际回归问题。若能从仓库中确认现有命令,需列出准确的命令;不得虚构命令,也不得要求编写仅能反映实现细节的测试。
对于行为变更,需将每个可行的测试安排在对应实现之前,并说明预期的失败结果及相关前置条件。若无法实施有意义的自动化校验,需说明原因并规划替代验证方式。对于不改变行为的重构,需规划基线校验,并确保现有失败用例保持不变。明确所有预期的期望变更,以及授权该变更的需求依据。
确认拟议的验证命令中包含所需的覆盖率检查,包括相关的可选启用项、排除项及基础设施前置条件。不得规划那些会静默提供受支持工作流所不具备的就绪状态的设置。列出所有可能导致有效回归用例无法通过的决策或前置条件;要求实现侧保留该失败状态并上报阻塞问题,而非放宽验收标准。
Refine Before Presenting
输出前打磨优化
Taste-check the draft and revise it in place:
- Is the implementation surface proportional to the requirement?
- Does every changed file and new concept earn its place?
- Can an existing path replace a new layer, option, or compatibility mechanism?
- Would the proposal scatter one logical change or give one module unrelated reasons to change?
- Did the draft miss a consumer, repository convention, failure path, or protected behavior?
- Does the validation prove the requirement instead of the proposed implementation?
- Can complexity be removed without moving cost or risk elsewhere?
Keep intentional complexity only when the requirement or repository evidence justifies it. Preserve useful problem-specific reasoning, but omit the draft and refinement history from the final answer unless a discarded approach explains an important decision.
对草稿进行自查并就地修订:
- 实现范围是否与需求规模匹配?
- 每个被修改的文件和新增的概念是否都有存在的必要?
- 现有路径是否能够替代新增的层、配置项或兼容机制?
- 该方案是否会分散同一个逻辑变更,或是让单个模块承担无关的变更理由?
- 草稿是否遗漏了某个调用方、仓库约定、失败路径或受保护的行为?
- 验证是否是在证明需求达成,而非仅验证拟议的实现?
- 是否可以在不转移成本或风险的前提下移除复杂度?
仅当需求或仓库证据支持时,才保留刻意设计的复杂度。保留有用的针对特定问题的推理过程,但最终答案中无需包含草稿和打磨过程的历史记录,除非被舍弃的方案能够解释某个重要决策。
Readiness
就绪判定
Call the plan ready only when its requirements, current-code evidence, proposed behavior, expected change surface, ordered steps, and validation are concrete enough to implement.
A local, reversible assumption may remain when repository evidence supports it; record it. If a missing decision could materially change user-visible behavior, public contracts, data semantics, security, identity, routing, scope, acceptance criteria, or external authority, do not choose silently. Mark the plan not ready and state the exact decision or evidence needed.
仅当需求、当前代码依据、拟议行为、预期变更范围、有序步骤及验证方式都足够具体、可直接执行时,才可判定规划已就绪。
若有仓库证据支撑,可以保留局部的、可撤销的假设,并记录下来。如果某个缺失的决策可能实质性地影响用户可见行为、公共契约、数据语义、安全性、身份认证、路由、范围、验收标准或外部权限,不得私自决定。需标记规划未就绪,并明确说明所需的具体决策或依据。
Output
输出规范
Keep the plan concise and use only headings that add decision value. These are optional sections, not a fixed template: combine related elements when that is clearer, while preserving the concrete information required by the readiness criteria.
- Goal and requirements: source of truth, required outcome, and verifiable acceptance criteria
- Current code findings: relevant files, symbols, flow, constraints, and evidence
- Proposed changes: one primary behavior and design path
- Expected change surface: files or modules, direct reasons, and protected surfaces
- Implementation steps: ordered, coherent vertical steps
- Validation: meaningful tests, checks, commands, and the regressions they protect against
- Non-goals, assumptions, risks, and rollback: only when material
- Readiness: ready, or not ready with the precise blocker
Stop when the refined plan is implementation-ready or when the remaining material blocker is stated precisely. Do not continue reading merely to make the plan look exhaustive.
保持规划简洁,仅使用具有决策价值的标题。以下为可选章节,而非固定模板:若合并相关元素更清晰,可进行合并,但需保留就绪判定标准要求的具体信息。
- 目标与需求:事实来源、所需产出及可验证的验收标准
- 当前代码探查结果:相关文件、符号、流程、约束及依据
- 拟议变更:一条主要的行为与设计路径
- 预期变更范围:涉及的文件或模块、直接原因及受保护的范围
- 实现步骤:有序、连贯的纵向推进步骤
- 验证方式:有意义的测试、检查、命令,以及它们能够防范的回归问题
- 非目标、假设、风险与回滚:仅在有重要影响时列出
- 就绪状态:就绪,或未就绪并说明明确的阻塞原因
当打磨后的规划已可落地执行,或已明确说明剩余的重要阻塞问题时,即可停止。不要为了让规划看起来详尽而继续无意义的代码探查。