You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add class diagram and C4 architecture support
Class diagrams:
- Add classDiagram guidance for OOP design and domain modeling
- Document relationships: association, composition, aggregation, inheritance
- Note erDiagram as alternative for simple entity-only models
C4 architecture:
- Use graph TD + subgraph instead of native C4Context
- Native C4 ignores themeVariables (hardcoded corners, fonts, colors)
- Document flowchart-as-C4 pattern with classDef for external systems
Directory tree CSS:
- Add .dir-tree pattern for file structures with tree connectors
- Add .dir-tree-card and .dir-compare for labeled/side-by-side trees
- Enforce white-space: pre to preserve vertical alignment
Also adds quick-reference table for choosing Mermaid diagram types.
Co-authored-by: janah01 <janah01@users.noreply.github.com>
Closes#16
Copy file name to clipboardExpand all lines: SKILL.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ For prose accents, see "Prose Page Elements" in `./references/css-patterns.md`.
28
28
29
29
**Who is looking?** A developer understanding a system? A PM seeing the big picture? A team reviewing a proposal? This shapes information density and visual complexity.
30
30
31
-
**What type of content?** Architecture, flowchart, sequence, data flow, schema/ER, state machine, mind map, data table, timeline, dashboard, or prose-first page. Each has distinct layout needs and rendering approaches (see Diagram Types below).
31
+
**What type of content?** Architecture, flowchart, sequence, data flow, schema/ER, state machine, mind map, class diagram, C4 architecture, data table, timeline, dashboard, or prose-first page. Each has distinct layout needs and rendering approaches (see Diagram Types below).
32
32
33
33
**What aesthetic?** Pick one and commit. The constrained aesthetics (Blueprint, Editorial, Paper/ink) are safer — they have specific requirements that prevent generic output. The flexible ones (IDE-inspired) require more discipline.
34
34
@@ -53,7 +53,7 @@ Vary the choice each time. If the last diagram was dark and technical, make the
53
53
54
54
**Read the reference material** before generating. Don't memorize it — read it each time to absorb the patterns.
55
55
- For text-heavy architecture overviews (card content matters more than topology): read `./templates/architecture.html`
56
-
- For flowcharts, sequence diagrams, ER, state machines, mind maps: read `./templates/mermaid-flowchart.html`
56
+
- For flowcharts, sequence diagrams, ER, state machines, mind maps, class diagrams, C4: read `./templates/mermaid-flowchart.html`
57
57
- For data tables, comparisons, audits, feature matrices: read `./templates/data-table.html`
58
58
- For slide deck presentations (when `--slides` flag is present or `/generate-slides` is invoked): read `./templates/slide-deck.html` and `./references/slide-patterns.md`
59
59
- For prose-heavy publishable pages (READMEs, articles, blog posts, essays): read the "Prose Page Elements" section in `./references/css-patterns.md` and "Typography by Content Voice" in `./references/libraries.md`
@@ -74,6 +74,8 @@ Vary the choice each time. If the last diagram was dark and technical, make the
74
74
| ER / schema diagram |**Mermaid**| Relationship lines between many entities need auto-routing |
75
75
| State machine |**Mermaid**| State transitions with labeled edges need automatic layout |
76
76
| Mind map |**Mermaid**| Hierarchical branching needs automatic positioning |
77
+
| Class diagram |**Mermaid**| Inheritance, composition, aggregation lines with automatic routing |
78
+
| C4 architecture |**Mermaid**| Use `graph TD` + `subgraph` for C4 (not native `C4Context` — it ignores themes) |
77
79
| Data table | HTML `<table>`| Semantic markup, accessibility, copy-paste behavior |
78
80
| Timeline | CSS (central line + cards) | Simple linear layout doesn't need a layout engine |
@@ -211,6 +213,14 @@ Three approaches depending on complexity:
211
213
### Mind Maps / Hierarchical Breakdowns
212
214
**Use Mermaid.** Use `mindmap` syntax for hierarchical branching from a root node. Mermaid handles the radial layout automatically. Style with `themeVariables` to control node colors at each depth level.
213
215
216
+
### Class Diagrams
217
+
**Use Mermaid.** Use `classDiagram` syntax for domain modeling, OOP design, and entity relationships with typed properties and methods. Supports relationships: association (`-->`), composition (`*--`), aggregation (`o--`), and inheritance (`<|--`). Add multiplicity labels (e.g., `"1" --> "*"`) and abstract/interface markers (`<<interface>>`, `<<abstract>>`). For simple entity boxes without OOP semantics (no methods, no inheritance), prefer `erDiagram` instead — it produces cleaner output for pure data modeling.
218
+
219
+
### C4 Architecture Diagrams
220
+
**Use Mermaid flowchart syntax — NOT native C4.** Use `graph TD` with `subgraph` blocks for C4 boundaries. Native `C4Context` hardcodes sharp corners, its own font, blue icons, and inline SVG colors that ignore `themeVariables` — it always clashes with custom palettes.
221
+
222
+
**Flowchart-as-C4 pattern:** Persons → rounded nodes `(("Name"))`, systems → rectangles `["Name"]`, databases → cylinders `[("Name")]`, boundaries → `subgraph` blocks, relationships → labeled arrows `-->|"protocol"|`. Use `classDef` + `:::className` to visually differentiate external systems (e.g., dashed borders). This inherits `themeVariables`, `fontFamily`, and CSS overrides like every other Mermaid diagram.
223
+
214
224
### Data Tables / Comparisons / Audits
215
225
Use a real `<table>` element — not CSS Grid pretending to be a table. Tables get accessibility, copy-paste behavior, and column alignment for free. The reference template at `./templates/data-table.html` demonstrates all patterns below.
Copy file name to clipboardExpand all lines: references/css-patterns.md
+51Lines changed: 51 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -288,6 +288,57 @@ For implementation plans and architecture docs, **don't display entire source fi
288
288
289
289
If someone needs the full file, put it in a collapsible section or link to it.
290
290
291
+
## Directory Tree
292
+
293
+
For file structures, use `<pre>` with monospace + `white-space: pre`. Tree connectors (`├──`, `└──`, `│`) only work when vertically aligned — they become noise if text wraps.
**Never** render tree connectors inside wrapping text (`white-space: normal`), flex children, or grid items — the vertical pipes lose alignment and the hierarchy becomes unreadable.
341
+
291
342
## Overflow Protection
292
343
293
344
Grid and flex children default to `min-width: auto`, which prevents them from shrinking below their content width. Long text, inline code badges, and non-wrapping elements will blow out containers.
Copy file name to clipboardExpand all lines: references/libraries.md
+59Lines changed: 59 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -374,6 +374,65 @@ mindmap
374
374
</pre>
375
375
```
376
376
377
+
**Class diagram:**
378
+
```html
379
+
<preclass="mermaid">
380
+
classDiagram
381
+
class User {
382
+
+string email
383
+
+string name
384
+
+login()
385
+
+logout()
386
+
}
387
+
class Order {
388
+
+int id
389
+
+decimal total
390
+
+submit()
391
+
}
392
+
class Product {
393
+
+string name
394
+
+decimal price
395
+
}
396
+
User "1" --> "*" Order : places
397
+
Order "*" --> "*" Product : contains
398
+
</pre>
399
+
```
400
+
401
+
**C4 architecture (flowchart-as-C4):**
402
+
```html
403
+
<preclass="mermaid">
404
+
graph TD
405
+
user("👤 User<br/><small>Browser client</small>")
406
+
subgraph boundary["Web Platform"]
407
+
app["Web App<br/><small>Node.js</small>"]
408
+
db[("Database<br/><small>PostgreSQL</small>")]
409
+
end
410
+
email["📧 Email Service"]:::ext
411
+
payment["💳 Payment Gateway"]:::ext
412
+
user -->|"HTTPS"| app
413
+
app -->|"SQL"| db
414
+
app -->|"SMTP"| email
415
+
app -->|"API"| payment
416
+
classDef ext fill:none,stroke-dasharray:5 5
417
+
</pre>
418
+
```
419
+
420
+
Do NOT use native `C4Context` / `C4Container` syntax — it hardcodes sharp corners, its own font, and inline colors that ignore `themeVariables`. Use `graph TD` + `subgraph` for C4 boundaries instead; it inherits all theme settings automatically.
421
+
422
+
### Which Mermaid Diagram Type?
423
+
424
+
Quick-reference for choosing the right Mermaid syntax:
0 commit comments