addon-decision-justification-ledger
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdd-on: Decision Justification Ledger
附加组件:决策理由台账
Use this skill when decision visibility is required by default and no non-trivial change should ship without a recorded rationale.
当默认要求决策可追溯、所有非 trivial 变更都必须附带记录的理由才能上线时,使用此技能。
Compatibility
兼容性
- Works with all ,
architect-*, andaddon-*skills.ui-* - Required default for mode.
production-default
- 兼容所有 、
architect-*和addon-*类技能。ui-* - 是 模式的默认必选组件。
production-default
Inputs
输入项
Collect:
- :
DECISION_LOG_LEVEL|standard(defaultstrict).strict - :
DECISION_SCOPE|architecture-only(defaultarchitecture+implementation).architecture+implementation - : default
DECISION_LOG_PATH.docs/DECISION_LOG.md - : default
DECISION_TRACE_PATH.REVIEW_BUNDLE/DECISION_TRACE.md
收集以下参数:
- :
DECISION_LOG_LEVEL|standard(默认strict)。strict - :
DECISION_SCOPE|architecture-only(默认architecture+implementation)。architecture+implementation - :默认
DECISION_LOG_PATH。docs/DECISION_LOG.md - :默认
DECISION_TRACE_PATH。REVIEW_BUNDLE/DECISION_TRACE.md
Integration Workflow
集成工作流
- Add decision visibility artifacts:
text
docs/DECISION_LOG.md
REVIEW_BUNDLE/DECISION_TRACE.md- Record each non-trivial decision in :
docs/DECISION_LOG.md
- Decision ID
- Context and requirement
- Options considered
- Chosen option
- Concrete justification
- Tradeoffs and residual risks
- Validation evidence
-
Link changed files to decision IDs inso reviewers can map code to rationale quickly.
REVIEW_BUNDLE/DECISION_TRACE.md -
Keep entries append-only for auditability; corrections should be new entries that reference previous IDs.
- 添加决策可追溯工件:
text
docs/DECISION_LOG.md
REVIEW_BUNDLE/DECISION_TRACE.md- 在 中记录每一项非 trivial 决策:
docs/DECISION_LOG.md
- 决策 ID
- 上下文与需求
- 考虑过的可选方案
- 最终选择的方案
- 具体理由
- 权衡取舍与遗留风险
- 验证证据
-
在中将变更文件与决策 ID 关联,方便评审人员快速将代码对应到决策理由。
REVIEW_BUNDLE/DECISION_TRACE.md -
条目仅支持追加以保证可审计性;修正内容应为引用旧 ID 的新条目。
Required Template
所需模板
docs/DECISION_LOG.md
docs/DECISION_LOG.mddocs/DECISION_LOG.md
docs/DECISION_LOG.mdmarkdown
undefinedmarkdown
undefinedDecision Log
Decision Log
DEC-001 <short title>
DEC-001 <short title>
- Context: <what requirement or constraint triggered this>
- Options: <A>, <B>, <C>
- Chosen: <selected option>
- Justification: <why this option is best for this case>
- Tradeoffs: <known downsides>
- Risks: <residual risk + mitigations>
- Evidence: <tests/build/checks/docs>
undefined- Context: <what requirement or constraint triggered this>
- Options: <A>, <B>, <C>
- Chosen: <selected option>
- Justification: <why this option is best for this case>
- Tradeoffs: <known downsides>
- Risks: <residual risk + mitigations>
- Evidence: <tests/build/checks/docs>
undefinedREVIEW_BUNDLE/DECISION_TRACE.md
REVIEW_BUNDLE/DECISION_TRACE.mdREVIEW_BUNDLE/DECISION_TRACE.md
REVIEW_BUNDLE/DECISION_TRACE.mdmarkdown
undefinedmarkdown
undefinedDecision Trace
Decision Trace
| File | Decision ID | Summary |
|---|---|---|
| src/app/main.py | DEC-001 | Chose local lexical index for offline deterministic retrieval |
undefined| File | Decision ID | Summary |
|---|---|---|
| src/app/main.py | DEC-001 | Chose local lexical index for offline deterministic retrieval |
undefinedGuardrails
防护规则
-
Documentation contract for generated code:
- Python: write module docstrings and docstrings for public classes, methods, and functions.
- Next.js/TypeScript: write JSDoc for exported components, hooks, utilities, and route handlers.
- Add concise rationale comments only for non-obvious logic, invariants, or safety constraints.
- Apply this contract even when using template snippets below; expand templates as needed.
-
No non-trivial decision without rationale.
-
Do not use generic claims like "best practice" as a sole justification.
-
If alternatives were not considered, explicitly state why only one path is viable.
-
Missing decision entries are merge blockers in production-default mode.
-
生成代码的文档约定:
- Python:为模块、公共类、方法和函数编写文档字符串。
- Next.js/TypeScript:为导出的组件、hooks、工具函数和路由处理函数编写 JSDoc。
- 仅为非显而易见的逻辑、不变量或安全约束添加简洁的理由注释。
- 即使使用下方的模板片段也需遵守本约定,可按需扩展模板。
-
任何非 trivial 决策都必须附带理由。
-
不得将“最佳实践”这类泛泛的说法作为唯一理由。
-
如果未考虑替代方案,需明确说明为何只有一条路径可行。
-
在 production-default 模式下,缺失决策条目会成为合并阻塞项。
Validation Checklist
验证检查清单
- Confirm generated code includes required docstrings/JSDoc and rationale comments for non-obvious logic.
bash
test -f docs/DECISION_LOG.md
test -f REVIEW_BUNDLE/DECISION_TRACE.md
rg -n "## DEC-[0-9]{3}" docs/DECISION_LOG.md
rg -n "Justification:|Tradeoffs:|Risks:" docs/DECISION_LOG.md- 确认生成的代码包含要求的文档字符串/JSDoc,且为非显而易见的逻辑添加了理由注释。
bash
test -f docs/DECISION_LOG.md
test -f REVIEW_BUNDLE/DECISION_TRACE.md
rg -n "## DEC-[0-9]{3}" docs/DECISION_LOG.md
rg -n "Justification:|Tradeoffs:|Risks:" docs/DECISION_LOG.mdDecision Justification Rule
决策理由规则
- Every non-trivial decision must include a concrete justification.
- Capture the alternatives considered and why they were rejected.
- State tradeoffs and residual risks for the chosen option.
- If justification is missing, treat the task as incomplete and surface it as a blocker.
- 所有非 trivial 决策都必须包含具体理由。
- 记录考虑过的替代方案以及被否决的原因。
- 说明所选方案的权衡取舍与遗留风险。
- 如果缺失理由,视为任务未完成,并标记为阻塞项。