agentsclimarketplace

8 architecture decisions

Skill morning-start/agent-skills/lang/moonbit/skills/8-architecture-decisions

高级架构决策。Monorepo vs Single-pkg、Wasm vs JS vs Native、 Trait vs Enum、设计模式选择、SOLID 原则落地。 Use when making architectural decisions for MoonBit projects, choosing between design patterns, or evaluating trade-offs.From its SKILL.md

Install
npx -y skills add morning-start/agent-skills --skill 8-architecture-decisions

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.5 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it

高级架构决策

触发条件

用户面临技术选型或架构决策时激活。

决策矩阵

Monorepo vs Single Package

维度Single PackageMonorepo
代码量< 5000 行> 5000 行
包数量1 个2-10 个
团队规模1-2 人3+ 人
发布形式单一产物多产物(库+CLI+绑定)
复杂度中高
选择大多数项目从这开始moon-lottie/morm 采用此模式

Wasm-GC vs JS vs Native

目标适用场景优势劣势
wasm-gc浏览器/边缘计算安全沙箱、高性能工具链较新
jsNode.js/全栈生态丰富、调试好无类型安全
native高性能/系统编程最高性能平台相关
双目标需要 browser + server最大兼容维护两套配置

Trait vs Enum(多态选择)

场景选择原因
需要外部实现pub(open)trait开放扩展
固定变体集合enum编译期穷尽性检查
运行时策略切换enum + match简单直接
库作者定义接口pub trait封闭控制
回调/事件函数类型最轻量

设计模式选择

需求推荐模式来源
复杂对象构建Builder 模式morm CSRGraph
类型间转换Converter 模式mbtgraph 6 种 to_xxx
平台差异抽象Trait 多态moon-lottie PlatformRenderer
条件分支替代独立类型 + Traitmbtgraph 有向/无向分离
DSL/配置属性驱动morm #morm.* 属性

执行步骤

Step 1: 明确约束

  • 团队规模?目标平台?性能要求?交付时间?

Step 2: 评估选项

对照上述决策矩阵评估备选方案。

Step 3: 做出决策并记录

  • 记录决策理由(ADR: Architecture Decision Record)
  • 记录放弃的选项及原因

Step 4: 验证可行性

  • 创建原型验证关键假设
  • 确认工具链支持

Step 5: 文档化

  • 将决策记录在项目 docs/ 或 ARCHITECTURE.md

SOLID 原则在 MoonBit 中的体现

  • S (单一职责): 每个 .mbt 文件/包只做一件事
  • O (开闭): 用 pub(open)trait 扩展,不用修改已有代码
  • L (里氏替换): CSRGraph 不实现 GraphWritable(只读格式不应有 write 方法)
  • I (接口隔离): GraphEdgeIterable 和 GraphBatchReadable 是独立的小 trait
  • D (依赖倒转): 依赖 PlatformRenderer Trait 而非具体实现

详细知识

🔗 references/library-design.md Parts 12/14/15 — 架构模式和 SOLID 🔗 references/project-layout.md — Monorepo 模板(3种) 🔗 references/real-world-examples.md — 4 个真实项目架构案例 🔗 references/multi-backend.md — 双运行时架构 🔗 references/decision-matrices.md — 更多决策矩阵

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,736. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.