跳到正文
cccskills
免费在 GitHub 公开中文介绍

improve-codebase-architecture

检查代码结构,找出妨碍理解和测试的问题,将改进候选方案整理成带前后对比图的HTML报告。选定方案后,通过对话进一步明确约束、依赖关系和设计决策。

原文查看原文说明

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

AI 评分80分/ 100查看安装方法

适用场景

  • 审查频繁变更区域的设计
  • 通过图示比较重构方案
  • 探讨便于测试的模块设计
  • 记录术语和设计决策的理由

中文介绍

功能

improve-codebase-architecture检查代码库,提出改善结构的候选方案,针对难以理解或测试的部分展开分析。核心思路是将复杂处理封装在简洁的使用接口之后。HTML报告展示各方案涉及的文件、问题、解决方案、收益和推荐程度,并用改动前后的图示进行比较。

适用场景

适合理解一个概念需要在许多小模块间跳转,或现有结构难以测试的情况。它会优先检查用户指定的区域,或变更历史中频繁出现的区域。选定候选方案后,通过对话讨论约束、依赖关系、设计和需要保留的测试。

使用示例

  • “检查最近经常修改区域的设计,用图示比较改进方案。”
  • “探讨如何让这个模块更容易测试。”

注意事项

需要使用codebase-design、grilling和domain-modeling技能。它会参考GLOSSARY.md以及docs/adr/中的设计决策,并可能在讨论中更新术语表。报告保存在操作系统的临时目录中,显示时通过内容分发网络加载Tailwind和Mermaid。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确说明先用图示展示结构改进候选方案,再通过提问讨论选定设计。
步骤具体性步骤、输入输出和示例是否具体
A良好具体说明调查范围的选择、报告项目和保存位置,以及选定方案后的讨论步骤。
安全性发送数据、删除文件、执行命令等是否有说明
B部分不足会在讨论中直接更新术语表,但未规定修改已有内容前的确认步骤。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足使用三个相关技能和外部托管的库,但未提供安装方法。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月19日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(3)

  • SKILL.md5.9 KB
  • agents/openai.yaml166 B
  • HTML-REPORT.md6.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Improve Codebase Architecture

Surface architectural friction and propose deepening opportunities: refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.

This command is informed by the project's domain model and built on a shared design vocabulary:

  • Call the Skill tool with "codebase-design" for the architecture vocabulary (module, interface, depth, seam, adapter, leverage, locality) and its principles (the deletion test, "the interface is the test surface", "one adapter = hypothetical seam, two = real"). Use these terms exactly in every suggestion, and don't drift into "component," "service," "API," or "boundary."
  • The domain language in GLOSSARY.md gives names to good seams; ADRs in docs/adr/ record decisions this command should not re-litigate.

Process

1. Explore

Scope before you scan: YAGNI. Deepening a module pays off by making future changes to it easier, so put extra weight on the parts of the codebase that have recently changed. Decide where to look before you look:

  • If the user named a direction (a module, a subsystem, a pain point), take it, and skip the inference below.
  • Otherwise, walk back a good stretch of the commit history (git log --oneline) to find the codebase's hot spots, the files and areas that keep coming up, and let those paths pull your attention first. If the changes are scattered with no clear hot spot, widen the net.

Read the project's domain glossary (GLOSSARY.md) and any ADRs in the area you're touching first.

Then spawn a sub-agent to walk the codebase. Don't follow rigid heuristics; explore organically and note where you experience friction:

  • Where does understanding one concept require bouncing between many small modules?
  • Where are modules shallow, with an interface nearly as complex as the implementation?
  • Where have pure functions been extracted just for testability, but the real bugs hide in how they're called (no locality)?
  • Where do tightly-coupled modules leak across their seams?
  • Which parts of the codebase are untested, or hard to test through their current interface?

Apply the deletion test to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.

2. Present candidates as an HTML report

Write a self-contained HTML file to the OS temp directory so nothing lands in the repo. Resolve the temp dir from $TMPDIR, falling back to /tmp (or %TEMP% on Windows), and write to <tmpdir>/architecture-review-<timestamp>.html so each run gets a fresh file. Open it for the user (xdg-open <path> on Linux, open <path> on macOS, start <path> on Windows) and tell them the absolute path.

The report uses Tailwind via CDN for layout and styling, and Mermaid via CDN for diagrams where a graph/flow/sequence reliably communicates the structure. Mix Mermaid with hand-crafted CSS/SVG visuals: use Mermaid when relationships are graph-shaped (call graphs, dependencies, sequences), and hand-built divs/SVG when you want something more editorial (mass diagrams, cross-sections, collapse animations). Each candidate gets a before/after visualisation. Be visual.

