@groupby/ai-dev 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/package.json +1 -1
  2. package/teams/fhr-neowise/commands/address-pr.md +120 -0
  3. package/teams/fhr-neowise/commands/ready-pr.md +70 -0
  4. package/teams/fhr-neowise/commands/review-pr.md +111 -0
  5. package/teams/fhr-neowise/commands/tdd-implementation.md +86 -0
  6. package/teams/fhr-neowise/commands/write-plan.md +23 -0
  7. package/teams/fhr-neowise/commands/write-pr.md +21 -0
  8. package/teams/fhr-neowise/commands/write-spec.md +25 -0
  9. package/teams/fhr-neowise/skills/agent-routing/SKILL.md +72 -0
  10. package/teams/fhr-neowise/skills/code-review/SKILL.md +83 -0
  11. package/teams/fhr-neowise/skills/code-review/review-template.md +90 -0
  12. package/teams/fhr-neowise/skills/mermaid-diagram/SKILL.md +94 -0
  13. package/teams/fhr-neowise/skills/mermaid-diagram/references/BEST_PRACTICES.md +96 -0
  14. package/teams/fhr-neowise/skills/mermaid-diagram/references/architecture.md +434 -0
  15. package/teams/fhr-neowise/skills/mermaid-diagram/references/block.md +753 -0
  16. package/teams/fhr-neowise/skills/mermaid-diagram/references/c4.md +619 -0
  17. package/teams/fhr-neowise/skills/mermaid-diagram/references/classDiagram.md +1186 -0
  18. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-configuration.md +72 -0
  19. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-directives.md +342 -0
  20. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-layouts.md +40 -0
  21. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-math.md +96 -0
  22. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-theming.md +246 -0
  23. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-tidy-tree.md +89 -0
  24. package/teams/fhr-neowise/skills/mermaid-diagram/references/cynefin.md +279 -0
  25. package/teams/fhr-neowise/skills/mermaid-diagram/references/entityRelationshipDiagram.md +670 -0
  26. package/teams/fhr-neowise/skills/mermaid-diagram/references/eventmodeling.md +475 -0
  27. package/teams/fhr-neowise/skills/mermaid-diagram/references/examples.md +301 -0
  28. package/teams/fhr-neowise/skills/mermaid-diagram/references/flowchart.md +2116 -0
  29. package/teams/fhr-neowise/skills/mermaid-diagram/references/gantt.md +725 -0
  30. package/teams/fhr-neowise/skills/mermaid-diagram/references/gitgraph.md +2138 -0
  31. package/teams/fhr-neowise/skills/mermaid-diagram/references/ishikawa.md +66 -0
  32. package/teams/fhr-neowise/skills/mermaid-diagram/references/kanban.md +161 -0
  33. package/teams/fhr-neowise/skills/mermaid-diagram/references/mindmap.md +335 -0
  34. package/teams/fhr-neowise/skills/mermaid-diagram/references/packet.md +153 -0
  35. package/teams/fhr-neowise/skills/mermaid-diagram/references/pie.md +93 -0
  36. package/teams/fhr-neowise/skills/mermaid-diagram/references/quadrantChart.md +267 -0
  37. package/teams/fhr-neowise/skills/mermaid-diagram/references/radar.md +269 -0
  38. package/teams/fhr-neowise/skills/mermaid-diagram/references/railroad.md +337 -0
  39. package/teams/fhr-neowise/skills/mermaid-diagram/references/requirementDiagram.md +495 -0
  40. package/teams/fhr-neowise/skills/mermaid-diagram/references/sankey.md +415 -0
  41. package/teams/fhr-neowise/skills/mermaid-diagram/references/sequenceDiagram.md +1195 -0
  42. package/teams/fhr-neowise/skills/mermaid-diagram/references/stateDiagram.md +670 -0
  43. package/teams/fhr-neowise/skills/mermaid-diagram/references/timeline.md +571 -0
  44. package/teams/fhr-neowise/skills/mermaid-diagram/references/treeView.md +321 -0
  45. package/teams/fhr-neowise/skills/mermaid-diagram/references/treemap.md +353 -0
  46. package/teams/fhr-neowise/skills/mermaid-diagram/references/userJourney.md +42 -0
  47. package/teams/fhr-neowise/skills/mermaid-diagram/references/venn.md +134 -0
  48. package/teams/fhr-neowise/skills/mermaid-diagram/references/wardley.md +732 -0
  49. package/teams/fhr-neowise/skills/mermaid-diagram/references/xyChart.md +312 -0
  50. package/teams/fhr-neowise/skills/mermaid-diagram/references/zenuml.md +474 -0
  51. package/teams/fhr-neowise/skills/mermaid-diagram/scripts/sync_docs.py +138 -0
  52. package/teams/fhr-neowise/skills/pull-request-authoring/COMPLEX.template.md +52 -0
  53. package/teams/fhr-neowise/skills/pull-request-authoring/NON-CODE.template.md +15 -0
  54. package/teams/fhr-neowise/skills/pull-request-authoring/SIMPLE.template.md +20 -0
  55. package/teams/fhr-neowise/skills/pull-request-authoring/SKILL.md +102 -0
  56. package/teams/fhr-neowise/skills/spec-investigation/SKILL.md +139 -0
  57. package/teams/fhr-neowise/skills/spec-investigation/TEMPLATE.spec.md +74 -0
  58. package/teams/fhr-neowise/skills/tdd-workflow/SKILL.md +137 -0
  59. package/teams/fhr-neowise/skills/write-plan/SKILL.md +285 -0
  60. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.checklist.json +79 -0
  61. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.plan.md +158 -0
