SKILL

architecture-decision-records

在Claude Code会话期间,将做出的架构决策捕获为结构化的架构决策记录(ADR)。自动检测决策时刻,记录上下文、考虑的替代方案和理由。维护一个ADR日志,以便未来的开发人员理解代码库为何以当前方式构建。

Original · translation not yet available

Target: Software development & testing. Automatically collected · unverified.

Excerpt from the author’s documentation

Extracted from a fixed version of SKILL.md in its original language. This is the author’s documentation; installation, compatibility and runtime results have not been verified by this site.

Read the original Chinese text

Topics in the source

  • 架构决策记录
  • 何时激活
  • ADR 格式
  • 工作流程
  • 捕捉新的 ADR
  • 读取现有 ADR
  • ADR 目录结构
  • ADR 索引格式

在编码会话期间捕捉架构决策。让决策不仅存在于 Slack 线程、PR 评论或某人的记忆中,此技能将生成结构化的 ADR 文档,并与代码并存。 用户明确说"让我们记录这个决定"或"为这个做 ADR" 用户在重要的备选方案(框架、库、模式、数据库、API 设计)之间做出选择 用户说"我们决定..."或"我们选择 X 而不是 Y 的原因是..." 用户询问"我们为什么选择了 X?"(读取现有 ADR) 在讨论架构权衡的规划阶段 使用 Michael Nygard 提出的轻量级 ADR 格式,并针对 AI 辅助开发进行调整: 当检测到决策时刻时: 1. 初始化(仅首次) — 如果 docs/adr/ 不存在,在创建目录、一个包含索引表头(见下方 ADR 索引格式)的 README.md 以及一个供手动使用的空白 template.md 之前,询问用户进行确认。未经明确同意,不要创建文件。 2. 识别决策 — 提取正在做出的核心架构选择 3. 收集上下文 — 是什么问题引发了此决策?存在哪些约束? 4. 记录备选方案 — 考虑了哪些其他选项?为什么拒绝了它们? 5. 陈述后果 — 权衡是什么?什么变得更容易/更难? 6. 分配编号 — 扫描 docs/adr/ 中的现有 ADR 并递增 7. 确认并写入 — 向用户展示 ADR 草稿以供审查。仅在获得明确批准后写入 docs/adr/NNNN-decision-title.md。如果用户拒绝,则丢弃草稿,不写入任何文件。 8. 更新索引 — 追加到 docs/adr/README.md 当用户询问"我们为什么选择了 X?"时: 1. 检查 docs/adr/ 是否存在 — 如果不存在,回复:"在此项目中未找到 ADR。您想开始记录架构决策吗?" 2. 如果存在,扫描 docs/adr/README.md 索引以查找相关条目 3. 读取匹配的 ADR 文件并呈现上下文和决策部分 4. 如果未找到匹配项,回复:"未找到关于该决策的 ADR。您现在想记录一个吗?" 留意对话中指示架构决策的以下模式: 显式信号 "让我们选择 X" "我们应该使用 X 而不是 Y" "权衡是值得的,因为..." "将此记录为 ADR" 隐式信号(建议记录 ADR — 未经用户确认不要自动创建) 比较两个框架或库并得出结论 做出数据库模式设计选择并陈述理由 在架构模式之间选择(单体 vs 微服务,REST vs GraphQL) 决定身份验证/授权策略 评估备选方案后选择部署基础设施 具体明确 — "使用 Prisma ORM",而不是"使用一个 ORM" 记录原因 — 理由比内容更重要 包含被拒绝的备选方案 — 未来的开发者需要知道考虑了哪些选项 诚实地陈述后果 — 每个决策都有权衡 保持简短 — 一份 ADR 应在 2 分钟内可读完 使用现在

This is an excerpt. Refer to the complete source and its current requirements.

Source repository
affaan-m/ECC
Source file
docs/zh-CN/skills/architecture-decision-records/SKILL.md
Fixed revision
d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
Read the complete original documentation ↗

Sources and evidence

This record was collected automatically. Its documentation, suitability and runtime behavior have not been manually verified.

Author: affaan-m/ECC · original repository metadata. Documentation review: Not reviewed. Last source check: 2026-11-09T14:01:50.134Z.

Categories are inferred from names, descriptions and paths. They do not establish compatibility.

License and attribution

MIT. Third-party content and copyright remain with their authors. Refer to the original license and terms.

Original license ↗

Synchronization, copying and user-reported success do not mark a resource as runtime-tested.

Limitations and notes

  • Collecting metadata does not mean this site has installed, adapted, runtime-tested or security-reviewed the resource.