For each candidate, render a card with:

  • Files: which files/modules are involved
  • Problem: why the current architecture is causing friction
  • Solution: plain English description of what would change
  • Benefits: explained in terms of locality and leverage, and how tests would improve
  • Before / After diagram: side-by-side, custom-drawn, illustrating the shallowness and the deepening
  • Recommendation strength: one of Strong, Worth exploring, Speculative, rendered as a badge

End the report with a Top recommendation section: which candidate you'd tackle first and why.

Use GLOSSARY.md vocabulary for the domain, and the /codebase-design vocabulary for the architecture. If GLOSSARY.md defines "Order," talk about "the Order intake module," not "the FooBarHandler," and not "the Order service."

ADR conflicts: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly in the card (e.g. a warning callout: "contradicts ADR-0007, but worth reopening because…"). Don't list every theoretical refactor an ADR forbids.

See HTML-REPORT.md for the full HTML scaffold, diagram patterns, and styling guidance.

Do NOT propose interfaces yet. After the file is written, ask the user: "Which of these would you like to explore?"

3. Grilling loop

Once the user picks a candidate, call the Skill tool with "grilling" to walk the decision tree with them: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.

Side effects happen inline as decisions crystallize; call the Skill tool with "domain-modeling" to keep the domain model current as you go:

  • Naming a deepened module after a concept not in GLOSSARY.md? Add the term to GLOSSARY.md. Create the file lazily if it doesn't exist.
  • Sharpening a fuzzy term during the conversation? Update GLOSSARY.md right there.
  • User rejects the candidate with a load-bearing reason? Offer an ADR, framed as: "Want me to record this as an ADR so future architecture reviews don't re-suggest it?" Only offer when the reason would actually be needed by a future explorer to avoid re-suggesting the same thing; skip ephemeral reasons ("not worth it right now") and self-evident ones.
  • Want to explore alternative interfaces for the deepened module? Call the Skill tool with "codebase-design" and use its design-it-twice parallel sub-agent pattern.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

ask-matt

免费有简介AI 评分 90分

根据任务的规模和阶段,指导你选择相关技能及其使用顺序,涵盖想法梳理、实现和故障排查,帮助确定下一步以及如何衔接后续工作。

  • 选择从想法到实现的步骤
  • 确定故障排查的起点
  • 规划分多次会话完成的开发
mattpocock/skills29.6万2026年10月13日 更新

chief-of-staff

免费有简介AI 评分 60分

在单次会话中协调承担不同任务的子智能体,推进长期目标。后台工作与用户对话同时进行,并改进共享规范、工作环境和后续任务所需的信息访问条件。

  • 协调长期目标中的任务分工
  • 后台推进工作并持续对话
  • 改进共享规范和工作环境
mattpocock/skills29.6万2026年10月13日 更新

claude-handoff

免费有简介AI 评分 90分

将进行中的对话整理为交接摘要,移除敏感信息,明确后续重点、参考资料和建议技能,再启动新的后台智能体,从当前工作目录继续处理任务。

  • 将后续工作交给新的智能体
  • 限定下一次会话的任务范围
  • 整理下一次会话所需的参考资料
mattpocock/skills29.6万2026年10月13日 更新

code-review

免费有简介AI 评分 90分

以指定提交、分支或标签为基准,从开发规范和原始需求两个角度审查代码变更。分别报告规范问题与需求缺漏,便于独立判断两方面的结果。

  • 审查分支或PR的变更
  • 检查指定提交或标签之后的变更
  • 对照已记录的开发规范
mattpocock/skills29.6万2026年10月13日 更新

codebase-design

免费有简介AI 评分 90分

帮助设计用法精简、内部集中处理复杂逻辑的模块。通过统一术语和判断标准,评估模块是否易用、实现替换位置是否合适,以及是否便于测试。

  • 简化模块的调用方式
  • 集中分散的复杂逻辑
  • 选择可替换实现的位置
mattpocock/skills29.6万2026年10月13日 更新

diagnosing-bugs

免费有简介AI 评分 80分

通过能检测具体症状的测试或脚本,调查难以复现的故障和性能下降。缩小失败条件,验证多个原因假设,完成修复后检查原始复现流程及防止复发的测试。

  • 调查难以复现的错误
  • 查找处理速度下降的原因
  • 重复验证间歇性故障
mattpocock/skills29.6万2026年10月13日 更新

查看 mattpocock 的全部技能

报告此技能的问题