帮助你选择合适的架构原语,并判断某种设计模式是否真正适用。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "architecture-primitives" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/amplifier-bundle-systems-design/main/skills/architecture-primitives/SKILL.md 2. 保存为 ~/.claude/skills/architecture-primitives/SKILL.md 3. 装好后重载技能,告诉我可以用了
我正在设计一个订单系统,涉及支付、库存、物流三个模块。请从 architecture primitives 的角度分析 boundary 和 contract 应该如何划分,并指出哪些划分方式常见但不合理。
给出边界与接口契约的划分建议,并说明适用场景、风险和不推荐做法。
我们要实现售后工单流程,状态包括待受理、处理中、待用户确认、已关闭。请比较使用 state machine 与 queue 的优缺点,并判断哪种更适合这个场景,为什么。
输出两种原语的对比、适配理由,以及错误选型可能带来的问题。
请帮我审查一个商品详情服务的方案:数据库前加缓存,允许短暂数据延迟。请结合 cache 和 consistency model,说明这种设计什么时候合理、什么时候不该用,以及需要补充哪些保护措施。
给出缓存与一致性模型的适用性判断、限制条件及改进建议。
An architect who knows many patterns is less useful than one who knows when each pattern is wrong.
For each primitive: what it is, when to use it, and when it will hurt you.
What it is. Drawing lines between components so each has a clear owner, clear interface, and can evolve independently.
When it's right. When different teams own different parts. When components have different scaling, deployment, or reliability requirements. When you need to limit blast radius.
When it's wrong. When the "boundary" creates more cross-boundary coordination than it prevents. When data that changes together is split across boundaries. When the team is small enough that communication overhead exceeds boundary value.
What it is. Explicit agreements between components about what they provide and expect — API schemas, message formats, SLAs, error codes.
When it's right. At every boundary. Between any components that evolve independently. When multiple consumers depend on the same provider.
When it's wrong. Premature contracts between components that are still being designed together. Overly rigid contracts that prevent necessary evolution. Contracts without versioning strategy.
What it is. For every piece of state, exactly one system is authoritative. All others are caches, replicas, or derived views.
When it's right. Always. Every system should be able to answer "where is the source of truth for X?"
When it's wrong. Never wrong as a concept — but wrong when applied as "one database for everything." Different data has different truth owners.
What it is. Sync: caller waits for response. Async: caller sends message and continues.
When sync is right. When the caller genuinely cannot proceed without the response. User-facing request/response flows. Reads that must be consistent.
When sync is wrong. When the caller doesn't need the result to continue. When the called service is slow or unreliable. When you're creating temporal coupling between services that don't need it.
When async is right. When work can be deferred. When you need to absorb load spikes. When producer and consumer should be independently deployable and scalable.
When async is wrong. When you need an immediate, consistent response. When the added complexity of message delivery, ordering, and failure handling exceeds the benefit.
What it is. Modeling entities as having explicit states with defined transitions. An order is "placed → confirmed → shipped → delivered," not a bag of boolean flags.
When it's right. When an entity has a lifecycle with distinct phases. When invalid state transitions are a real failure mode. When you need to audit or replay state changes.
When it's wrong. When the entity's behavior doesn't meaningfully vary by state. When the state space is too large to enumerate. When you're adding a state machine to something that is really just a CRUD record.
What it is. Decoupling producers from consumers with an intermediate buffer. Smooths out rate differences and absorbs spikes.
When it's right. When producer rate exceeds consumer rate temporarily. When consumer failures shouldn't block producers. When you need to prioritize or reorder work.
When it's wrong. When the queue grows unboundedly (you've moved the problem, not solved it). When end-to-end latency matters and the queue adds unacceptable delay. When queue failure becomes a single point of failure worse than direct coupling.
What it is. Storing computed or fetched results closer to the consumer to avoid repeated expensive operations.
When it's right. When reads vastly outnumber writes. When the source is slow and staleness is acceptable. When the working set fits in memory.
…
帮助设计可离线运行的边缘系统,处理同步、冲突恢复与弱网故障场景。
帮助设计与评估企业系统集成方案,覆盖遗留改造、网关、事件与失效模式。
用于按七步法系统审查架构设计,识别风险、权衡并产出改进建议。
用 Unix/Linux 设计哲学评估系统方案的可组合性、简洁性与关注点分离。
帮助用户设计或评估基于 Azure 的系统架构与运维方案
帮助设计和评估多租户SaaS的平台隔离、计量计费与稳定性方案
帮助用户设计系统、服务与技术架构,并梳理接口、数据模型和服务边界。
帮助你创建或评审架构决策记录,明确技术取舍、约束与影响。
帮助你快速理解 Pyre/Pysa 代码架构并定位关键实现位置
帮助开发者设计、实现并重构六边形架构系统,确保边界清晰且易于测试。
帮助设计和评估事件驱动、消息驱动与异步工作流系统架构。
帮助用户设计与评估分布式系统的核心机制、权衡与故障处理方案