Interactive explainer

From rianvdm/product-ai-public · View interactive version

Interactive explainer is an AI agent skill from the GitHub repository rianvdm/product-ai-public. Use when the user wants a reader-controlled HTML visualization of a process, algorithm, decision, comparison, or system, including sliders, toggles, branching, step-throughs, live inputs, or a durable explainer deployed as a site.

How to use this skill

Skill file

Interactive Explainer

You build interactive HTML visualisations that make abstract processes, algorithms, and decision logic _experiential_ — something the reader can manipulate and explore, not just read. The goal is to eliminate cognitive debt: after using the visualisation, the reader should feel like they _understand_ the logic, not just that they've seen it described.

Source Material

Preferred input is a linear walkthrough (from the linear-walkthrough skill), because walkthroughs are already structured as a logical narrative with clear sections and identified connections. If none exists:

Before You Build

Identify two things:

1. What is the core thing to make understandable?

Read the walkthrough and ask: _what is the single most important thing a reader struggles to grasp from reading alone?_ This is usually one of:

The visualisation should be built around _that one thing_, not an exhaustive diagram of everything.

2. What visualisation type fits?

| Core content | Visualisation type |

| ------------------------------------ | ---------------------------------------------------------------------------------------------------- |

| Decision algorithm / flowchart | Interactive decision tree — live inputs that traverse the logic and highlight the resulting path |

| Sequential pipeline / process stages | Animated step-through — stages that activate in sequence with explanations at each step |

| System with interacting components | Clickable component diagram — click to explore each part; relationships animate on hover/click |

| Parameter-driven concept | Live explorer — sliders/inputs that change the output in real time, showing cause and effect |

| Comparative options | Side-by-side toggle — switch between options and see what changes |

If the content is complex enough to merit it, combine types — e.g. a decision tree that also shows parameter effects as sliders. Richer is better _if it adds clarity_. Never add visual complexity that requires the user to understand the visualisation before they can understand what it's visualising.

Propose the approach briefly before building. One sentence on what you'll build and why, then proceed unless the user redirects. Don't wait for approval — describe and build.

Two Output Modes

Mode A: Deployed Worker site (preferred for durable explainers)

For explainers that will be shared with colleagues, maintained over time, and deployed behind Access, use the deployed Worker framework. This is a battle-tested shared CSS/JS engine extracted from two production sites.

When to use: The user wants a deployed internal site, mentions "deploy", wants something colleagues can bookmark, or the subject is complex enough to warrant multiple guided modes.

Deployment: Follows the standard internal-workers-deployment skill (Data Lab account, cf-* naming, wildcard Access).

Implementation reference: Read reference/deployed-worker-framework.md in this skill's directory for the explainer-specific guide covering:

Mode B: Single-file HTML (for quick explorations)

For one-off visualisations, quick explorations, or content that doesn't need deployment, produce a single self-contained .html file.

When to use: The user says "quick", wants to explore an idea, or the subject is simple enough for a single page without guided modes.

Output requirements:

Design Principles (both modes)

Clarity before richness. Every visual element should earn its place by making the logic clearer. If removing something makes the visualisation easier to understand, remove it. A companion to a decision doc is for easy understanding and the doc holds the detail: each scene gets one short claim and one picture that proves it. When a reviewer flags an accuracy problem in a visual, fix it inside the existing picture (make the total come from what is actually lit, move a mark to where the picture crosses it) rather than adding a second chart or a caveat paragraph, and keep any visual the user has praised.

Interactive, not passive. The user should be able to change something and see the logic respond. A static diagram is documentation; an interactive one is understanding.

Self-orienting. The visualisation should include:

Smooth and intentional. Transitions should be smooth (200–400ms CSS transitions for most things). Animation should have a purpose — use it to show _movement through logic_ (a path being highlighted, a stage activating), not decoration.

Visual style

Use a clean, modern design based on a clean design system. The palette uses semantic CSS custom properties with automatic dark mode support.

For deployed Worker sites, the tokens are defined in shared.css. For single-file HTML, include this token block in the <style>:

:root {
  color-scheme: light dark;

  /* --- Surfaces (layered hierarchy) --- */
  --base: #ffffff;          /* page background */
  --elevated: #fafafa;      /* cards, panels raised above base */
  --recessed: #e6e6e6;      /* inset areas, code blocks */
  --overlay: #f5f5f5;       /* tooltips, popovers */

  /* --- Text --- */
  --text-default: #1a1a1a;
  --text-strong: #525252;   /* secondary headings, labels */
  --text-subtle: #737373;   /* descriptions, captions */
  --text-inactive: #a3a3a3; /* disabled, placeholder */

  /* --- Brand & accent --- */
  --brand: #f6821f;         /* brand orange — use sparingly for identity */
  --accent: #1a5dab;        /* dashboard blue — primary interactive */
  --accent-hover: #174e91;
  --accent-light: #e8f0fe;  /* highlight backgrounds */

  /* --- Semantic --- */
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #2563eb;
  --info-light: #dbeafe;

  /* --- Chrome --- */
  --border: rgba(0, 0, 0, 0.1);
  --ring: #a3a3a3;          /* focus rings */
  --muted: #d4d4d4;         /* inactive borders, dividers */

  /* --- Typography --- */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --base: #0a0a0a;
    --elevated: #171717;
    --recessed: #262626;
    --overlay: #262626;

    --text-default: #f5f5f5;
    --text-strong: #a3a3a3;
    --text-subtle: #737373;
    --text-inactive: #525252;

    --brand: #f6821f;
    --accent: #5b9cef;
    --accent-hover: #7db3f5;
    --accent-light: #1a2a44;

    --success: #34d399;
    --success-light: #064e3b;
    --warning: #fbbf24;
    --warning-light: #451a03;
    --danger: #f87171;
    --danger-light: #450a0a;
    --info: #60a5fa;
    --info-light: #172554;

    --border: rgba(255, 255, 255, 0.1);
    --ring: #525252;
    --muted: #404040;
  }
}

Usage rules:

For node/flowchart diagrams:

Patterns for common visualisation types

Interactive decision tree

Structure: inputs on the left or top; the tree in the centre; result panel at the bottom or right.

Animated step-through

Structure: a linear sequence of stages across the top or side; a detail panel that shows what's happening at the current stage.

For deployed Worker sites, the shared.js engine handles all of this automatically via the pageConfig.modes step definitions.

Live explorer

Structure: controls (sliders, inputs) in a sidebar; the main area shows the output updating in real time.

Browser checks before handing over

Run these in a real browser on every build, both modes:

Saving and opening

Deployed Worker sites

Deploy with npx wrangler deploy from the repo. See reference/deployed-worker-framework.md for the full deployment and Access setup process.

Single-file HTML

Save to:

/Users/rian/git/product-ai/output/<name>.html

Name it in lowercase kebab-case after the source walkthrough or subject — e.g. interactive-data-pipeline-systems.html.

After saving, open it in the default browser yourself:

open "/Users/rian/git/product-ai/output/<name>.html"

Then tell the user where the file was saved and that it's open.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.