@@ -0,0 +1,1186 @@
1
+ > **Warning**
2
+ >
3
+ > ## THIS IS AN AUTOGENERATED FILE. DO NOT EDIT.
4
+ >
5
+ > ## Please edit the corresponding file in [/packages/mermaid/src/docs/syntax/classDiagram.md](../../packages/mermaid/src/docs/syntax/classDiagram.md).
6
+
7
+ # Class diagrams
8
+
9
+ > "In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among objects."
10
+ >
11
+ > -Wikipedia
12
+
13
+ The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the structure of the application, and for detailed modeling to translate the models into programming code. Class diagrams can also be used for data modeling. The classes in a class diagram represent both the main elements, interactions in the application, and the classes to be programmed.
14
+
15
+ Mermaid can render class diagrams.
16
+
17
+ ```mermaid-example
18
+ ---
19
+ title: Animal example
20
+ ---
21
+ classDiagram
22
+ note "From Duck till Zebra"
23
+ Animal <|-- Duck
24
+ note for Duck "can fly<br>can swim<br>can dive<br>can help in debugging"
25
+ Animal <|-- Fish
26
+ Animal <|-- Zebra
27
+ Animal : +int age
28
+ Animal : +String gender
29
+ Animal: +isMammal()
30
+ Animal: +mate()
31
+ class Duck{
32
+ +String beakColor
33
+ +swim()
34
+ +quack()
35
+ }
36
+ class Fish{
37
+ -int sizeInFeet
38
+ -canEat()
39
+ }
40
+ class Zebra{
41
+ +bool is_wild
42
+ +run()
43
+ }
44
+ ```
45
+
46
+ ```mermaid
47
+ ---
48
+ title: Animal example
49
+ ---
50
+ classDiagram
51
+ note "From Duck till Zebra"
52
+ Animal <|-- Duck
53
+ note for Duck "can fly<br>can swim<br>can dive<br>can help in debugging"
54
+ Animal <|-- Fish
55
+ Animal <|-- Zebra
56
+ Animal : +int age
57
+ Animal : +String gender
58
+ Animal: +isMammal()
59
+ Animal: +mate()
60
+ class Duck{
61
+ +String beakColor
62
+ +swim()
63
+ +quack()
64
+ }
65
+ class Fish{
66
+ -int sizeInFeet
67
+ -canEat()
68
+ }
69
+ class Zebra{
70
+ +bool is_wild
71
+ +run()
72
+ }
73
+ ```
74
+
75
+ ## Syntax
76
+
77
+ ### Class
78
+
79
+ UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them.
80
+ A single instance of a class in the diagram contains three compartments:
81
+
82
+ - The top compartment contains the name of the class. It is printed in bold and centered, and the first letter is capitalized. It may also contain optional annotation text describing the nature of the class.
83
+ - The middle compartment contains the attributes of the class. They are left-aligned and the first letter is lowercase.
84
+ - The bottom compartment contains the operations the class can execute. They are also left-aligned and the first letter is lowercase.
85
+
86
+ ```mermaid-example
87
+ ---
88
+ title: Bank example
89
+ ---
90
+ classDiagram
91
+ class BankAccount
92
+ BankAccount : +String owner
93
+ BankAccount : +Bigdecimal balance
94
+ BankAccount : +deposit(amount)
95
+ BankAccount : +withdrawal(amount)
96
+
97
+ ```
98
+
99
+ ```mermaid
100
+ ---
101
+ title: Bank example
102
+ ---
103
+ classDiagram
104
+ class BankAccount
105
+ BankAccount : +String owner
106
+ BankAccount : +Bigdecimal balance
107
+ BankAccount : +deposit(amount)
108
+ BankAccount : +withdrawal(amount)
109
+
110
+ ```
111
+
112
+ ## Define a class
113
+
114
+ There are two ways to define a class:
115
+
116
+ - Explicitly using keyword **class** like `class Animal` which would define the Animal class.
117
+ - Via a **relationship** which defines two classes at a time along with their relationship. For instance, `Vehicle <|-- Car`.
118
+
119
+ ```mermaid-example
120
+ classDiagram
121
+ class Animal
122
+ Vehicle <|-- Car
123
+ ```
124
+
125
+ ```mermaid
126
+ classDiagram
127
+ class Animal
128
+ Vehicle <|-- Car
129
+ ```
130
+
131
+ Naming convention: a class name should be composed only of alphanumeric characters (including unicode), underscores, and dashes (-).
132
+
133
+ ### Class labels
134
+
135
+ In case you need to provide a label for a class, you can use the following syntax:
136
+
137
+ ```mermaid-example
138
+ classDiagram
139
+ class Animal["Animal with a label"]
140
+ class Car["Car with *! symbols"]
141
+ Animal --> Car
142
+ ```
143
+
144
+ ```mermaid
145
+ classDiagram
146
+ class Animal["Animal with a label"]
147
+ class Car["Car with *! symbols"]
148
+ Animal --> Car
149
+ ```
150
+
151
+ You can also use backticks to escape special characters in the label:
152
+
153
+ ```mermaid-example
154
+ classDiagram
155
+ class `Animal Class!`
156
+ class `Car Class`
157
+ `Animal Class!` --> `Car Class`
158
+ ```
159
+
160
+ ```mermaid
161
+ classDiagram
162
+ class `Animal Class!`
163
+ class `Car Class`
164
+ `Animal Class!` --> `Car Class`
165
+ ```
166
+
167
+ ## Defining Members of a class
168
+
169
+ UML provides mechanisms to represent class members such as attributes and methods, as well as additional information about them.
170
+
171
+ Mermaid distinguishes between attributes and functions/methods based on if the **parenthesis** `()` are present or not. The ones with `()` are treated as functions/methods, and all others as attributes.
172
+
173
+ There are two ways to define the members of a class, and regardless of whichever syntax is used to define the members, the output will still be same. The two different ways are :
174
+
175
+ - Associate a member of a class using **:** (colon) followed by member name, useful to define one member at a time. For example:
176
+
177
+ ```mermaid-example
178
+ classDiagram
179
+ class BankAccount
180
+ BankAccount : +String owner
181
+ BankAccount : +BigDecimal balance
182
+ BankAccount : +deposit(amount)
183
+ BankAccount : +withdrawal(amount)
184
+ ```
185
+
186
+ ```mermaid
187
+ classDiagram
188
+ class BankAccount
189
+ BankAccount : +String owner
190
+ BankAccount : +BigDecimal balance
191
+ BankAccount : +deposit(amount)
192
+ BankAccount : +withdrawal(amount)
193
+ ```
194
+
195
+ - Associate members of a class using **{}** brackets, where members are grouped within curly brackets. Suitable for defining multiple members at once. For example:
196
+
197
+ ```mermaid-example
198
+ classDiagram
199
+ class BankAccount{
200
+ +String owner
201
+ +BigDecimal balance
202
+ +deposit(amount)
203
+ +withdrawal(amount)
204
+ }
205
+ ```
206
+
207
+ ```mermaid
208
+ classDiagram
209
+ class BankAccount{
210
+ +String owner
211
+ +BigDecimal balance
212
+ +deposit(amount)
213
+ +withdrawal(amount)
214
+ }
215
+ ```
216
+
217
+ #### Return Type
218
+
219
+ Optionally you can end a method/function definition with the data type that will be returned (note: there must be a space between the final `)` and the return type). An example:
220
+
221
+ ```mermaid-example
222
+ classDiagram
223
+ class BankAccount{
224
+ +String owner
225
+ +BigDecimal balance
226
+ +deposit(amount) bool
227
+ +withdrawal(amount) int
228
+ }
229
+ ```
230
+
231
+ ```mermaid
232
+ classDiagram
233
+ class BankAccount{
234
+ +String owner
235
+ +BigDecimal balance
236
+ +deposit(amount) bool
237
+ +withdrawal(amount) int
238
+ }
239
+ ```
240
+
241
+ #### Generic Types
242
+
243
+ Generics can be represented as part of a class definition, and for class members/return types. In order to denote an item as generic, you enclose that type within `~` (**tilde**). **Nested** type declarations such as `List<List<int>>` are supported, though generics that include a comma are currently not supported. (such as `List<List<K, V>>`)
244
+
245
+ > _note_ when a generic is used within a class definition, the generic type is NOT considered part of the class name. i.e.: for any syntax which required you to reference the class name, you need to drop the type part of the definition. This also means that mermaid does not currently support having two classes with the same name, but different generic types.
246
+
247
+ ```mermaid-example
248
+ classDiagram
249
+ class Square~Shape~{
250
+ int id
251
+ List~int~ position
252
+ setPoints(List~int~ points)
253
+ getPoints() List~int~
254
+ }
255
+
256
+ Square : -List~string~ messages
257
+ Square : +setMessages(List~string~ messages)
258
+ Square : +getMessages() List~string~
259
+ Square : +getDistanceMatrix() List~List~int~~
260
+ ```
261
+
262
+ ```mermaid
263
+ classDiagram
264
+ class Square~Shape~{
265
+ int id
266
+ List~int~ position
267
+ setPoints(List~int~ points)
268
+ getPoints() List~int~
269
+ }
270
+
271
+ Square : -List~string~ messages
272
+ Square : +setMessages(List~string~ messages)
273
+ Square : +getMessages() List~string~
274
+ Square : +getDistanceMatrix() List~List~int~~
275
+ ```
276
+
277
+ #### Visibility
278
+
279
+ To describe the visibility (or encapsulation) of an attribute or method/function that is a part of a class (i.e. a class member), optional notation may be placed before that members' name:
280
+
281
+ - `+` Public
282
+ - `-` Private
283
+ - `#` Protected
284
+ - `~` Package/Internal
285
+
286
+ > _note_ you can also include additional _classifiers_ to a method definition by adding the following notation to the _end_ of the method, i.e.: after the `()` or after the return type:
287
+ >
288
+ > - `*` Abstract e.g.: `someAbstractMethod()*` or `someAbstractMethod() int*`
289
+ > - `$` Static e.g.: `someStaticMethod()$` or `someStaticMethod() String$`
290
+
291
+ > _note_ you can also include additional _classifiers_ to a field definition by adding the following notation to the very end:
292
+ >
293
+ > - `$` Static e.g.: `String someField$`
294
+
295
+ ## Defining Relationship
296
+
297
+ A relationship is a general term covering the specific types of logical connections found on class and object diagrams.
298
+
299
+ ```
300
+ [classA][Arrow][ClassB]
301
+ ```
302
+
303
+ There are eight different types of relations defined for classes under UML which are currently supported:
304
+
305
+ | Type | Description |
306
+ | ------- | ------------- |
307
+ | `<\|--` | Inheritance |
308
+ | `*--` | Composition |
309
+ | `o--` | Aggregation |
310
+ | `-->` | Association |
311
+ | `--` | Link (Solid) |
312
+ | `..>` | Dependency |
313
+ | `..\|>` | Realization |
314
+ | `..` | Link (Dashed) |
315
+
316
+ ```mermaid-example
317
+ classDiagram
318
+ classA <|-- classB
319
+ classC *-- classD
320
+ classE o-- classF
321
+ classG <-- classH
322
+ classI -- classJ
323
+ classK <.. classL
324
+ classM <|.. classN
325
+ classO .. classP
326
+
327
+ ```
328
+
329
+ ```mermaid
330
+ classDiagram
331
+ classA <|-- classB
332
+ classC *-- classD
333
+ classE o-- classF
334
+ classG <-- classH
335
+ classI -- classJ
336
+ classK <.. classL
337
+ classM <|.. classN
338
+ classO .. classP
339
+
340
+ ```
341
+
342
+ We can use the labels to describe the nature of the relation between two classes. Also, arrowheads can be used in the opposite direction as well:
343
+
344
+ ```mermaid-example
345
+ classDiagram
346
+ classA --|> classB : Inheritance
347
+ classC --* classD : Composition
348
+ classE --o classF : Aggregation
349
+ classG --> classH : Association
350
+ classI -- classJ : Link(Solid)
351
+ classK ..> classL : Dependency
352
+ classM ..|> classN : Realization
353
+ classO .. classP : Link(Dashed)
354
+
355
+ ```
356
+
357
+ ```mermaid
358
+ classDiagram
359
+ classA --|> classB : Inheritance
360
+ classC --* classD : Composition
361
+ classE --o classF : Aggregation
362
+ classG --> classH : Association
363
+ classI -- classJ : Link(Solid)
364
+ classK ..> classL : Dependency
365
+ classM ..|> classN : Realization
366
+ classO .. classP : Link(Dashed)
367
+
368
+ ```
369
+
370
+ ### Labels on Relations
371
+
372
+ It is possible to add label text to a relation:
373
+
374
+ ```
375
+ [classA][Arrow][ClassB]:LabelText
376
+ ```
377
+
378
+ ```mermaid-example
379
+ classDiagram
380
+ classA <|-- classB : implements
381
+ classC *-- classD : composition
382
+ classE o-- classF : aggregation
383
+ ```
384
+
385
+ ```mermaid
386
+ classDiagram
387
+ classA <|-- classB : implements
388
+ classC *-- classD : composition
389
+ classE o-- classF : aggregation
390
+ ```
391
+
392
+ ### Two-way relations
393
+
394
+ Relations can logically represent an N:M association:
395
+
396
+ ```mermaid-example
397
+ classDiagram
398
+ Animal <|--|> Zebra
399
+ ```
400
+
401
+ ```mermaid
402
+ classDiagram
403
+ Animal <|--|> Zebra
404
+ ```
405
+
406
+ Here is the syntax:
407
+
408
+ ```
409
+ [Relation Type][Link][Relation Type]
410
+ ```
411
+
412
+ Where `Relation Type` can be one of:
413
+
414
+ | Type | Description |
415
+ | ----- | ----------- |
416
+ | `<\|` | Inheritance |
417
+ | `\*` | Composition |
418
+ | `o` | Aggregation |
419
+ | `>` | Association |
420
+ | `<` | Association |
421
+ | `\|>` | Realization |
422
+
423
+ And `Link` can be one of:
424
+
425
+ | Type | Description |
426
+ | ---- | ----------- |
427
+ | -- | Solid |
428
+ | .. | Dashed |
429
+
430
+ ### Lollipop Interfaces
431
+
432
+ Classes can also be given a special relation type that defines a lollipop interface on the class. A lollipop interface is defined using the following syntax:
433
+
434
+ - `bar ()-- foo`
435
+ - `foo --() bar`
436
+
437
+ The interface (bar) with the lollipop connects to the class (foo).
438
+
439
+ Note: Each interface that is defined is unique and is meant to not be shared between classes / have multiple edges connecting to it.
440
+
441
+ ```mermaid-example
442
+ classDiagram
443
+ bar ()-- foo
444
+ ```
445
+
446
+ ```mermaid
447
+ classDiagram
448
+ bar ()-- foo
449
+ ```
450
+
451
+ ```mermaid-example
452
+ classDiagram
453
+ class Class01 {
454
+ int amount
455
+ draw()
456
+ }
457
+ Class01 --() bar
458
+ Class02 --() bar
459
+
460
+ foo ()-- Class01
461
+ ```
462
+
463
+ ```mermaid
464
+ classDiagram
465
+ class Class01 {
466
+ int amount
467
+ draw()
468
+ }
469
+ Class01 --() bar
470
+ Class02 --() bar
471
+
472
+ foo ()-- Class01
473
+ ```
474
+
475
+ ## Define Namespace
476
+
477
+ A namespace groups classes.
478
+
479
+ ```mermaid-example
480
+ classDiagram
481
+ namespace BaseShapes {
482
+ class Triangle
483
+ class Rectangle {
484
+ double width
485
+ double height
486
+ }
487
+ }
488
+ ```
489
+
490
+ ```mermaid
491
+ classDiagram
492
+ namespace BaseShapes {
493
+ class Triangle
494
+ class Rectangle {
495
+ double width
496
+ double height
497
+ }
498
+ }
499
+ ```
500
+
501
+ ### Namespace Labels (v11.15.0+)
502
+
503
+ A namespace can be given a display label using square bracket syntax, similar to class labels:
504
+
505
+ ```mermaid-example
506
+ classDiagram
507
+ namespace Auth["Authentication Service"] {
508
+ class UserService {
509
+ +login()
510
+ +logout()
511
+ }
512
+ }
513
+ ```
514
+
515
+ ```mermaid
516
+ classDiagram
517
+ namespace Auth["Authentication Service"] {
518
+ class UserService {
519
+ +login()
520
+ +logout()
521
+ }
522
+ }
523
+ ```
524
+
525
+ The label replaces the namespace name in the rendered diagram, while the name is still used internally for relationships and nesting.
526
+
527
+ ### Nested Namespaces (v11.15.0+)
528
+
529
+ Namespaces can be nested to represent hierarchical groupings. There are two ways to define nested namespaces:
530
+
531
+ **Dot notation** creates intermediate namespaces automatically:
532
+
533
+ ```mermaid-example
534
+ classDiagram
535
+ namespace Company.Engineering.Backend {
536
+ class Developer {
537
+ +writeCode()
538
+ }
539
+ }
540
+ namespace Company.Engineering.Frontend {
541
+ class Designer {
542
+ +createMockup()
543
+ }
544
+ }
545
+ namespace Company.Engineering {
546
+ class TechLead {
547
+ +planSprint()
548
+ }
549
+ }
550
+ TechLead --> Developer : leads
551
+ TechLead --> Designer : leads
552
+ ```
553
+
554
+ ```mermaid
555
+ classDiagram
556
+ namespace Company.Engineering.Backend {
557
+ class Developer {
558
+ +writeCode()
559
+ }
560
+ }
561
+ namespace Company.Engineering.Frontend {
562
+ class Designer {
563
+ +createMockup()
564
+ }
565
+ }
566
+ namespace Company.Engineering {
567
+ class TechLead {
568
+ +planSprint()
569
+ }
570
+ }
571
+ TechLead --> Developer : leads
572
+ TechLead --> Designer : leads
573
+ ```
574
+
575
+ **Syntactic nesting** places namespace blocks inside other namespace blocks:
576
+
577
+ ```mermaid-example
578
+ classDiagram
579
+ namespace Platform {
580
+ namespace Auth {
581
+ class UserService {
582
+ +login()
583
+ +logout()
584
+ }
585
+ }
586
+ namespace Data {
587
+ class Repository {
588
+ +find()
589
+ +save()
590
+ }
591
+ }
592
+ class Gateway {
593
+ +route()
594
+ }
595
+ }
596
+ Gateway --> UserService : delegates
597
+ Gateway --> Repository : delegates
598
+ ```
599
+
600
+ ```mermaid
601
+ classDiagram
602
+ namespace Platform {
603
+ namespace Auth {
604
+ class UserService {
605
+ +login()
606
+ +logout()
607
+ }
608
+ }
609
+ namespace Data {
610
+ class Repository {
611
+ +find()
612
+ +save()
613
+ }
614
+ }
615
+ class Gateway {
616
+ +route()
617
+ }
618
+ }
619
+ Gateway --> UserService : delegates
620
+ Gateway --> Repository : delegates
621
+ ```
622
+
623
+ Both approaches can be combined. Dot notation like `namespace A.B.C` will automatically create namespaces `A` and `A.B` as parents if they don't already exist.
624
+
625
+ #### Compact rendering (`hierarchicalNamespaces: false`)
626
+
627
+ By default (`hierarchicalNamespaces: true`), each segment of a dotted or syntactically-nested namespace name renders as its own cluster, producing a nested layout.
628
+
629
+ Setting `hierarchicalNamespaces: false` in the class diagram config switches to **compact mode**: only namespaces the user explicitly declares are drawn — each as a single flat box labelled with its fully-qualified name. Auto-created intermediate ancestors are skipped, and classes inside them are moved to their nearest declared namespace.
630
+
631
+ ```mermaid-example
632
+ ---
633
+ config:
634
+ class:
635
+ hierarchicalNamespaces: false
636
+ ---
637
+ classDiagram
638
+ namespace Company.Engineering.Backend {
639
+ class Developer {
640
+ +writeCode()
641
+ }
642
+ }
643
+ namespace Company.Engineering.Frontend {
644
+ class Designer {
645
+ +createMockup()
646
+ }
647
+ }
648
+ namespace Company {
649
+ class CEO {
650
+ +makeDecisions()
651
+ }
652
+ }
653
+ CEO --> Developer : oversees
654
+ CEO --> Designer : oversees
655
+ ```
656
+
657
+ ```mermaid
658
+ ---
659
+ config:
660
+ class:
661
+ hierarchicalNamespaces: false
662
+ ---
663
+ classDiagram
664
+ namespace Company.Engineering.Backend {
665
+ class Developer {
666
+ +writeCode()
667
+ }
668
+ }
669
+ namespace Company.Engineering.Frontend {
670
+ class Designer {
671
+ +createMockup()
672
+ }
673
+ }
674
+ namespace Company {
675
+ class CEO {
676
+ +makeDecisions()
677
+ }
678
+ }
679
+ CEO --> Developer : oversees
680
+ CEO --> Designer : oversees
681
+ ```
682
+
683
+ ## Cardinality / Multiplicity on relations
684
+
685
+ Multiplicity or cardinality in class diagrams indicates the number of instances of one class that can be linked to an instance of the other class. For example, each company will have one or more employees (not zero), and each employee currently works for zero or one companies.
686
+
687
+ Multiplicity notations are placed near the end of an association.
688
+
689
+ The different cardinality options are :
690
+
691
+ - `1` Only 1
692
+ - `0..1` Zero or One
693
+ - `1..*` One or more
694
+ - `*` Many
695
+ - `n` n (where n>1)
696
+ - `0..n` zero to n (where n>1)
697
+ - `1..n` one to n (where n>1)
698
+
699
+ Cardinality can be easily defined by placing the text option within quotes `"` before or after a given arrow. For example:
700
+
701
+ ```
702
+ [classA] "cardinality1" [Arrow] "cardinality2" [ClassB]:LabelText
703
+ ```
704
+
705
+ ```mermaid-example
706
+ classDiagram
707
+ Customer "1" --> "*" Ticket
708
+ Student "1" --> "1..*" Course
709
+ Galaxy --> "many" Star : Contains
710
+ ```
711
+
712
+ ```mermaid
713
+ classDiagram
714
+ Customer "1" --> "*" Ticket
715
+ Student "1" --> "1..*" Course
716
+ Galaxy --> "many" Star : Contains
717
+ ```
718
+
719
+ ## Annotations on classes
720
+
721
+ It is possible to annotate classes with markers to provide additional metadata about the class. This can give a clearer indication about its nature. Some common annotations include:
722
+
723
+ - `<<Interface>>` To represent an Interface class
724
+ - `<<Abstract>>` To represent an abstract class
725
+ - `<<Service>>` To represent a service class
726
+ - `<<Enumeration>>` To represent an enum
727
+
728
+ Annotations are defined within the opening `<<` and closing `>>`. There are three ways to add an annotation to a class, and in all cases the output will be the same:
729
+
730
+ - **Inline** with the class definition:
731
+
732
+ ```mermaid-example
733
+ classDiagram
734
+ class Shape <<interface>>
735
+ ```
736
+
737
+ ```mermaid
738
+ classDiagram
739
+ class Shape <<interface>>
740
+ ```
741
+
742
+ - In a **_separate line_** after a class is defined:
743
+
744
+ ```mermaid-example
745
+ classDiagram
746
+ class Shape
747
+ <<interface>> Shape
748
+ Shape : noOfVertices
749
+ Shape : draw()
750
+ ```
751
+
752
+ ```mermaid
753
+ classDiagram
754
+ class Shape
755
+ <<interface>> Shape
756
+ Shape : noOfVertices
757
+ Shape : draw()
758
+ ```
759
+
760
+ - In a **_nested structure_** along with the class definition:
761
+
762
+ ```mermaid-example
763
+ classDiagram
764
+ class Shape{
765
+ <<interface>>
766
+ noOfVertices
767
+ draw()
768
+ }
769
+ class Color{
770
+ <<enumeration>>
771
+ RED
772
+ BLUE
773
+ GREEN
774
+ WHITE
775
+ BLACK
776
+ }
777
+
778
+ ```
779
+
780
+ ```mermaid
781
+ classDiagram
782
+ class Shape{
783
+ <<interface>>
784
+ noOfVertices
785
+ draw()
786
+ }
787
+ class Color{
788
+ <<enumeration>>
789
+ RED
790
+ BLUE
791
+ GREEN
792
+ WHITE
793
+ BLACK
794
+ }
795
+
796
+ ```
797
+
798
+ ## Comments
799
+
800
+ Comments can be entered within a class diagram, which will be ignored by the parser. Comments need to be on their own line, and must be prefaced with `%%` (double percent signs). Any text until the next newline will be treated as a comment, including any class diagram syntax.
801
+
802
+ ```mermaid-example
803
+ classDiagram
804
+ %% This whole line is a comment classDiagram class Shape <<interface>>
805
+ class Shape{
806
+ <<interface>>
807
+ noOfVertices
808
+ draw()
809
+ }
810
+ ```
811
+
812
+ ```mermaid
813
+ classDiagram
814
+ %% This whole line is a comment classDiagram class Shape <<interface>>
815
+ class Shape{
816
+ <<interface>>
817
+ noOfVertices
818
+ draw()
819
+ }
820
+ ```
821
+
822
+ ## Setting the direction of the diagram
823
+
824
+ With class diagrams you can use the direction statement to set the direction in which the diagram will render:
825
+
826
+ ```mermaid-example
827
+ classDiagram
828
+ direction RL
829
+ class Student {
830
+ -idCard : IdCard
831
+ }
832
+ class IdCard{
833
+ -id : int
834
+ -name : string
835
+ }
836
+ class Bike{
837
+ -id : int
838
+ -name : string
839
+ }
840
+ Student "1" --o "1" IdCard : carries
841
+ Student "1" --o "1" Bike : rides
842
+ ```
843
+
844
+ ```mermaid
845
+ classDiagram
846
+ direction RL
847
+ class Student {
848
+ -idCard : IdCard
849
+ }
850
+ class IdCard{
851
+ -id : int
852
+ -name : string
853
+ }
854
+ class Bike{
855
+ -id : int
856
+ -name : string
857
+ }
858
+ Student "1" --o "1" IdCard : carries
859
+ Student "1" --o "1" Bike : rides
860
+ ```
861
+
862
+ ## Interaction
863
+
864
+ It is possible to bind a click event to a node. The click can lead to either a javascript callback or to a link which will be opened in a new browser tab. **Note**: This functionality is disabled when using `securityLevel='strict'` and enabled when using `securityLevel='loose'`.
865
+
866
+ You would define these actions on a separate line after all classes have been declared.
867
+
868
+ ```
869
+ action className "reference" "tooltip"
870
+ click className call callback() "tooltip"
871
+ click className href "url" "tooltip"
872
+ ```
873
+
874
+ - _action_ is either `link` or `callback`, depending on which type of interaction you want to have called
875
+ - _className_ is the id of the node that the action will be associated with
876
+ - _reference_ is either the url link, or the function name for callback.
877
+ - (_optional_) tooltip is a string to be displayed when hovering over element (note: The styles of the tooltip are set by the class .mermaidTooltip.)
878
+ - note: callback function will be called with the nodeId as parameter.
879
+
880
+ ## Notes
881
+
882
+ It is possible to add notes on the diagram using `note "line1\nline2"`. A note can be added for a specific class using `note for <CLASS NAME> "line1\nline2"`.
883
+
884
+ ### Examples
885
+
886
+ ```mermaid-example
887
+ classDiagram
888
+ note "This is a general note"
889
+ note for MyClass "This is a note for a class"
890
+ class MyClass{
891
+ }
892
+ ```
893
+
894
+ ```mermaid
895
+ classDiagram
896
+ note "This is a general note"
897
+ note for MyClass "This is a note for a class"
898
+ class MyClass{
899
+ }
900
+ ```
901
+
902
+ _URL Link:_
903
+
904
+ ```mermaid-example
905
+ classDiagram
906
+ class Shape
907
+ link Shape "https://www.github.com" "This is a tooltip for a link"
908
+ class Shape2
909
+ click Shape2 href "https://www.github.com" "This is a tooltip for a link"
910
+ ```
911
+
912
+ ```mermaid
913
+ classDiagram
914
+ class Shape
915
+ link Shape "https://www.github.com" "This is a tooltip for a link"
916
+ class Shape2
917
+ click Shape2 href "https://www.github.com" "This is a tooltip for a link"
918
+ ```
919
+
920
+ _Callback:_
921
+
922
+ ```mermaid-example
923
+ classDiagram
924
+ class Shape
925
+ callback Shape "callbackFunction" "This is a tooltip for a callback"
926
+ class Shape2
927
+ click Shape2 call callbackFunction() "This is a tooltip for a callback"
928
+ ```
929
+
930
+ ```mermaid
931
+ classDiagram
932
+ class Shape
933
+ callback Shape "callbackFunction" "This is a tooltip for a callback"
934
+ class Shape2
935
+ click Shape2 call callbackFunction() "This is a tooltip for a callback"
936
+ ```
937
+
938
+ ```html
939
+ <script>
940
+ const callbackFunction = function () {
941
+ alert('A callback was triggered');
942
+ };
943
+ </script>
944
+ ```
945
+
946
+ ```mermaid-example
947
+ classDiagram
948
+ class Class01
949
+ class Class02
950
+ callback Class01 "callbackFunction" "Callback tooltip"
951
+ link Class02 "https://www.github.com" "This is a link"
952
+ class Class03
953
+ class Class04
954
+ click Class03 call callbackFunction() "Callback tooltip"
955
+ click Class04 href "https://www.github.com" "This is a link"
956
+ ```
957
+
958
+ ```mermaid
959
+ classDiagram
960
+ class Class01
961
+ class Class02
962
+ callback Class01 "callbackFunction" "Callback tooltip"
963
+ link Class02 "https://www.github.com" "This is a link"
964
+ class Class03
965
+ class Class04
966
+ click Class03 call callbackFunction() "Callback tooltip"
967
+ click Class04 href "https://www.github.com" "This is a link"
968
+ ```
969
+
970
+ > **Success** The tooltip functionality and the ability to link to urls are available from version 0.5.2.
971
+
972
+ Beginner's tip—a full example using interactive links in an HTML page:
973
+
974
+ ```html
975
+ <body>
976
+ <pre class="mermaid">
977
+ classDiagram
978
+ Animal <|-- Duck
979
+ Animal <|-- Fish
980
+ Animal <|-- Zebra
981
+ Animal : +int age
982
+ Animal : +String gender
983
+ Animal: +isMammal()
984
+ Animal: +mate()
985
+ class Duck{
986
+ +String beakColor
987
+ +swim()
988
+ +quack()
989
+ }
990
+ class Fish{
991
+ -int sizeInFeet
992
+ -canEat()
993
+ }
994
+ class Zebra{
995
+ +bool is_wild
996
+ +run()
997
+ }
998
+
999
+ callback Duck "callback" "Tooltip"
1000
+ link Zebra "https://www.github.com" "This is a link"
1001
+ </pre>
1002
+
1003
+ <script>
1004
+ const callback = function () {
1005
+ alert('A callback was triggered');
1006
+ };
1007
+ const config = {
1008
+ startOnLoad: true,
1009
+ securityLevel: 'loose',
1010
+ };
1011
+ mermaid.initialize(config);
1012
+ </script>
1013
+ </body>
1014
+ ```
1015
+
1016
+ ## Styling
1017
+
1018
+ ### Styling a node
1019
+
1020
+ It is possible to apply specific styles such as a thicker border or a different background color to an individual node using the `style` keyword.
1021
+
1022
+ Note that notes and namespaces cannot be styled individually but do support themes.
1023
+
1024
+ ```mermaid-example
1025
+ classDiagram
1026
+ class Animal
1027
+ class Mineral
1028
+ style Animal fill:#f9f,stroke:#333,stroke-width:4px
1029
+ style Mineral fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
1030
+ ```
1031
+
1032
+ ```mermaid
1033
+ classDiagram
1034
+ class Animal
1035
+ class Mineral
1036
+ style Animal fill:#f9f,stroke:#333,stroke-width:4px
1037
+ style Mineral fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
1038
+ ```
1039
+
1040
+ #### Classes
1041
+
1042
+ More convenient than defining the style every time is to define a class of styles and attach this class to the nodes that
1043
+ should have a different look.
1044
+
1045
+ A class definition looks like the example below:
1046
+
1047
+ ```
1048
+ classDef className fill:#f9f,stroke:#333,stroke-width:4px;
1049
+ ```
1050
+
1051
+ Also, it is possible to define style to multiple classes in one statement:
1052
+
1053
+ ```
1054
+ classDef firstClassName,secondClassName font-size:12pt;
1055
+ ```
1056
+
1057
+ Attachment of a class to a node is done as per below:
1058
+
1059
+ ```
1060
+ cssClass "nodeId1" className;
1061
+ ```
1062
+
1063
+ It is also possible to attach a class to a list of nodes in one statement:
1064
+
1065
+ ```
1066
+ cssClass "nodeId1,nodeId2" className;
1067
+ ```
1068
+
1069
+ A shorter form of adding a class is to attach the classname to the node using the `:::` operator:
1070
+
1071
+ ```mermaid-example
1072
+ classDiagram
1073
+ class Animal:::someclass
1074
+ classDef someclass fill:#f96
1075
+ ```
1076
+
1077
+ ```mermaid
1078
+ classDiagram
1079
+ class Animal:::someclass
1080
+ classDef someclass fill:#f96
1081
+ ```
1082
+
1083
+ Or:
1084
+
1085
+ ```mermaid-example
1086
+ classDiagram
1087
+ class Animal:::someclass {
1088
+ -int sizeInFeet
1089
+ -canEat()
1090
+ }
1091
+ classDef someclass fill:#f96
1092
+ ```
1093
+
1094
+ ```mermaid
1095
+ classDiagram
1096
+ class Animal:::someclass {
1097
+ -int sizeInFeet
1098
+ -canEat()
1099
+ }
1100
+ classDef someclass fill:#f96
1101
+ ```
1102
+
1103
+ ### Default class
1104
+
1105
+ If a class is named default it will be applied to all nodes. Specific styles and classes should be defined afterwards to override the applied default styling.
1106
+
1107
+ ```
1108
+ classDef default fill:#f9f,stroke:#333,stroke-width:4px;
1109
+ ```
1110
+
1111
+ ```mermaid-example
1112
+ classDiagram
1113
+ class Animal:::pink
1114
+ class Mineral
1115
+
1116
+ classDef default fill:#f96,color:red
1117
+ classDef pink color:#f9f
1118
+ ```
1119
+
1120
+ ```mermaid
1121
+ classDiagram
1122
+ class Animal:::pink
1123
+ class Mineral
1124
+
1125
+ classDef default fill:#f96,color:red
1126
+ classDef pink color:#f9f
1127
+ ```
1128
+
1129
+ ### CSS Classes
1130
+
1131
+ It is also possible to predefine classes in CSS styles that can be applied from the graph definition as in the example
1132
+ below:
1133
+
1134
+ **Example style**
1135
+
1136
+ ```html
1137
+ <style>
1138
+ .styleClass > * > g {
1139
+ fill: #ff0000;
1140
+ stroke: #ffff00;
1141
+ stroke-width: 4px;
1142
+ }
1143
+ </style>
1144
+ ```
1145
+
1146
+ **Example definition**
1147
+
1148
+ ```mermaid-example
1149
+ classDiagram
1150
+ class Animal:::styleClass
1151
+ ```
1152
+
1153
+ ```mermaid
1154
+ classDiagram
1155
+ class Animal:::styleClass
1156
+ ```
1157
+
1158
+ > cssClasses cannot be added using this shorthand method at the same time as a relation statement.
1159
+
1160
+ ## Configuration
1161
+
1162
+ ### Members Box
1163
+
1164
+ It is possible to hide the empty members box of a class node.
1165
+
1166
+ This is done by changing the **hideEmptyMembersBox** value of the class diagram configuration. For more information on how to edit the Mermaid configuration see the [configuration page.](https://mermaid.js.org/config/configuration.html)
1167
+
1168
+ ```mermaid-example
1169
+ ---
1170
+ config:
1171
+ class:
1172
+ hideEmptyMembersBox: true
1173
+ ---
1174
+ classDiagram
1175
+ class Duck
1176
+ ```
1177
+
1178
+ ```mermaid
1179
+ ---
1180
+ config:
1181
+ class:
1182
+ hideEmptyMembersBox: true
1183
+ ---
1184
+ classDiagram
1185
+ class Duck
1186
+ ```