mcpField
U
uml-modeling

uml-modeling

github.com/melodic-softwareDevelopment2887 installsUpdated today
Repository

About uml-modeling

uml-modeling is a skill for creating UML diagrams in software design documentation, aimed at developers working on requirements, system design, and architecture records. It provides PlantUML and Mermaid examples and requires documentation guidance, syntax checks, and UML 2.5 alignment.

Key features

  1. 01Covers structural and behavioral diagram types
  2. 02Includes PlantUML and Mermaid examples
  3. 03Guides diagram selection by design purpose
  4. 04Requires documentation-first guidance and syntax checks
  5. 05Provides a drafting and review workflow

Use cases

  1. 01Documenting system structure with class and component diagrams
  2. 02Describing API or protocol flows with sequence diagrams
  3. 03Representing processes and requirements with activity and use case diagrams
  4. 04Recording lifecycle transitions with state machine diagrams

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/melodic-software/claude-code-plugins --skill uml-modeling

After installing, type/uml-modelingin Claude Code to confirm it loaded.

Details

From the project README

UML Modeling Skill

When to Use This Skill

Use this skill when:

  • Uml Modeling tasks - Working on uml diagram generation including class, sequence, activity, use case, and state diagrams
  • Planning or design - Need guidance on Uml Modeling approaches
  • Best practices - Want to follow established patterns and standards

Overview

Create UML diagrams using PlantUML and Mermaid notation for software design documentation.

MANDATORY: Documentation-First Approach

Before creating UML diagrams:

  1. Invoke docs-management skill for UML standards guidance
  2. Verify diagram syntax using appropriate notation (PlantUML/Mermaid)
  3. Base all guidance on UML 2.5 specification

UML Diagram Types

Structural Diagrams
DiagramPurposeWhen to Use
ClassShow classes, attributes, methods, relationshipsDomain modeling, design
ComponentShow components and dependenciesArchitecture documentation
DeploymentShow physical deploymentInfrastructure planning
ObjectShow object instancesSpecific scenarios
PackageShow namespaces/modulesCode organization
Behavioral Diagrams
DiagramPurposeWhen to Use
Use CaseShow actor-system interactionsRequirements
SequenceShow message flow over timeAPI design, protocols
ActivityShow workflows and processesBusiness processes
State MachineShow state transitionsLifecycle modeling
CommunicationShow object interactionsDesign patterns

Class Diagram

PlantUML Syntax
@startuml
skinparam classAttributeIconSize 0

abstract class Entity {
  +Id: Guid
  +CreatedAt: DateTimeOffset
  +UpdatedAt: DateTimeOffset
}

class Order extends Entity {
  -_lineItems: List<LineItem>
  +CustomerId: Guid
  +Status: OrderStatus
  +Total: Money
  --
  +AddItem(product: Product, quantity: int): Result<LineItem>
  +RemoveItem(lineItemId: Guid): Result
  +Submit(): Result
  +Cancel(): Result
}

class LineItem extends Entity {
  +ProductId: Guid
  +ProductName: string
  +Quantity: int
  +UnitPrice: Money
  +LineTotal: Money
}

enum OrderStatus {
  Draft
  Submitted
  Paid
  Shipped
  Delivered
  Cancelled
}

class Money <<value object>> {
  +Amount: decimal
  +Currency: string
  +{static} Zero: Money
  +Add(other: Money): Money
  +Multiply(factor: decimal): Money
}

Order "1" *-- "0..*" LineItem : contains
Order --> OrderStatus
Order --> Money
LineItem --> Money

@enduml
Mermaid Class Diagram
classDiagram
    class Entity {
        <<abstract>>
        +Guid Id
        +DateTimeOffset CreatedAt
        +DateTimeOffset UpdatedAt
    }

    class Order {
        -List~LineItem~ _lineItems
        +Guid CustomerId
        +OrderStatus Status
        +Money Total
        +AddItem(Product, int) Result~LineItem~
        +RemoveItem(Guid) Result
        +Submit() Result
        +Cancel() Result
    }

    class LineItem {
        +Guid ProductId
        +string ProductName
        +int Quantity
        +Money UnitPrice
        +Money LineTotal
    }

    class OrderStatus {
        <<enumeration>>
        Draft
        Submitted
        Paid
        Shipped
        Delivered
        Cancelled
    }

    Entity <|-- Order
    Entity <|-- LineItem
    Order "1" *-- "0..*" LineItem : contains
    Order --> OrderStatus
