UML 2.5 Class Diagram and Domain Object Model

    1

    Models UML 2.5 class structures: DDD aggregate roots, private encapsulation, and immutable MonetaryAmount objects.

    $5

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseOpenClawOpenClaw+21 more

    UML 2.5 Class Diagram and Domain Object Model

    Example session with this skill installed

    Model formal UML 2.5 Class Diagram, DDD aggregates, and encapsulation boundaries for Wholesale Banking Ledger.

    • Subject: wholesale-banking-ledger-core v3.0 (run-id: quote-classdiag-001) governing 42 accounting modules and $110B in commercial deposits.
    • Deciders: Chief Banking Systems Architect (David O'Reilly) and Head of Financial Accounting Systems (Elena Rostova).
    • Scope: UML 2.5 class modeling; Domain-Driven Design (DDD) aggregate boundaries; CorporateAccount Aggregate Root; composition associations; immutable MonetaryAmount.
    • Tension: Public mutable collection setters allowed external UI controllers to mutate internal debit/credit lists directly in incident CLS-4919, bypassing double-entry checks and causing a $4.8M ledger imbalance. David O'Reilly and Elena Rostova mandate an authoritative UML Class Diagram: strict private encapsulation, defensive unmodifiable getters, and value object immutability.

    Write the uml class diagram under docs/.

    • Read your context and instructions
    • Compiled the uml 2 5
    • Generated the document

    Wrote docs/architecture/tasks/quote-classdiag-001/class-diagram/uml-class-diagram.md. Complete UML class diagram specification establishing object-oriented entity models, inheritance hierarchies, composition associations, and encapsulation boundaries for wholesale core banking.


    skill: class-diagram

    UML Class Diagram Specification: Wholesale Banking Ledger [CLASS-BANK-001]

    Summary

    This specification establishes the formal UML 2.5 Class Diagram modeling, object-oriented structural relationships, visibility modifiers, domain entities, value objects, and inheritance hierarchies for wholesale-banking-ledger-core v3.0 under run ID quote-classdiag-001. It governs static object-oriented domain modeling across 42 core accounting modules managing $110B in commercial corporate deposits across 18,000 corporate clients. It decisively investigates and resolves the balance corruption and mutability leaks demonstrated in incident CLS-4919 (where lack of encapsulation and public mutable collection setters allowed external UI adapter controllers to mutate internal debit/credit ledger collections directly without routing through double-entry accounting invariants, introducing a $4.8M reconciliation imbalance across 1,400 corporate accounts). The specification models the complete Domain-Driven Design (DDD) aggregate hierarchy for double-entry bookkeeping, enforces

    strict private encapsulation with immutable value objects, establishes composition associations ($1 \text{ to } 1..*$) guaranteeing ledger integrity, and provides

    executable Mermaid and PlantUML class diagrams.

    Detailed Description

    Operating complex transactional banking platforms with poorly structured object models or primitive data types (like passing raw strings and loose floating-point doubles for money) produces severe financial corruption. When entities expose public mutable setters, developers bypass critical domain rules: an account balance can be changed without generating an audit entry, or an order can be marked paid without recording a transaction reference. UML Class Modeling establishes

    Strict Domain Object Structure & Encapsulation: it formalizes Domain-Driven Design (DDD) patterns (Aggregate Roots, Entities, Value Objects), enforces strong typing (such as immutable MonetaryAmount value objects with ISO 4217 currency validation), models exact structural relationships (Composition, Aggregation, Association, Realization), and defines clear visibility boundaries (- private, # protected, + public) to protect domain invariants against accidental external mutation.

    Corporate Account Aggregate Boundary (UML Class Architecture)
    ┌─────────────────────────────────────────────────────────────────────────────┐
    │ Aggregate Root: CorporateAccount                                            │
    │   ├── - accountId: AccountId [PK, Immutable]                                │
    │   ├── - currentBalance: MonetaryAmount [Value Object]                       │
    │   └── - status: AccountStatus [Enum: ACTIVE, FROZEN, CLOSED]               │
    │                                                                             │
    │   ▲ (Enforces 1:N Composition Association -- Lifetime Bound)                │
    │   │                                                                         │
    │   └──◆ 1..*  LedgerEntry                                                    │
    │         ├── - entryId: EntryId                                              │
    │         ├── - entryType: EntryType [DEBIT, CREDIT]                          │
    │         ├── - amount: MonetaryAmount [Value Object]                         │
    │         └── - bookingTimestamp: Instant                                    │
    └─────────────────────────────────────────────────────────────────────────────┘
      (External Controllers CANNOT Mutate Entries Directly: CLS-4919 Fixed)
    

    Criteria and weights

    CriterionWhy it matters hereWeightSource of the weight
    Domain Encapsulation & Mutability ProtectionPublic collection setters caused incident CLS-4919 ($4.8M reconciliation error).0.40David O'Reilly (Chief Banking Systems Architect)
    Value Object Immutability (MonetaryAmount)Primitive obsession (using floats) leads to floating-point currency rounding drift.0.30Elena Rostova (Head of Financial Accounting Systems)
    Association Multiplicity Precision ($1 \text{ to } 1..*$)Proves that ledger entries cannot exist orphaned without an owning parent account.0.15Corporate Banking Audit Directorate
    Standard UML 2.5 Specification PortabilityCode generation tools and developers must parse unambiguous relationship arrows.0.15Software Architecture & Engineering Guild

    Comparison

    Class Modeling ApproachEncapsulation EnforcementValue Object DisciplineMultiplicity SemanticsEvaluation
    Option A: Anemic Domain Model with Get/Set (Legacy)None (Public setters leaked in CLS-4919)Low (Raw doubles for money)VagueRejected: Caused CLS-4919 disaster; unviable.
    Option B: Relational Table ERD Mapping OnlyNone (Lacks OO methods)LowRelational onlyRejected: Lacks behavioral invariants and encapsulation.
    Option C: DDD UML 2.5 Class Architecture (Chosen)Absolute (Private fields + domain methods)100% Immutable Value ObjectsFormal Composition ArrowsSelected: 100% encapsulation, proven integrity.

    Result

    Option C is selected. Rich Domain-Driven Design (DDD) UML class modeling is standardized; CorporateAccount acts as the sole Aggregate Root; LedgerEntry is composed and protected; MonetaryAmount is an immutable value object.


    Required Mechanisms

    1. UML 2.5 Class Diagram Specification [MC-CD-01]
    classDiagram
        class CorporateAccount {
            -AccountId accountId
            -AccountHolder corporateHolder
            -MonetaryAmount currentBalance
            -AccountStatus status
            -List~LedgerEntry~ entries
            +CorporateAccount(AccountId id, AccountHolder holder)
            +postTransaction(TransactionCommand cmd) PostingReceipt
            +freezeAccount(String justification) void
            +getBalance() MonetaryAmount
            +getEntries() List~LedgerEntry~
            -validateDoubleEntryInvariant(MonetaryAmount delta) void
        }
    
        class LedgerEntry {
            -EntryId entryId
            -EntryType type
            -MonetaryAmount amount
            -String description
            -Instant bookingTimestamp
            ~LedgerEntry(EntryId id, EntryType type, MonetaryAmount amt)
            +getAmount() MonetaryAmount
            +getType() EntryType
            +getTimestamp() Instant
        }
    
        class MonetaryAmount {
            -BigInteger minorUnits
            -CurrencyCode currency
            +MonetaryAmount(BigInteger units, CurrencyCode curr)
            +add(MonetaryAmount other) MonetaryAmount
            +subtract(MonetaryAmount other) MonetaryAmount
            +getMinorUnits() BigInteger
            +getCurrency() CurrencyCode
        }
    
        class AccountId {
            -UUID value
            +AccountId(UUID val)
            +getValue() UUID
        }
    
        class EntryType {
            DEBIT
            CREDIT
        }
    
        class AccountStatus {
            ACTIVE
            FROZEN
            CLOSED
        }
    
        CorporateAccount "1" *-- "1..*" LedgerEntry : Compiles & Owns (Composition)
        CorporateAccount --> MonetaryAmount : Uses (Aggregation)
        CorporateAccount --> AccountId : Identified by
        CorporateAccount --> AccountStatus : Governed by
        LedgerEntry --> MonetaryAmount : Represents
        LedgerEntry --> EntryType : Classifies
    
    2. The CLS-4919 Encapsulation Leak Remediation [MC-ER-01]

    Root Cause: In incident CLS-4919, the legacy class exposed public void setEntries(List(LedgerEntry) entries), allowing a web controller to overwrite the list directly and bypass validation.

    • Architectural Remedy:
      • entries is declared private final.
      • getEntries() returns an unmodifiable defensive copy (Collections.unmodifiableList()).
      • Mutations must route through the domain method postTransaction(TransactionCommand cmd), which evaluates account status and executes double-entry debit/credit validation before appending.
    3. Value Object Immutability (MonetaryAmount) [MC-VO-01]
    • MonetaryAmount contains no setters:
      • Stores currency values in integer minor units (cents) via BigInteger, completely eliminating IEEE 754 floating-point rounding errors.
      • Arithmetic operations (add, subtract) enforce currency matching and return fresh immutable instances.

    Invariants and Contracts

    Mandatory Aggregate Root Encapsulation [INV-CLASS-01]
      Entities within an aggregate boundary must be mutated exclusively through the designated Aggregate Root.
      Exposing public mutable setters or direct collection references to internal entities is strictly prohibited.
    
    Value Object Strict Immutability [INV-CLASS-02]
      Domain value objects (`MonetaryAmount`, `AccountId`, `Address`) must be completely immutable.
      Value object classes must declare all fields as private and final, with zero mutating methods.
    
    Formal Composition Lifetime Binding [INV-CLASS-03]
      Child entities that cannot exist independently of their parent must be modeled with UML Composition (`*--`).
      Deleting or unlinking parent aggregates must cascade lifecycle destruction to all composed child entities.
    

    Explicit Unknowns

    • Memory allocation overhead in Java virtual machines when high-frequency ledger sweeps instantiate 500,000 ephemeral MonetaryAmount value objects per second (G-1).
    • Object-Relational Mapping (Hibernate) impedance mismatch when mapping immutable nested value objects to PostgreSQL composite columns (G-2).

    Traceability

    ClaimClassificationSourceFreshness
    42 core accounting modules across 18,000 clientsprovidedWholesale banking portfolio intakeCurrent
    $110B in commercial corporate depositsprovidedFinancial scope briefCurrent
    Incident CLS-4919 $4.8M reconciliation errorprovidedHistorical forensic accounting auditHistorical
    UML 2.5 and DDD Aggregate Root standardsprovidedCorporate Software Architecture PolicyCurrent
    DDD UML 2.5 Class Architecture selecteddecidedDavid O'Reilly & Elena Rostova2026-09-15
    Mandatory aggregate root encapsulation invariantdecidedArchitectural invariant INV-CLASS-012026-09-15

    Verification

    No validator was supplied, so no command was run.

    Reviewer self-check against class diagram standards:

    • Encapsulation Rigor: PASS. Private fields with defensive unmodifiable getters close CLS-4919 flaw.
    • Value Object Discipline: PASS. Immutable MonetaryAmount with BigInteger minor units prevents float drift.
    • Multiplicity Precision: PASS. Explicit composition relationship (1 *-- 1..*) bound to Aggregate Root.
    • Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to rule_markdown.md.

    Open Decisions

    • DEC-CLASS-01: David O'Reilly to determine whether Java 21 Records should be standardized for all Domain Value Objects to eliminate boilerplate in Q1 (Owner: David O'Reilly).

    Next steps

    1. Core Banking squad implements the CorporateAccount aggregate root using the standardized UML class structure.
    2. Architecture team configures ArchUnit tests verifying zero public mutable setters across domain packages.
    3. Conduct staging transactional test executing 100,000 concurrent postings to verify double-entry invariant enforcement.

    uml-2-5-class-diagram-and-domain-object-.pdf

    PDF · document

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    What you get

    Document DDD aggregate roots and private encapsulation boundariesModel immutable MonetaryAmount value objects and domain typesResolve structural ambiguity between composition and aggregation relationshipsGenerate traceable UML class hierarchies from authoritative domain contracts

    About this skill

    What it does

    This skill maps an authoritative structural, domain or type contract into UML class semantics. It preserves classifier/feature identity, relationship meaning, multiplicity, ownership, constraints, provenance and notation loss.

    Use it when

    Use when consumers need a reproducible UML structural view of already supplied classifiers and relationships at an explicit abstraction level.

    For example: “Two developers implemented lending rules differently because the model says a Loan has Copies and nobody knows if a Copy can exist without a Loan.”

    What you get

    • UML Class Diagram

    Written as Markdown to <your output folder>/architecture/tasks/<run-id>/class-diagram/.

    What it will not do

    Do not use for domain modeling, ERD/schema, component/API/DTO design, code architecture/refactoring, generation, reverse engineering or implementation.

    How it works

    1. Check the model is a domain model, not a database schema.
    2. Include only classes that carry the concept being explained.
    3. State multiplicity and navigability on every association.
    4. Distinguish composition from aggregation deliberately.
    5. Put the invariants on the model, not only in prose.
    6. Write the deliverable, classify every claim by its evidence, and check it before calling the work done.

    What's in the package

    Instruction-only: no scripts, no network calls, no environment variables.

    • LICENSE.txt
    • SKILL.md
    • agents/openai.yaml
    • assets/output-template-task.md
    • references/domain-rules.md
    • references/operating-rules.md
    • references/output-contract.md

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 12 days ago

    • Passed all security checks, Safe to install

    Listed12 days ago

    What's inside

    Frequently Asked Questions