跳到正文
Skillpedia
通用编程8.1k · #12570

architectural-decisions

它能做什么

这项技能帮助你的 AI 解释项目代码构建方式背后的原因。适合在由 Repowise 建立索引的项目中工作、希望避免推翻既定选择的开发者。

适用场景

  • ✓当任务询问代码的某部分为何以特定方式构建的时候。
  • ✓当拟议的改动会改变某种模式、重组模块或比较不同方案的时候。
  • ✓当代码注释或提交说明中含有 WHY、DECISION 或 TRADEOFF 等决定标记的时候。

技能链接

https://github.com/repowise-dev/repowise/blob/main/plugins/codex/skills/architectural-decisions/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/repowise-dev/repowise/blob/main/plugins/codex/skills/architectural-decisions/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“为什么要为这项服务添加缓存?请在建议改动之前,先查找已记录的决定。”

每周 5 个新技能,1 分钟读完。

工作原理

技能向 Repowise 查询与你的问题或相关文件匹配的决定。在任何改动之前,它会展示已记录的理由;如果没有记录,则会注明。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Architectural Decisions with Repowise

Repowise captures architectural decisions — the why behind how code is built.

get_why has four modes — pick by what you pass:

  1. get_why(query="why is auth using JWT?") — keyword + semantic decision search.
  2. get_why(query="src/auth/service.py") — decisions governing that file, plus its origin story and an alignment score (does the file still follow its own ADRs?).
  3. get_why(query="why was caching added?", targets=["src/auth/cache.py"]) — target-anchored search; decisions touching the targets get boosted.
  4. get_why() — the decision-health dashboard.

Decisions are mined from five sources (ADR files, PR and squash-commit bodies, inline markers, git archaeology, and centrality-bounded code comments). Each rationale traces to a verbatim source span, stamped exact / fuzzy / unverified. When no decision exists for a path, get_why falls back to git archaeology so the call is never empty.

When the user asks "why is X built this way?"

Call get_why(query="X").

When about to make an architectural change

  1. Call get_why(query="the specific area you're changing") to find existing decisions that govern that area.
  2. If decisions are found, present them to the user before proceeding — they may not want to contradict an existing architectural choice.
  3. If no decisions are found, proceed but note that no recorded decision governs this area.

When called with no specific query

Call get_why() with no arguments to get the decision-health dashboard:

  • Stale decisions that may no longer apply
  • Proposed decisions awaiting confirmation
  • Ungoverned hotspots (high-churn files with no recorded decisions)

The same signals surface in the CLI via repowise decision health / /prompts:repowise-decision, and you can query why mid-task with repowise why / /prompts:repowise-why (the get_why adapter). repowise decision candidates --format json lists proposed decisions with what each still needs; repowise decision confirm <id> --agent <your slug> --evidence <commit|file> accepts one (see /prompts:repowise-decision).

When a file has decision markers

If you see # WHY:, # DECISION:, # TRADEOFF:, or # ADR: comments in code, call get_context(targets=["that_file.py"]) to see the full decision record with context and affected modules.

Recording new decisions

When you settle an architectural choice yourself (you weighed options and picked one), record it:

repowise decision add --agent <your slug> --title "..." --decision "..." --rationale "<why, and what you rejected>" --affects <path>

Add --evidence-commit <sha> once it is committed. The record lands as a candidate: it never governs until accepted, so recording is safe.

Reviewing candidates

You may review and accept candidates yourself. repowise decision candidates --format json lists each with its blockers. Accept one with repowise decision confirm <id> --agent <your slug>, adding --reason, --scope <path>, --evidence <commit|file|link> or --decision for whatever a blocker names. Dismiss a wrong one with repowise decision dismiss <id> --agent <your slug> --reason ... --yes, fold a duplicate with repowise decision merge <id> <into-id> --agent <your slug> (the target must already be accepted; confirm it first), and retire one with repowise decision deprecate <id> --agent <your slug> --reason .... When an accepted decision is needs_review and still holds, renew it with repowise decision reaffirm <id> --agent <your slug>; confirm is for candidates only. With --format json every review command returns results[], even for one id. Your acceptances are recorded as yours, never a person's. If the repository turned agent acceptance off, the confirm is refused; leave it for a person and mention it.

If the user states a decision, offer to record it the same way without --agent.

常见问题

这些决定从哪里来?

来自架构决策记录、拉取请求和提交说明、代码中的标记、git 历史以及部分代码注释。

如果某个文件没有记录的决定,会怎样?

技能会退而查看该文件的 git 历史,因此答案依然有用。

它需要 Repowise 项目吗?

需要。它只在带有 .repowise 文件夹的项目中工作。

详情

作者的原始描述

Use when a task asks why code is built a certain way, proposes architectural changes, compares implementation approaches, or mentions decision markers such as WHY, DECISION, TRADEOFF, or ADR in a Repowise-indexed repository.

repo: repowise-dev/repowise

热度

GitHub 星标
8.1k
排名
#12570
许可证
AGPL-3.0
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能