Relationship Types
// UML Relationship Reference
public static class UMLRelationships
{
    // Association: uses, knows about
    // Customer --> Order (Customer uses Order)

    // Aggregation: has-a (shared ownership)
    // Team o-- Player (Team has Players, Players can exist independently)

    // Composition: contains (exclusive ownership)
    // Order *-- LineItem (Order contains LineItems, LineItems cannot exist without Order)

    // Inheritance: is-a
    // Dog --|> Animal (Dog extends Animal)

    // Implementation: implements
    // UserService ..|> IUserService (UserService implements IUserService)

    // Dependency: depends on
    // Controller ..> Service (Controller depends on Service)
}

Sequence Diagram

PlantUML Syntax
@startuml
title Order Submission Flow

actor Customer
participant "API Gateway" as API
participant "Order Service" as Orders
participant "Payment Service" as Payment
participant "Notification Service" as Notify
database "Order DB" as DB
queue "Message Bus" as Bus

Customer -> API: POST /orders/{id}/submit
activate API

API -> Orders: SubmitOrder(orderId)
activate Orders

Orders -> DB: GetOrder(orderId)
activate DB
DB --> Orders: Order
deactivate DB

alt Order is valid
    Orders -> Payment: ProcessPayment(order)
    activate Payment

    Payment --> Orders: PaymentResult
    deactivate Payment

    alt Payment successful
        Orders -> DB: UpdateStatus(Paid)
        Orders -> Bus: Publish(OrderSubmitted)
        Bus -> Notify: OrderSubmitted
        activate Notify
        Notify -> Notify: SendConfirmation()
        deactivate Notify

        Orders --> API: Success
        API --> Customer: 200 OK
    else Payment failed
        Orders --> API: PaymentFailed
        API --> Customer: 402 Payment Required
    end
else Order invalid
    Orders --> API: ValidationError
    API --> Customer: 400 Bad Request
end

deactivate Orders
deactivate API

@enduml
Mermaid Sequence Diagram
sequenceDiagram
    participant C as Customer
    participant A as API Gateway
    participant O as Order Service
    participant P as Payment Service
    participant D as Database

    C->>A: POST /orders/{id}/submit
    activate A
    A->>O: SubmitOrder(orderId)
    activate O
    O->>D: GetOrder(orderId)
    D-->>O: Order

    alt Order valid
        O->>P: ProcessPayment(order)
        P-->>O: PaymentResult

        alt Payment successful
            O->>D: UpdateStatus(Paid)
            O-->>A: Success
            A-->>C: 200 OK
        else Payment failed
            O-->>A: PaymentFailed
            A-->>C: 402 Payment Required
        end
    else Order invalid
        O-->>A: ValidationError
        A-->>C: 400 Bad Request
    end

    deactivate O
    deactivate A

Activity Diagram

PlantUML Syntax
@startuml
title Order Processing Workflow

start

:Customer submits order;

:Validate order;

if (Order valid?) then (yes)
  :Calculate totals;
  :Reserve inventory;

  fork
    :Process payment;
  fork again
    :Send confirmation email;
  end fork

  if (Payment successful?) then (yes)
    :Confirm inventory;
    :Create shipment;
    :Update order status;
    stop
  else (no)
    :Release inventory;
    :Notify customer;
    stop
  endif
else (no)
  :Return validation errors;
  stop
endif

@enduml

Use Case Diagram

PlantUML Syntax
@startuml
left to right direction

actor Customer
actor "Warehouse Staff" as Warehouse
actor Admin

