adr-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseADR Skill
ADR 技能
Overview
概述
Create high-signal ADRs that capture the "why" behind architecture choices, and keep the ADR log tidy as the system evolves.
创建高价值的ADR,捕捉架构选择背后的“原因”,并随着系统的演进保持ADR日志的整洁。
Workflow Decision Tree
工作流决策树
- Determine the request type:
- Create a new ADR: Follow "New ADR" below.
- Update an existing ADR (status change, add learnings, supersede): Follow "Update ADR" below.
- Fix or create an ADR index/log: Follow "Index" below.
- Adopt ADRs in a repo that has none: Follow "Bootstrap" below.
- If the repo already has an ADR convention, follow it:
- Directory: ,
adr/,docs/adr/, etc.docs/decisions/ - Filenames: or
choose-database.md, etc.0001-choose-database.md - Template: simple vs option-heavy.
If the repo has no convention yet, default to:
- Directory:
adr/ - Filenames: numbered, then slug (e.g., )
0001-choose-database.md - Template:
assets/templates/adr-simple.md
- 确定请求类型:
- 创建新ADR:遵循下方的“新ADR”流程。
- 更新现有ADR(状态变更、添加经验、替代):遵循下方的“更新ADR”流程。
- 修复或创建ADR索引/日志:遵循下方的“索引”流程。
- 在无ADR的仓库中引入ADR:遵循下方的“初始化”流程。
- 若仓库已有ADR规范,请遵循该规范:
- 目录:、
adr/、docs/adr/等。docs/decisions/ - 文件名:或
choose-database.md等。0001-choose-database.md - 模板:简洁型 vs 多选项型。
若仓库尚无规范,则默认采用:
- 目录:
adr/ - 文件名:编号+短标题(例如:)
0001-choose-database.md - 模板:
assets/templates/adr-simple.md
New ADR
新ADR
- Choose the ADR directory.
- If one exists, use it.
- If none exists, create (or the user's preferred directory).
adr/
- Choose a filename strategy.
- If existing ADRs use numeric prefixes (e.g., ), continue that.
0001-... - Otherwise use slug-only filenames (e.g., ).
choose-database.md
- Choose a template.
- Use for most decisions.
assets/templates/adr-simple.md - Use when you need to document options, pros/cons, and drivers.
assets/templates/adr-madr.md
- Gather inputs (minimum viable ADR).
- Title: short, actionable, ideally verb phrase.
- Status: usually initially.
proposed - Context: the constraint, requirement, and why this matters now.
- Decision: the actual choice, not the story.
- Consequences: what gets easier/harder, follow-ups, migration costs, risks.
- Generate the file.
- Preferred: run (it handles directory, naming strategy, and optional index updates).
scripts/new_adr.js - If you can't run scripts, copy a template from and fill it manually.
assets/templates/
- 选择ADR目录。
- 若已有目录,则直接使用。
- 若无目录,则创建(或用户偏好的目录)。
adr/
- 选择文件名策略。
- 若现有ADR使用数字前缀(例如:),则延续该策略。
0001-... - 否则仅使用短标题作为文件名(例如:)。
choose-database.md
- 选择模板。
- 大多数决策使用。
assets/templates/adr-simple.md - 当需要记录选项、优缺点及决策动因时,使用。
assets/templates/adr-madr.md
- 收集必要信息(最小可行ADR)。
- 标题:简短、可执行,优先使用动词短语。
- 状态:初始状态通常为(提议中)。
proposed - 背景:约束条件、需求,以及当前为何需要做出该决策。
- 决策:实际选择的内容,而非过程描述。
- 影响:哪些操作会变简单/复杂、后续工作、迁移成本、风险。
- 生成文件。
- 推荐方式:运行(该脚本会处理目录、命名策略及可选的索引更新)。
scripts/new_adr.js - 若无法运行脚本,则从复制模板并手动填写内容。
assets/templates/
Script: new_adr.js
脚本:new_adr.js
From the target repo root:
bash
node /path/to/adr-skill/scripts/new_adr.js --title "Choose database" --status proposedIf you want MADR-style:
bash
node /path/to/adr-skill/scripts/new_adr.js --title "Choose database" --template madr --status proposedNotes:
- The script tries to auto-detect the ADR directory and filename strategy.
- Use and
--dirto override.--strategy - Use to emit machine-readable output for tooling.
--json
从目标仓库根目录执行:
bash
node /path/to/adr-skill/scripts/new_adr.js --title "Choose database" --status proposed若需要MADR风格的ADR:
bash
node /path/to/adr-skill/scripts/new_adr.js --title "Choose database" --template madr --status proposed注意事项:
- 脚本会尝试自动检测ADR目录及文件名策略。
- 可使用和
--dir参数自定义配置。--strategy - 使用参数可输出机器可读格式的内容,供工具调用。
--json
Update ADR
更新ADR
- Identify the intent:
- Accept / reject: change status, and add any final context that made the decision clear.
- Deprecate: status becomes and explain replacement path.
deprecated - Supersede: create a new ADR and link both ways (old points to new; new references old).
- Add learnings: append an "After-action" note with a date stamp rather than rewriting history.
- Keep it navigable:
- Link to PRs/issues, tickets, docs.
- Prefer small edits that explain why reality diverged from the original assumptions.
- 明确更新意图:
- 接受/拒绝:修改状态,并添加使决策明确的最终背景信息。
- 弃用:将状态改为(已弃用),并说明替代方案。
deprecated - 替代:创建新的ADR,并在新旧ADR之间建立双向链接(旧ADR指向新ADR,新ADR引用旧ADR)。
- 添加经验总结:在ADR末尾添加带日期戳的“事后总结”,而非修改历史内容。
- 保持可导航性:
- 关联PR/议题、工单及文档。
- 优先采用小幅度修改,说明实际情况与最初假设产生差异的原因。
Index
索引
If the repo has an ADR index/log file (often or ), keep it updated.
adr/README.mdadr/index.mdPreferred: let do it. Otherwise:
scripts/new_adr.js --update-index- Add a bullet entry for the new ADR.
- Keep ordering consistent (numeric order if numbered; alphabetical or date order if slugs).
若仓库已有ADR索引/日志文件(通常为或),请保持其内容更新。
adr/README.mdadr/index.md推荐方式:使用自动更新。若无法使用该脚本:
scripts/new_adr.js --update-index- 为新ADR添加一个列表项。
- 保持排序一致(若使用编号则按数字排序;若使用短标题则按字母或日期排序)。
Bootstrap
初始化
When introducing ADRs to a repo that has none:
Preferred: run , which:
scripts/bootstrap_adr.js- Creates the directory .
adr/ - Creates an index file .
adr/README.md - Creates the first ADR (meta decision): "Adopt architecture decision records".
Example:
bash
node /path/to/adr-skill/scripts/bootstrap_adr.jsIf you want machine-readable output:
bash
node /path/to/adr-skill/scripts/bootstrap_adr.js --json当向尚无ADR的仓库引入该机制时:
推荐方式:运行,该脚本会执行以下操作:
scripts/bootstrap_adr.js- 创建目录。
adr/ - 创建索引文件。
adr/README.md - 创建首个ADR(元决策):“采用架构决策记录”。
示例:
bash
node /path/to/adr-skill/scripts/bootstrap_adr.js若需要机器可读格式的输出:
bash
node /path/to/adr-skill/scripts/bootstrap_adr.js --jsonResources
资源
Read these when you need more detail or want to align with common ADR conventions:
当需要了解更多细节或与通用ADR规范对齐时,可参考以下内容:
scripts/
脚本目录/
- : create a new ADR file from a template, using repo conventions.
scripts/new_adr.js - : update an ADR status in-place (supports the included templates). Use
scripts/set_adr_status.jsfor machine output.--json - : create
scripts/bootstrap_adr.jsplus the initial "Adopt ADRs" decision.adr/README.md
- :根据仓库规范,从模板创建新的ADR文件。
scripts/new_adr.js - :就地更新ADR状态(支持内置模板)。使用
scripts/set_adr_status.js参数可输出机器可读格式内容。--json - :创建
scripts/bootstrap_adr.js及初始的“采用ADR”决策文档。adr/README.md
references/
参考文档/
- : directory + filename conventions and lifecycle guidance.
references/adr-conventions.md - : when to use simple vs MADR-style templates.
references/template-variants.md
- :目录及文件名规范,以及ADR生命周期指南。
references/adr-conventions.md - :介绍何时使用简洁型模板 vs MADR风格模板。
references/template-variants.md
assets/
资源文件/
- : a small template for most ADRs.
assets/templates/adr-simple.md - : a bigger template for decisions with real options/tradeoffs.
assets/templates/adr-madr.md - : default ADR index scaffold used by
assets/templates/adr-readme.md.scripts/bootstrap_adr.js
- :适用于大多数ADR的简洁模板。
assets/templates/adr-simple.md - :适用于存在多个选项及权衡的决策的详细模板。
assets/templates/adr-madr.md - :
assets/templates/adr-readme.md使用的默认ADR索引模板。scripts/bootstrap_adr.js