explain-diff

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Explain Diff

差异解释

Compress the diff into a short before/after brief the operator can understand before committing.
将差异内容压缩为简短的前后对比摘要,方便操作者在提交前快速理解。

Steps

步骤

  1. Inspect
    git status --short
    , staged diff, unstaged diff, and untracked files.
  2. If no local diff exists, compare the current branch to the resolved base branch.
  3. Read
    references/output-preferences.md
    and apply the configured output language/style.
  4. Read only the files needed to understand before/after behavior, intent, risk, and verification.
  5. Favor behavior and ownership over file lists.
  6. If the diff is too broad to explain safely in 12 lines, summarize the main slice and say what must be inspected next.
  1. 查看
    git status --short
    、暂存差异、未暂存差异以及未跟踪文件。
  2. 如果不存在本地差异,则将当前分支与已解析的基准分支进行对比。
  3. 阅读
    references/output-preferences.md
    并应用配置的输出语言/样式。
  4. 仅阅读理解前后行为、意图、风险和验证所需的文件。
  5. 优先关注行为和归属,而非文件列表。
  6. 如果差异范围过广,无法在12行内安全解释,则总结核心内容并说明接下来必须检查的部分。

Output

输出

Emit at most 12 lines. Do not use diagrams or long prose.
markdown
Diff brief
- Before: <what existed before, one sentence>
- After: <what exists now, one sentence>
- Why: <reason, or "not obvious from diff">
- Constraint: <main constraint/tradeoff that shaped the change>
- Impact: <user/dev/config/none + one sentence>
- Scope: <UI/API/DB/config/docs touched or unchanged, only if useful>
- Risk: <one concrete risk>
- Verify: <commands/manual check>
- Reread: <1-3 files or hunks max>
Then ask exactly one question:
text
Does this match what you intended to commit?
Translate labels and the final question naturally according to
references/output-preferences.md
.
输出最多12行内容。请勿使用图表或冗长文字。
markdown
差异摘要
- 之前:<修改前的状态,一句话描述>
- 之后:<当前的状态,一句话描述>
- 原因:<修改理由,或“从差异中无法明确”>
- 约束:<影响该变更的主要约束/权衡>
- 影响:<用户/开发者/配置/无 + 一句话描述>
- 范围:<涉及或未涉及的UI/API/数据库/配置/文档,仅在有用时列出>
- 风险:<一个具体风险>
- 验证:<命令/手动检查方式>
- 重读:<最多1-3个文件或代码块>
然后提出如下问题:
text
这与你想要提交的内容一致吗?
根据
references/output-preferences.md
自然翻译标签和最终问题。

Guardrails

约束规则

  • Do not stage, commit, push, or edit.
  • Do not list every changed file.
  • Do not output a full audit, code tour, or file-by-file walkthrough.
  • Do not invent intent. If the "why" or constraint is not visible in the diff, say so.
  • If the diff contains generated/vendor noise, separate it from meaningful changes.
  • If intent is unclear, say so directly.
  • 请勿执行暂存、提交、推送或编辑操作。
  • 请勿列出所有变更文件。
  • 请勿输出完整审计报告、代码导览或逐文件说明。
  • 请勿编造意图。如果从差异中无法明确“原因”或约束,请如实说明。
  • 如果差异包含生成文件/第三方依赖的冗余内容,请将其与有意义的变更区分开。
  • 如果意图不明确,请直接说明。