rectangle "E-Commerce System" {
  usecase "Browse Products" as UC1
  usecase "Add to Cart" as UC2
  usecase "Checkout" as UC3
  usecase "Track Order" as UC4
  usecase "Process Refund" as UC5
  usecase "Manage Inventory" as UC6
  usecase "Fulfill Order" as UC7
  usecase "Generate Reports" as UC8

  Customer --> UC1
  Customer --> UC2
  Customer --> UC3
  Customer --> UC4
  Customer --> UC5

  Warehouse --> UC6
  Warehouse --> UC7

  Admin --> UC6
  Admin --> UC8

  UC3 ..> UC2 : <<include>>
  UC5 ..> UC4 : <<extend>>
}

@enduml

State Machine Diagram

PlantUML Syntax
@startuml
title Order State Machine

[*] --> Draft : Create

Draft --> Submitted : Submit
Draft --> Cancelled : Cancel

Submitted --> Paid : PaymentReceived
Submitted --> Cancelled : Cancel
Submitted --> Draft : RequiresChanges

Paid --> Shipped : Ship
Paid --> Refunded : Refund

Shipped --> Delivered : Deliver
Shipped --> Returned : Return

Delivered --> Completed : Finalize
Delivered --> Returned : Return

Returned --> Refunded : ProcessReturn

Completed --> [*]
Refunded --> [*]
Cancelled --> [*]

@enduml
Mermaid State Diagram
stateDiagram-v2
    [*] --> Draft : Create

    Draft --> Submitted : Submit
    Draft --> Cancelled : Cancel

    Submitted --> Paid : PaymentReceived
    Submitted --> Cancelled : Cancel
    Submitted --> Draft : RequiresChanges

    Paid --> Shipped : Ship
    Paid --> Refunded : Refund

    Shipped --> Delivered : Deliver
    Shipped --> Returned : Return

    Delivered --> Completed : Finalize
    Delivered --> Returned : Return

    Returned --> Refunded : ProcessReturn

    Completed --> [*]
    Refunded --> [*]
    Cancelled --> [*]

Component Diagram

PlantUML Syntax
@startuml
title System Components

package "Presentation Layer" {
  [Web Application] as Web
  [Mobile App] as Mobile
}

package "API Layer" {
  [API Gateway] as Gateway
  [GraphQL Server] as GraphQL
}

package "Business Layer" {
  [Order Service] as Orders
  [Payment Service] as Payment
  [Notification Service] as Notify
  [User Service] as Users
}

package "Data Layer" {
  database "Order DB" as OrderDB
  database "User DB" as UserDB
  queue "Message Bus" as Bus
}

package "External" {
  [Payment Provider] as PaymentExt
  [Email Service] as EmailExt
}

Web --> Gateway
Mobile --> Gateway
Gateway --> GraphQL
Gateway --> Orders
Gateway --> Users

Orders --> OrderDB
Orders --> Bus
Users --> UserDB

Payment --> PaymentExt
Notify --> EmailExt
Notify --> Bus

@enduml

Best Practices

General Guidelines
  1. Keep diagrams focused: One concept per diagram
  2. Use consistent notation: Choose PlantUML or Mermaid per project
  3. Add meaningful names: Clear, descriptive labels
  4. Include legends: For complex diagrams
  5. Version control: Store in repository with code
Diagram Selection Guide
NeedDiagram Type
Data structures, domain modelClass Diagram
API flow, protocolsSequence Diagram
Business processesActivity Diagram
Actor interactionsUse Case Diagram
Lifecycle, state transitionsState Machine
System structureComponent Diagram
InfrastructureDeployment Diagram

Workflow

When creating UML diagrams:

  1. Identify purpose: What question does the diagram answer?
  2. Select diagram type: Choose most appropriate type
  3. Draft in text: Use PlantUML or Mermaid notation
  4. Review for accuracy: Verify against code/requirements
  5. Add context: Title, notes, legend as needed
  6. Render and verify: Ensure diagram renders correctly

References

For detailed notation guides:


Last Updated: 2025-12-26

Comments

Markdown supported