/polymath-architecture:aggregate-designfrom polymath-architecture
Design DDD tactical aggregates for a bounded context — aggregate roots, entities vs value objects, invariants, transaction/consistency boundaries, reference-by-id.
Ships in polymath-architecture. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An aggregate is a consistency boundary, not a data model. Get the invariants right and the boundaries fall out; get them wrong and you fight the database forever.
Mode: analytical — judgment inside a fixed frame. Keep the output shape; every verdict cites its evidence; unknowns are marked [TBD] or [VERIFY], never filled in.
bounded-context-map) and need its internal object model.polymath-architecture:aggregate-design.Not this when: you are choosing cross-node consistency (eventual vs strong across services) — that is distributed-consistency. For the persistence DDL, hand off to polymath-backend:db-schema.
Aggregate model: Refunds context
Refund (root) invariant: Σ refunds ≤ captured amount of the payment
RefundLine entity (identity: line id; lifecycle: requested → issued → settled)
Money value object (amount, currency) — immutable
references Payment by id (PaymentId), never by object
version: optimistic concurrency column `version`
Payment (root, Payments context) invariant: captured ≤ authorized
emits PaymentCaptured → Refunds caches capturedAmount per PaymentId
Domain events
RefundIssued(refundId, paymentId, amount) → Ledger posts the reversal (eventual)
Invariants spanning two aggregates (rethink):
- "a refund cannot exceed the *remaining* capture" needs Payment + all Refunds → keep a
RefundAllowance on Refund, fed by PaymentCaptured / RefundIssued, not a two-aggregate transaction.
Inline by default; when a workflow step or the user wants it kept, write it to docs/architecture/<slug>-aggregates.md (slug from the system or context name, lowercased, non-a-z0-9 runs → -).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub mohammadbafkar/polymath --plugin polymath-architecture8 skills in this plugin
/bounded-context-mapMap a domain into DDD bounded contexts + a context map (customer-supplier, conformist, anti-corruption layer, shared kernel) with per-context ubiquitous language./design-patterns-applyReview a design sketch against SOLID, GoF, and architectural patterns; flag anti-patterns at design time; not line-level code review (code-review)./distributed-consistencyChoose a consistency model for a cross-node operation — strong/eventual/causal, CAP/PACELC trade-off, idempotency + dedup, and when consensus (Raft/quorum) is warranted vs simpler.Other plugins' skills for the same job