mddd-cli 4.2.1 → 4.2.2

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.
@@ -0,0 +1,217 @@
1
+ ---
2
+ name: mermaid-diagrams
3
+ description: Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts, gantt charts, or any other diagram type. Triggers include requests to "diagram", "visualize", "model", "map out", "show the flow", or when explaining system architecture, database design, code structure, or user/application flows.
4
+ ---
5
+
6
+ # Mermaid Diagramming
7
+
8
+ Create professional software diagrams using Mermaid's text-based syntax. Mermaid renders diagrams from simple text definitions, making diagrams version-controllable, easy to update, and maintainable alongside code.
9
+
10
+ ## Core Syntax Structure
11
+
12
+ All Mermaid diagrams follow this pattern:
13
+
14
+ ```mermaid
15
+ diagramType
16
+ definition content
17
+ ```
18
+
19
+ **Key principles:**
20
+ - First line declares diagram type (e.g., `classDiagram`, `sequenceDiagram`, `flowchart`)
21
+ - Use `%%` for comments
22
+ - Line breaks and indentation improve readability but aren't required
23
+ - Unknown words break diagrams; parameters fail silently
24
+
25
+ ## Diagram Type Selection Guide
26
+
27
+ **Choose the right diagram type:**
28
+
29
+ 1. **Class Diagrams** - Domain modeling, OOP design, entity relationships
30
+ - Domain-driven design documentation
31
+ - Object-oriented class structures
32
+ - Entity relationships and dependencies
33
+
34
+ 2. **Sequence Diagrams** - Temporal interactions, message flows
35
+ - API request/response flows
36
+ - User authentication flows
37
+ - System component interactions
38
+ - Method call sequences
39
+
40
+ 3. **Flowcharts** - Processes, algorithms, decision trees
41
+ - User journeys and workflows
42
+ - Business processes
43
+ - Algorithm logic
44
+ - Deployment pipelines
45
+
46
+ 4. **Entity Relationship Diagrams (ERD)** - Database schemas
47
+ - Table relationships
48
+ - Data modeling
49
+ - Schema design
50
+
51
+ 5. **C4 Diagrams** - Software architecture at multiple levels
52
+ - System Context (systems and users)
53
+ - Container (applications, databases, services)
54
+ - Component (internal structure)
55
+ - Code (class/interface level)
56
+
57
+ 6. **State Diagrams** - State machines, lifecycle states
58
+ 7. **Git Graphs** - Version control branching strategies
59
+ 8. **Gantt Charts** - Project timelines, scheduling
60
+ 9. **Pie/Bar Charts** - Data visualization
61
+
62
+ ## Quick Start Examples
63
+
64
+ ### Class Diagram (Domain Model)
65
+ ```mermaid
66
+ classDiagram
67
+ Title -- Genre
68
+ Title *-- Season
69
+ Title *-- Review
70
+ User --> Review : creates
71
+
72
+ class Title {
73
+ +string name
74
+ +int releaseYear
75
+ +play()
76
+ }
77
+
78
+ class Genre {
79
+ +string name
80
+ +getTopTitles()
81
+ }
82
+ ```
83
+
84
+ ### Sequence Diagram (API Flow)
85
+ ```mermaid
86
+ sequenceDiagram
87
+ participant User
88
+ participant API
89
+ participant Database
90
+
91
+ User->>API: POST /login
92
+ API->>Database: Query credentials
93
+ Database-->>API: Return user data
94
+ alt Valid credentials
95
+ API-->>User: 200 OK + JWT token
96
+ else Invalid credentials
97
+ API-->>User: 401 Unauthorized
98
+ end
99
+ ```
100
+
101
+ ### Flowchart (User Journey)
102
+ ```mermaid
103
+ flowchart TD
104
+ Start([User visits site]) --> Auth{Authenticated?}
105
+ Auth -->|No| Login[Show login page]
106
+ Auth -->|Yes| Dashboard[Show dashboard]
107
+ Login --> Creds[Enter credentials]
108
+ Creds --> Validate{Valid?}
109
+ Validate -->|Yes| Dashboard
110
+ Validate -->|No| Error[Show error]
111
+ Error --> Login
112
+ ```
113
+
114
+ ### ERD (Database Schema)
115
+ ```mermaid
116
+ erDiagram
117
+ USER ||--o{ ORDER : places
118
+ ORDER ||--|{ LINE_ITEM : contains
119
+ PRODUCT ||--o{ LINE_ITEM : includes
120
+
121
+ USER {
122
+ int id PK
123
+ string email UK
124
+ string name
125
+ datetime created_at
126
+ }
127
+
128
+ ORDER {
129
+ int id PK
130
+ int user_id FK
131
+ decimal total
132
+ datetime created_at
133
+ }
134
+ ```
135
+
136
+ ## Detailed References
137
+
138
+ For in-depth guidance on specific diagram types, see:
139
+
140
+ - **[references/class-diagrams.md](references/class-diagrams.md)** - Domain modeling, relationships (association, composition, aggregation, inheritance), multiplicity, methods/properties
141
+ - **[references/sequence-diagrams.md](references/sequence-diagrams.md)** - Actors, participants, messages (sync/async), activations, loops, alt/opt/par blocks, notes
142
+ - **[references/flowcharts.md](references/flowcharts.md)** - Node shapes, connections, decision logic, subgraphs, styling
143
+ - **[references/erd-diagrams.md](references/erd-diagrams.md)** - Entities, relationships, cardinality, keys, attributes
144
+ - **[references/c4-diagrams.md](references/c4-diagrams.md)** - System context, container, component diagrams, boundaries
145
+ - **[references/architecture-diagrams.md](references/architecture-diagrams.md)** - Cloud services, infrastructure, CI/CD deployments
146
+ - **[references/advanced-features.md](references/advanced-features.md)** - Themes, styling, configuration, layout options
147
+
148
+ ## Best Practices
149
+
150
+ 1. **Start Simple** - Begin with core entities/components, add details incrementally
151
+ 2. **Use Meaningful Names** - Clear labels make diagrams self-documenting
152
+ 3. **Comment Extensively** - Use `%%` comments to explain complex relationships
153
+ 4. **Keep Focused** - One diagram per concept; split large diagrams into multiple focused views
154
+ 5. **Version Control** - Store `.mmd` files alongside code for easy updates
155
+ 6. **Add Context** - Include titles and notes to explain diagram purpose
156
+ 7. **Iterate** - Refine diagrams as understanding evolves
157
+
158
+ ## Configuration and Theming
159
+
160
+ Configure diagrams using frontmatter:
161
+
162
+ ```mermaid
163
+ ---
164
+ config:
165
+ theme: base
166
+ themeVariables:
167
+ primaryColor: "#ff6b6b"
168
+ ---
169
+ flowchart LR
170
+ A --> B
171
+ ```
172
+
173
+ **Available themes:** default, forest, dark, neutral, base
174
+
175
+ **Layout options:**
176
+ - `layout: dagre` (default) - Classic balanced layout
177
+ - `layout: elk` - Advanced layout for complex diagrams (requires integration)
178
+
179
+ **Look options:**
180
+ - `look: classic` - Traditional Mermaid style
181
+ - `look: handDrawn` - Sketch-like appearance
182
+
183
+ ## Exporting and Rendering
184
+
185
+ **Native support in:**
186
+ - GitHub/GitLab - Automatically renders in Markdown
187
+ - VS Code - With Markdown Mermaid extension
188
+ - Notion, Obsidian, Confluence - Built-in support
189
+
190
+ **Export options:**
191
+ - [Mermaid Live Editor](https://mermaid.live) - Online editor with PNG/SVG export
192
+ - Mermaid CLI - `npm install -g @mermaid-js/mermaid-cli` then `mmdc -i input.mmd -o output.png`
193
+ - Docker - `docker run --rm -v $(pwd):/data minlag/mermaid-cli -i /data/input.mmd -o /data/output.png`
194
+
195
+ ## Common Pitfalls
196
+
197
+ - **Breaking characters** - Avoid `{}` in comments, use proper escape sequences for special characters
198
+ - **Syntax errors** - Misspellings break diagrams; validate syntax in Mermaid Live
199
+ - **Overcomplexity** - Split complex diagrams into multiple focused views
200
+ - **Missing relationships** - Document all important connections between entities
201
+
202
+ ## When to Create Diagrams
203
+
204
+ **Always diagram when:**
205
+ - Starting new projects or features
206
+ - Documenting complex systems
207
+ - Explaining architecture decisions
208
+ - Designing database schemas
209
+ - Planning refactoring efforts
210
+ - Onboarding new team members
211
+
212
+ **Use diagrams to:**
213
+ - Align stakeholders on technical decisions
214
+ - Document domain models collaboratively
215
+ - Visualize data flows and system interactions
216
+ - Plan before coding
217
+ - Create living documentation that evolves with code