Decision Frameworks (Meta-Skill)
Structured approaches for making engineering decisions with confidence and traceability.
Installation
OpenClaw / Moltbot / Clawbot
CODEBLOCK0
When to Use
- - Choosing between libraries, frameworks, or tools
- Facing a build-vs-buy decision
- Selecting an architecture pattern (monolith vs microservices, SQL vs NoSQL, etc.)
- Multiple valid options exist and the team needs alignment
- Prioritizing a backlog or technical roadmap
- Documenting a significant technical decision for future reference
Decision Matrix Template
Use a weighted scoring matrix when comparing 3+ options across measurable criteria.
| Criteria | Weight | Option A | Option B | Option C |
|---|
| Performance | 5 | 4 (20) | 3 (15) | 5 (25) |
| Developer Experience |
4 | 5 (20) | 4 (16) | 3 (12) |
| Community Support | 3 | 5 (15) | 3 (9) | 2 (6) |
| Learning Curve | 3 | 3 (9) | 4 (12) | 2 (6) |
| Cost | 2 | 5 (10) | 3 (6) | 4 (8) |
|
Total | |
74 |
58 |
57 |
How to use:
- 1. List criteria relevant to the decision
- Assign weights (1-5) based on project priorities
- Score each option per criterion (1-5)
- Multiply score x weight, sum per option
- Highest total wins — but sanity-check the result against gut feel
Build vs Buy Framework
Follow this decision tree:
CODEBLOCK1
Factor comparison:
| Factor | Build | Buy / Adopt |
|---|
| Maintenance cost | Ongoing — your team owns it | Vendor/community maintains it |
| Customization |
Unlimited flexibility | Limited to extension points |
| Time to market | Slower — development required | Faster — ready-made |
| Team expertise | Must have or acquire skills | Abstracted away |
| Long-term cost | Scales with internal capacity | License/subscription fees |
| Vendor lock-in risk | None | Medium to high |
| Security control | Full audit capability | Dependent on vendor transparency |
Library / Framework Selection
Evaluate candidate libraries against these criteria before adopting:
| Criterion | What to Check | Red Flag |
|---|
| Maintenance activity | Commits in last 90 days, open issues trend | No commits in 6+ months |
| Community size |
GitHub stars, npm weekly downloads, Discord/forum | < 1k weekly downloads for critical lib |
| Bundle size | Bundlephobia, tree-shaking support | > 50 KB gzipped for a utility lib |
| TypeScript support | Built-in types vs DefinitelyTyped, type quality | No types or outdated @types |
| Breaking change history | Changelog, semver adherence, migration guides | Frequent majors without guides |
| License | OSI-approved, compatible with your project | AGPL in a SaaS product, no license |
| Security audit | Snyk/Socket score, CVE history, dependency depth | Known unpatched CVEs |
| Documentation quality | Getting started guide, API reference, examples | README-only, no examples |
Quick heuristic: If you cannot replace the library within one sprint, treat the decision as a one-way door (see Reversibility Check below).
Architecture Decision Framework
Use these tradeoff tables when choosing between architectural approaches.
Monolith vs Microservices
| Factor | Monolith | Microservices |
|---|
| Complexity | Low at start, grows over time | High from day one |
| Deployment |
Single artifact | Independent per service |
| Team scaling | Harder beyond 10-15 engineers | Enables autonomous teams |
| Data consistency | ACID transactions | Eventual consistency, sagas |
| Debugging | Single process, easy tracing | Distributed tracing required |
| Best when | Early-stage, small team, MVP | Proven domain boundaries, scale needs |
SQL vs NoSQL
| Factor | SQL (Relational) | NoSQL (Document/Key-Value) |
|---|
| Schema | Strict, enforced | Flexible, schema-on-read |
| Relationships |
Native joins, foreign keys | Denormalized, application-level joins |
| Scaling | Vertical (read replicas help) | Horizontal by design |
| Consistency | Strong (ACID) | Tunable (eventual to strong) |
| Query flexibility | Ad-hoc queries, aggregations | Limited to access patterns |
| Best when | Complex relations, reporting | High write volume, flexible schema |
REST vs GraphQL
| Factor | REST | GraphQL |
|---|
| Simplicity | Simple, well-understood | Schema definition required |
| Over/under-fetching |
Common — multiple endpoints | Clients request exact fields |
| Caching | HTTP caching built-in | Requires custom caching layer |
| Tooling | Mature ecosystem | Growing — Apollo, Relay, urql |
| Versioning | URL or header versioning | Schema evolution, deprecation |
| Best when | CRUD APIs, public APIs | Complex UIs, mobile + web clients |
SSR vs CSR vs SSG
| Factor | SSR | CSR | SSG |
|---|
| Initial load | Fast (HTML from server) | Slow (JS bundle parse) | Fastest (pre-built HTML) |
| SEO |
Excellent | Poor without hydration | Excellent |
| Best when | Personalized pages | Dashboards, SPAs | Blogs, docs, marketing |
Monorepo vs Polyrepo
| Factor | Monorepo | Polyrepo |
|---|
| Code sharing | Trivial — same repo | Requires published packages |
| CI/CD complexity |
Needs smart filtering (Turborepo) | Simple per-repo pipelines |
| Best when | Shared libs, aligned releases | Independent teams, different stacks |
Priority Matrices — RICE Scoring
Score and rank features/tasks:
CODEBLOCK2
| Factor | Scale |
|---|
| Reach | Number of users/events affected per quarter |
| Impact |
3 = massive, 2 = high, 1 = medium, 0.5 = low, 0.25 = minimal |
| Confidence | 100% = high, 80% = medium, 50% = low |
| Effort | Person-weeks (or person-sprints) |
MoSCoW Method
| Category | Meaning | Budget Target |
|---|
| Must | Non-negotiable for this release | ~60% of effort |
| Should |
Important but not critical | ~20% of effort |
|
Could | Desirable if time permits | ~15% of effort |
|
Won't | Explicitly out of scope (this time) | ~5% (planning) |
Reversibility Check
Classify every significant decision as a one-way or two-way door.
| Aspect | One-Way Door (Type 1) | Two-Way Door (Type 2) |
|---|
| Definition | Irreversible or very costly to undo | Easily reversed with low cost |
| Examples |
Database engine migration, public API contract, language rewrite | UI framework for internal tool, feature flag experiment, library swap behind interface |
| How to identify | Would reverting require > 1 sprint of rework? Data migration? Customer communication? | Can you revert with a config change, flag toggle, or single PR? |
| Approach | Invest in analysis, prototype, get stakeholder sign-off | Decide fast, ship, measure, iterate |
| Time to decide | Days to weeks — thorough evaluation | Hours — bias toward action |
Rule of thumb: Wrap risky choices behind interfaces/abstractions. This converts many one-way doors into two-way doors by isolating the implementation from consumers.
ADR Template
Document significant decisions using a lightweight Architecture Decision Record.
CODEBLOCK3
Store in docs/adr/ or decisions/. Number sequentially. Never delete — mark superseded. Review during onboarding and quarterly audits.
Anti-Patterns
| Anti-Pattern | Description | Counter |
|---|
| Analysis Paralysis | Endless evaluation, no decision made | Set a decision deadline; use the matrix |
| HiPPO |
Highest Paid Person's Opinion overrides data | Require data or a scored matrix for all options |
| Sunk Cost Fallacy | Continuing because of past investment, not future value | Evaluate options as if starting fresh today |
| Bandwagon Effect | Choosing because "everyone uses it" | Score against your actual criteria |
| Premature Optimization | Optimizing before measuring or validating need | Profile first; optimize only proven bottlenecks |
| Resume-Driven Development | Picking tech to pad a resume, not to solve the problem | Align choices with team skills and project goals |
| Not Invented Here | Rejecting external solutions out of pride | Run the Build vs Buy framework honestly |
NEVER Do
- 1. NEVER skip writing down the decision — undocumented decisions get relitigated endlessly
- NEVER decide by committee without a single owner — assign a DRI (Directly Responsible Individual)
- NEVER treat all decisions as equal weight — classify by reversibility and impact first
- NEVER ignore second-order effects — ask "and then what?" at least twice
- NEVER lock in without an exit plan — define how you would migrate away before committing
- NEVER conflate familiarity with superiority — evaluate on criteria, not comfort
- NEVER defer a one-way door decision indefinitely — the cost of delay often exceeds the cost of a wrong choice
决策框架(元技能)
用于自信且可追溯地做出工程决策的结构化方法。
安装
OpenClaw / Moltbot / Clawbot
bash
npx clawhub@latest install decision-frameworks
使用时机
- - 在库、框架或工具之间进行选择
- 面临自建与采购的决策
- 选择架构模式(单体 vs 微服务、SQL vs NoSQL 等)
- 存在多个有效选项且团队需要达成一致
- 对积压任务或技术路线图进行优先级排序
- 记录重大技术决策以供将来参考
决策矩阵模板
在通过可衡量标准比较 3 个以上选项时,使用加权评分矩阵。
| 标准 | 权重 | 选项 A | 选项 B | 选项 C |
|---|
| 性能 | 5 | 4 (20) | 3 (15) | 5 (25) |
| 开发者体验 |
4 | 5 (20) | 4 (16) | 3 (12) |
| 社区支持 | 3 | 5 (15) | 3 (9) | 2 (6) |
| 学习曲线 | 3 | 3 (9) | 4 (12) | 2 (6) |
| 成本 | 2 | 5 (10) | 3 (6) | 4 (8) |
|
总计 | |
74 |
58 |
57 |
使用方法:
- 1. 列出与决策相关的标准
- 根据项目优先级分配权重(1-5)
- 对每个选项按标准评分(1-5)
- 将分数乘以权重,按选项求和
- 总分最高者胜出——但需对照直觉进行合理性检查
自建与采购框架
遵循此决策树:
这是你产品的核心差异化因素吗?
├── 是 → 自建(拥有竞争优势)
└── 否
├── 是否存在成熟且维护良好的解决方案?
│ ├── 是 → 采购/采用
│ └── 否 → 自建,但保持最小化
└── 集成成本是否高于自建成本?
├── 是 → 自建
└── 否 → 采购/采用
因素对比:
| 因素 | 自建 | 采购/采用 |
|---|
| 维护成本 | 持续——由你的团队负责 | 供应商/社区维护 |
| 定制化 |
无限灵活性 | 限于扩展点 |
| 上市时间 | 较慢——需要开发 | 更快——现成的 |
| 团队专长 | 必须拥有或获取技能 | 被抽象化 |
| 长期成本 | 随内部能力扩展 | 许可/订阅费用 |
| 供应商锁定风险 | 无 | 中到高 |
| 安全控制 | 完全审计能力 | 取决于供应商透明度 |
库/框架选择
在采用之前,根据以下标准评估候选库:
| 标准 | 检查内容 | 危险信号 |
|---|
| 维护活跃度 | 最近 90 天的提交、未解决问题趋势 | 6 个月以上无提交 |
| 社区规模 |
GitHub 星标、npm 周下载量、Discord/论坛 | 关键库周下载量 < 1k |
| 打包体积 | Bundlephobia、tree-shaking 支持 | 工具库 gzip 后 > 50 KB |
| TypeScript 支持 | 内置类型 vs DefinitelyTyped、类型质量 | 无类型或过时的 @types |
| 破坏性变更历史 | 变更日志、语义化版本遵守、迁移指南 | 频繁主版本更新且无指南 |
| 许可证 | OSI 批准、与项目兼容 | SaaS 产品中使用 AGPL、无许可证 |
| 安全审计 | Snyk/Socket 评分、CVE 历史、依赖深度 | 已知未修补的 CVE |
| 文档质量 | 入门指南、API 参考、示例 | 仅有 README、无示例 |
快速启发式方法: 如果你无法在一个冲刺周期内替换该库,则将此决策视为单向门(参见下面的可逆性检查)。
架构决策框架
在架构方法之间进行选择时,使用这些权衡表。
单体 vs 微服务
| 因素 | 单体 | 微服务 |
|---|
| 复杂性 | 开始时低,随时间增长 | 从第一天起就高 |
| 部署 |
单一制品 | 每个服务独立 |
| 团队扩展 | 超过 10-15 名工程师后更难 | 支持自治团队 |
| 数据一致性 | ACID 事务 | 最终一致性、Saga 模式 |
| 调试 | 单进程,易于追踪 | 需要分布式追踪 |
| 最佳场景 | 早期阶段、小团队、MVP | 已验证的领域边界、扩展需求 |
SQL vs NoSQL
| 因素 | SQL(关系型) | NoSQL(文档/键值) |
|---|
| 模式 | 严格、强制 | 灵活、读取时定义模式 |
| 关系 |
原生连接、外键 | 反规范化、应用层连接 |
| 扩展 | 垂直扩展(读副本有帮助) | 水平扩展(设计如此) |
| 一致性 | 强一致性(ACID) | 可调(最终到强) |
| 查询灵活性 | 即席查询、聚合 | 限于访问模式 |
| 最佳场景 | 复杂关系、报表 | 高写入量、灵活模式 |
REST vs GraphQL
| 因素 | REST | GraphQL |
|---|
| 简单性 | 简单、广为人知 | 需要定义模式 |
| 过度/不足获取 |
常见——多个端点 | 客户端请求精确字段 |
| 缓存 | 内置 HTTP 缓存 | 需要自定义缓存层 |
| 工具链 | 成熟生态系统 | 正在发展——Apollo、Relay、urql |
| 版本控制 | URL 或头部版本控制 | 模式演进、弃用 |
| 最佳场景 | CRUD API、公共 API | 复杂 UI、移动端 + Web 客户端 |
SSR vs CSR vs SSG
| 因素 | SSR | CSR | SSG |
|---|
| 初始加载 | 快速(来自服务器的 HTML) | 慢(JS 包解析) | 最快(预构建的 HTML) |
| SEO |
优秀 | 无水合时较差 | 优秀 |
| 最佳场景 | 个性化页面 | 仪表盘、SPA | 博客、文档、营销 |
单体仓库 vs 多仓库
| 因素 | 单体仓库 | 多仓库 |
|---|
| 代码共享 | 简单——同一仓库 | 需要发布包 |
| CI/CD 复杂性 |
需要智能过滤(Turborepo) | 每个仓库的简单流水线 |
| 最佳场景 | 共享库、对齐发布 | 独立团队、不同技术栈 |
优先级矩阵——RICE 评分
对功能/任务进行评分和排序:
RICE 分数 = (覆盖范围 x 影响 x 信心) / 工作量
3 = 巨大,2 = 高,1 = 中等,0.5 = 低,0.25 = 极小 |
| 信心 | 100% = 高,80% = 中等,50% = 低 |
| 工作量 | 人-周(或人-冲刺) |
MoSCoW 方法
| 类别 | 含义 | 预算目标 |
|---|
| 必须 | 本次发布不可协商 | 约 60% 的工作量 |
| 应该 |
重要但不关键 | 约 20% 的工作量 |
|
可以 | 时间允许时值得做 | 约 15% 的工作量 |
|
不会 | 明确不在范围内(本次) | 约 5%(规划) |
可逆性检查
将每个重大决策分类为单向门或双向门。
| 方面 | 单向门(类型 1) | 双向门(类型 2) |
|---|
| 定义 | 不可逆或撤销成本极高 | 易于逆转且成本低 |
| 示例 |
数据库引擎迁移、公共 API 契约、语言重写 | 内部工具的 UI 框架、功能标志实验、接口后的库替换 |
| 如何识别 | 撤销是否需要超过 1 个冲刺的重做?数据迁移?客户沟通? | 能否通过配置更改、标志切换或单个 PR 撤销? |
| 方法 | 投入分析、原型