Skip to content

Commit ef7d98f

Browse files
committed
feat: hybrid architecture pattern for complex diagrams
- New pattern for 15+ elements: simple Mermaid overview + CSS Grid cards - Reduced max Mermaid nodes from 15-20 to 10-12 - Updated scaling guidance to recommend hybrid over scaling tricks
1 parent 0c52dec commit ef7d98f

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
- Updated JavaScript to use `INITIAL_ZOOM` constant for consistent reset behavior.
1212
- Updated "Scaling Small Diagrams" section to use `zoom` instead of `transform: scale()` for consistency.
1313

14+
## [0.4.4] - 2026-03-02
15+
16+
### Hybrid Architecture Pattern
17+
- New pattern for complex architectures (15+ elements): simple Mermaid overview (5-8 nodes) + CSS Grid cards for details
18+
- Updated "Architecture / System Diagrams" section in SKILL.md with three-tier approach based on complexity
19+
- Reduced max Mermaid node count from 15-20 to 10-12 in `libraries.md`
20+
- Updated Mermaid scaling guidance to recommend hybrid pattern over scaling tricks for complex diagrams
21+
1422
## [0.4.2] - 2026-03-01
1523

1624
### Link Styling

SKILL.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license: MIT
55
compatibility: Requires a browser to view generated HTML files. Optional surf-cli for AI image generation.
66
metadata:
77
author: nicobailon
8-
version: "0.4.2"
8+
version: "0.4.4"
99
---
1010

1111
# Visual Explainer
@@ -82,7 +82,7 @@ Vary the choice each time. If the last diagram was dark and technical, make the
8282

8383
**Mermaid containers:** Always center Mermaid diagrams with `display: flex; justify-content: center;`. Add zoom controls (+/−/reset) to every `.mermaid-wrap` container.
8484

85-
**Mermaid scaling:** Complex diagrams with 10+ nodes render too small by default. Increase `fontSize` in themeVariables to 18-20px (default is 16px), or apply a CSS `transform: scale(1.3)` on the SVG. Don't let diagrams float in oversized containers with unreadable text. See `./references/css-patterns.md` "Scaling Small Diagrams".
85+
**Mermaid scaling:** Diagrams with 10+ nodes render too small by default. For 10-12 nodes, increase `fontSize` in themeVariables to 18-20px and set `INITIAL_ZOOM` to 1.5-1.6. For 15+ elements, don't try to scale — use the hybrid pattern instead (simple Mermaid overview + CSS Grid cards). See "Architecture / System Diagrams" below.
8686

8787
**Mermaid layout direction:** Prefer `flowchart TD` (top-down) over `flowchart LR` (left-to-right) for complex diagrams. LR spreads horizontally and makes labels unreadable when there are many nodes. Use LR only for simple 3-4 node linear flows. See `./references/libraries.md` "Layout Direction: TD vs LR".
8888

@@ -181,11 +181,13 @@ Keep animations purposeful: entrance reveals, hover feedback, and user-initiated
181181
## Diagram Types
182182

183183
### Architecture / System Diagrams
184-
Two approaches depending on what matters more:
184+
Three approaches depending on complexity:
185185

186-
**Text-heavy overviews** (card content matters more than connections): CSS Grid with explicit row/column placement. Sections as rounded cards with colored borders and monospace labels. Vertical flow arrows between sections. Nested grids for subsystems. The reference template at `./templates/architecture.html` demonstrates this pattern. Use when cards need descriptions, code references, tool lists, or other rich content that Mermaid nodes can't hold.
186+
**Simple topology (under 10 elements):** Use Mermaid. A `graph TD` with custom `themeVariables` produces readable diagrams with automatic edge routing.
187187

188-
**Topology-focused diagrams** (connections matter more than card content): **Use Mermaid.** A `graph TD` (or `graph LR` for simple linear flows) with custom `themeVariables` produces proper diagrams with automatic edge routing. Use when the point is showing how components connect rather than describing what each component does in detail.
188+
**Text-heavy overviews (under 15 elements):** CSS Grid with explicit row/column placement. Sections as rounded cards with colored borders and monospace labels. Vertical flow arrows between sections. The reference template at `./templates/architecture.html` demonstrates this pattern. Use when cards need descriptions, code references, tool lists, or other rich content that Mermaid nodes can't hold.
189+
190+
**Complex architectures (15+ elements):** Use the **hybrid pattern** — a simple Mermaid overview (5-8 nodes showing module relationships) followed by detailed CSS Grid cards for each module's internals. This gives you visual topology AND readable details. The overview diagram uses module names with `<small>` tags for key function names. The cards below show full function lists with new/modified badges. Never try to cram 15+ elements into a single Mermaid diagram — it will render unreadably small even with zoom controls.
189191

190192
### Flowcharts / Pipelines
191193
**Use Mermaid.** Automatic node positioning and edge routing produces proper diagrams with connecting lines, decision diamonds, and parallel branches — dramatically better than CSS flexbox with arrow characters. Prefer `graph TD` (top-down); use `graph LR` only for simple 3-4 node linear flows. Color-code node types with Mermaid's `classDef` or rely on `themeVariables` for automatic styling.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "visual-explainer",
3-
"version": "0.4.3",
3+
"version": "0.4.4",
44
"description": "Agent skill that generates beautiful HTML pages for diagrams, diff reviews, plan reviews, and data tables",
55
"keywords": [
66
"pi-package"

references/libraries.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ A[handleRequest] --> B[query users]
216216
userSvc["User Service"] --> authSvc["Auth Service"]
217217
```
218218

219-
**Max 15-20 nodes per diagram.** Beyond that, readability collapses even with ELK layout. Use `subgraph` blocks to group related nodes, or split into multiple diagrams:
219+
**Max 10-12 nodes per Mermaid diagram.** Beyond that, readability collapses even with zoom controls and increased fontSize. For complex architectures (15+ elements), use the **hybrid pattern**: a simple 5-8 node Mermaid overview showing module relationships, followed by CSS Grid cards with detailed function lists. Never cram everything into one diagram. Use `subgraph` blocks to group related nodes when under the limit:
220220

221221
```
222222
subgraph Auth

0 commit comments

Comments
 (0)