From 0d77702527424c2b53b6870b0248222f5b945b9a Mon Sep 17 00:00:00 2001 From: fremontzhang Date: Sun, 10 May 2026 12:40:29 +0800 Subject: [PATCH] feat: add diagram layout support for relationship diagrams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds dedicated zero-dependency diagram layouts to preserve spatial semantics from source images. New patterns: - cycle-diagram: circular/flywheel processes - pipeline-diagram: input → process → output flows - feedback-diagram: systems with return/feedback paths - hierarchy-diagram: org charts and trees - hub-diagram: hub-and-spoke architectures Updates SKILL.md with diagram detection in Phase 1 and generation rules in Phase 3. Updates html-template.md with diagram CSS hook. Closes # --- SKILL.md | 18 +- diagram-patterns.md | 419 ++++++++++++++++++++++++++++++++++++++++++++ html-template.md | 23 +++ 3 files changed, 459 insertions(+), 1 deletion(-) create mode 100644 diagram-patterns.md diff --git a/SKILL.md b/SKILL.md index dfd8ce0b..c3b1ec5d 100644 --- a/SKILL.md +++ b/SKILL.md @@ -118,7 +118,11 @@ If user provides an image folder: 2. **View each image** — Use the Read tool (Claude is multimodal) 3. **Evaluate** — For each: what it shows, USABLE or NOT USABLE (with reason), what concept it represents, dominant colors 4. **Co-design the outline** — Curated images inform slide structure alongside text. This is NOT "plan slides then add images" — design around both from the start (e.g., 3 screenshots → 3 feature slides, 1 logo → title/closing slide) -5. **Confirm via AskUserQuestion** (header: "Outline"): "Does this slide outline and image selection look right?" Options: Looks good / Adjust images / Adjust outline +5. **Diagram Detection** — If images contain flowcharts, cycle diagrams, relationship maps, or architecture diagrams: + - Identify the **diagram type**: cycle / pipeline / feedback-loop / hierarchy / hub-spoke + - Count **nodes** and **connections** + - Flag slides that require diagram layouts — these must NOT use `card-grid` or `bullet-list` +6. **Confirm via AskUserQuestion** (header: "Outline"): "Does this slide outline and image selection look right?" Options: Looks good / Adjust images / Adjust outline **Logo in previews:** If a usable logo was identified, embed it (base64) into each style preview in Phase 2 — the user sees their brand styled three different ways. @@ -182,6 +186,7 @@ If images were provided, the slide outline already incorporates them from Step 1 - [html-template.md](html-template.md) — HTML architecture and JS features - [viewport-base.css](viewport-base.css) — Mandatory CSS (include in full) - [animation-patterns.md](animation-patterns.md) — Animation reference for the chosen feeling +- [diagram-patterns.md](diagram-patterns.md) — Diagram layouts: cycles, pipelines, feedback loops, hierarchies, hubs **Key requirements:** @@ -191,6 +196,16 @@ If images were provided, the slide outline already incorporates them from Step 1 - Add detailed comments explaining each section - Every section needs a clear `/* === SECTION NAME === */` comment block +**When generating slides from source material containing diagrams:** + +1. **DO NOT** convert relationship diagrams into `card-grid`, `bullet-list`, or simple horizontal flows. These destroy the visual topology. +2. **DO** read `diagram-patterns.md` and use the appropriate layout: `cycle-diagram`, `pipeline-diagram`, `feedback-diagram`, `hierarchy-diagram`, or `hub-diagram`. +3. For **cycle diagrams** with 4-8 nodes: Use SVG-based circular layout with arrow markers showing direction. Preserve the closed-loop visual. +4. For **feedback loops**: Use curved SVG paths with arrowheads or dashed-border containers to clearly show the return path. Never rely on text alone (e.g., "↻ 持续迭代"). +5. For **pipeline / hub diagrams**: Use connecting lines (`pipeline-connector-h`, `hub-line`) between nodes. The connection itself carries meaning. +6. Include the **Diagram CSS** from `diagram-patterns.md` in the presentation's ` @@ -322,6 +331,20 @@ Save processed images with `_processed` suffix. Never overwrite originals. --- +## Diagram Layouts in HTML + +When slides contain relationship diagrams (identified in Phase 1, Step 1.2), use the HTML structures defined in `diagram-patterns.md`. + +**Key principles:** +- Diagrams are **semantic** — the spatial layout carries meaning. Do not flatten them into lists or grids. +- Use **SVG** for curved connections, arrows, and animated draw-on effects. SVG is zero-dependency and scales perfectly. +- Use **CSS absolute positioning** for node placement on cycles and hubs. +- Always include the **SVG ``** for arrow markers once per presentation. + +**Common mistake:** Replacing a cycle diagram with a `card-grid` "because it fits the viewport." A grid destroys the closed-loop semantic. Use `cycle-diagram` instead and reduce node count if space is tight. + +--- + ## Code Quality **Comments:** Every section needs clear comments explaining what it does and how to modify it.