--- name: slide-sage description: Create data-rich, interactive HTML presentations with charts, architecture diagrams, code highlighting, and professional styling. Use when the user wants to build a presentation with data visualization, technical diagrams, metrics dashboards, or code examples. Supports Chart.js, ECharts, D3, CSS/HTML diagrams, inline SVG, Prism.js code highlighting, and 6 curated style presets. --- # Slide Sage Create data-rich, interactive HTML presentations as single files with charts, diagrams, and code highlighting. ## Core Principles 1. **Data-First** — Charts, diagrams, and metrics are first-class citizens, not afterthoughts 2. **Single File** — Every presentation is one HTML file with inline CSS/JS. Libraries from CDN only 3. **Viewport Fitting (NON-NEGOTIABLE)** — Every slide fits exactly within 100vh. No scrolling. Content overflows? Split into multiple slides 4. **Adaptive Intelligence** — When given raw data, act as narrative director. When given a clear outline, act as layout executor 5. **Colorblind Safe** — All data visualization uses accessible color palettes by default 6. **Utility-First CSS (NON-NEGOTIABLE)** — Define CSS classes in `
``` ### Step 4: Chart Generation When creating charts, follow these rules: 1. Use Chart.js as default (covers 80% of chart needs) 2. Place canvas in a responsive container: `max-height: min(55vh, 420px)` 3. Apply colorblind-safe palette from Tier 1 4. Match chart text colors to the presentation theme 5. Set animation based on detected level (minimal → `animation: false`) 6. Max 2 charts per slide in a side-by-side flexbox layout 7. Include axis labels and a legend where appropriate ### Step 5: Diagram Generation Use a CSS-first approach for all diagrams. **Tier 0: CSS/HTML Diagrams (PREFERRED — use for 80% of diagrams)** Styled divs with flexbox/grid, borders, and accent colors. Full theme integration, perfect sizing, zero dependencies. Use the utility classes from `viewport-base.css`: - **Sequence flows** → `.sequence-flow`, `.seq-participants`, `.seq-actor`, `.seq-step`, `.seq-arrow` - **Architecture stacks** → `.arch-stack`, `.arch-row`, `.arch-row-group` - **Pyramids/hierarchies** → `.pyramid`, `.pyramid-layer` - **Process flows** → `.process-flow`, `.process-step`, `.process-arrow` - **Comparisons** → `.card-accent`, `.card-top-accent` with CSS Grid See `references/diagram-patterns.md` Tier 0 for complete HTML patterns. **Tier 1: SVG Templates** — If the diagram matches a common pattern, use a pre-designed SVG template from `templates/diagrams/`. Available: microservices, data-pipeline, client-server, layered-arch, cicd-pipeline, hub-and-spoke, cloud-three-tier, kubernetes-cluster, event-driven-pubsub, ml-pipeline, c4-context, network-zones, api-gateway-auth, pyramid-roadmap, funnel, nested-scopes, tree-hierarchy. Write only the data object (~200-400 chars) **Tier 2: Inline SVG** — Only for fully custom diagrams needing precise geometry (network topologies, custom shapes). Use `viewBox` + `preserveAspectRatio` + CSS variables for colors. Never use raw coordinate math for arrows — use CSS borders or SVG `` with clean polygon definitions. For diagram style: - **Clean geometric** (default) — Rounded corners, soft colors, professional - **Hand-drawn** (user opts in) — Apply Rough.js to shapes for sketch-style ### Step 5b: Icon Integration When slides reference specific technologies or infrastructure components, enhance visual recognition with icons from the curated Lucide icon set. **When to use icons:** - Architecture diagrams mentioning specific tech (database, cloud, auth, server) - Process steps or workflow slides where icons aid scanning - KPI/metric cards where a category icon adds context - Bullet lists with technical items (optional, don't overuse) **How to include:** 1. Read `references/icon-library.md` for the full icon catalog and path data 2. Include the hidden sprite block from `templates/icons/lucide-sprite.svg` at the top of `` (before slides) 3. Reference icons via `` inside inline SVG diagrams 4. Or use standalone `` elements in HTML slide content **Icon sizing:** - In SVG diagrams: `width="20" height="20"` for standard boxes, `width="16" height="16"` for small contexts - In HTML content: use the `.icon` CSS class (1.2em, inherits text color) **Rules:** - Icons are always optional — never required. Templates work perfectly without them - Only include the sprite block when at least one slide uses icons (don't add unused dependencies) - Icons inherit `currentColor` — they automatically match the presentation theme - Prefer icons that reinforce the component's function: database→database, auth→shield, API→plug, cloud→cloud ### Step 6: Comparison Slides When content involves comparisons (before/after, pros/cons, A vs B): - Use split-view layout from `templates/comparison/split-view.html` - Or feature matrix from `templates/comparison/feature-matrix.html` - Color-code columns with accent and secondary accent colors ### Step 7: Visual Polish (Applied by Default) Apply visual depth techniques based on the detected animation level. These are **on by default** — not optional extras. | Technique | Minimal | Balanced | Dramatic | |---|---|---|---| | Card accent borders (`.card-accent`) | Yes | Yes | Yes | | Badge labels (`.badge`) | Yes | Yes | Yes | | Tight heading typography (`.tight-heading`) | Yes | Yes | Yes | | Background grid (`.bg-grid`) | No | Yes | Yes | | Staggered reveal animations (`.reveal`) | No | Yes | Yes | | Section labels (`.section-label`) | No | Yes | Yes | | Glow effects (`.glow`) | No | No | Yes | | Glow pulse (`.glow-pulse`) | No | No | Yes | **How to apply:** 1. Add `bg-grid` class to `.slides-container` for Balanced/Dramatic levels 2. Add `reveal` class to content elements inside slides (cards, list items, diagram blocks) for Balanced/Dramatic 3. Add `card-accent` or `card-top-accent` to card elements 4. Use `badge` classes for labels, step numbers, and status indicators 5. Add `glow` to key accent elements for Dramatic level 6. Use `tight-heading` on main headings for tighter letter-spacing 7. Use `inline-code` class for short code references in text (e.g., `FallbackModel(...)`) See `references/style-guide.md` "Visual Depth Techniques" section for full details. ### Step 8: Code Slide Quality When generating code slides: 1. Always specify the language class on `` elements: `` 2. Call `Prism.highlightAll()` in the initialization script after DOM ready 3. Max 10-12 lines per code block — if more, split across slides 4. For inline code references (like `FallbackModel(...)` in a paragraph), use `` — do NOT create a separate code block 5. Style code containers with proper padding, border-radius, and a code-appropriate background See `references/code-highlighting.md` for Prism.js initialization requirements. ## Phase 5: Deliver ### Pre-Delivery Validation (MANDATORY) Before writing the final HTML file, perform these checks. This takes 30 seconds and prevents silent visual regressions. #### Check 1: Class Integrity Scan every `class="..."` attribute in the generated HTML. For each class name: - Is it in `viewport-base.css`? → OK - Is it in a comparison template you used? → OK - Is it defined in this presentation's `