Communitygithub.com

visual-explainer

Turn complex, math-heavy, stateful, or hard-to-follow technical subjects (PRs, RFCs, AI-authored proposals, existing architectures, algorithms, state machines, or policies) into faithful, self-contained interactive visual explainers with closed-loop simulation, parameter experimentation, and automated verification. Use when a user says a design, PR, codebase mechanism, or proposal is hard to understand, wants to visually explore how a system behaves under stress, or wants to test alternative settings and surface edge cases.

visual-explainer 是什麼?

visual-explainer is a Claude Code agent skill that turn complex, math-heavy, stateful, or hard-to-follow technical subjects (PRs, RFCs, AI-authored proposals, existing architectures, algorithms, state machines, or policies) into faithful, self-contained interactive visual explainers with closed-loop simulation, parameter experimentation, and automated verification. Use when a user says a design, PR, codebase mechanism, or proposal is hard to understand, wants to visually explore how a system behaves under stress, or wants to test alternative settings and surface edge cases.

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/vlameiras/skills/tree/HEAD/visual-explainer

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Visual Explainer

Build an analytical, zero-dependency, single-file interactive HTML explainer (index.html) backed by an automated verification script (check.mjs) so a human can understand, stress-test, and critique a complex technical subject.

Format rule: Build a clean, data-driven analytical web page with inline SVG diagrams, real formulas/state transitions, and live simulation. Do not wrap complex engineering topics in cutesy metaphors, games, or isometric towns unless explicitly requested—metaphors obscure the exact mechanics the reader is trying to verify.

Workflow

1. Ground Strictly in the Source Material

Before writing any HTML or JS, read the actual source of truth:

  • The full PR diff, RFC, design doc, source code, latest commits, and review comments (caveats and operational limits often live in comments or config).
  • Extract every constant, bound, formula, state transition, guard condition, scope boundary (what is inside vs. outside the blast radius), open decision, and prerequisite.
  • If explaining a proposed change to an existing codebase, note any conflicts with current production/main config as potential review findings.

2. Build a Single-File Interactive Explainer (index.html)

Keep everything in one self-contained index.html (inline CSS, inline SVG, vanilla JS, zero external CDN dependencies) so it works offline via open index.html, diffs cleanly in Git, and deploys trivially anywhere.

Follow the 6-section narrative arc (adapt section labels to fit the domain; see references/architecture-and-ux.md for layout, simulator UX, and accessibility rules):

  1. The "Why" (Contrast Before Mechanism) — Show the naive/status-quo approach side-by-side with the mechanism being explained using concrete numbers so the design has an obvious reason to exist.
  2. Architecture, Boundaries & Safeguard Layers — Diagram what is inside vs. outside scope, how safeguards or stages layer (e.g., soft control vs. hard circuit breakers), and explicit operational limits (ephemeral state, manual steps, drift).
  3. One Unified Closed-Loop Simulator — Do not build two redundant simulators (e.g., a 1-step calculator plus a multi-step timeline). Build one multi-step timeline with:
    • A per-step Live Formula / State Inspector showing the exact arithmetic or state transitions for the selected step.
    • 4–5 named stress scenarios (a steady baseline plus realistic failure modes: surge, late crunch, drift, guard-trip/runaway).
    • Start on Step 1 (never jump to the end state on load), with Play/Pause, Step, Scrubber, and Jump-to-End.
    • A plain-English "What changed on this step?" banner stating the concrete user-visible consequence (e.g., whether automation paused vs. users lost access).
    • Scorecards showing metrics through the selected step (no premature end-of-run spoilers).
    • An explicit "Illustrative scenario, not production data" badge with model assumptions tucked into a collapsible <details> block.
  4. Parameter Experimentation & Sensitivity Matrix — Expose key constants or thresholds as live controls:
    • Always load with the source's exact defaults, with a visible Default settings / Custom settings badge and a one-click Reset button.
    • Ensure slider ranges cover the true bounds (including floors/ceilings).
    • When the user wants to compare settings, run a local headless sweep script (sweep.mjs) across all scenarios and embed a clickable sensitivity matrix (color-coded by failure outcome) that loads any cell's parameters directly into the simulator.
  5. Rules, Guards & Operational Details — Plain-English summary of invariants, safety stops, prerequisites, open decisions, and rollout or lifecycle notes.
  6. Plain-English Glossary — Define every symbol, variable, acronym, and domain term used anywhere on the page. Never leave jargon unexplained.

3. Audit Fidelity & Add Automated Checks (check.mjs)

Simulation explainers silently drift from specs or code unless audited. Follow references/fidelity-and-verification.md:

  • Audit the model and copy line-by-line against the source for lookahead bias, sticky state, unit mismatches on charts, magic numbers, float-precision edge cases, and copy/code drift.
  • Write a companion check.mjs script that extracts the inline <script> from index.html, runs it in Node (vm), and asserts invariants across every step of every scenario.
  • Run node check.mjs after every edit.
  • Separate explainer bugs (fix immediately) from weak spots in the underlying design or code (report clearly with exact scenario/step numbers and offer to draft review comments or fixes).

4. Verify UI Craft & Naming Clarity Visually

Before handing off or deploying:

  • Eliminate ambiguous labels: Rename overloaded terms immediately (e.g., distinguish "Monthly cap by day" from "Daily cap"; "0 Hard Stops" from "Zero Stops"; "Updates paused" from "Service blocked").
  • Render in a browser (or headless Chrome) and verify:
    • Sticky header scroll-margin-top clears section headings when jumping to #anchors.
    • Every slider has an associated <label for>, active preset buttons expose aria-pressed, clickable event rows are <button> elements, and text/badges meet WCAG AA (>= 4.5:1).
    • Formula boxes preserve line breaks (white-space: pre-wrap or block elements) and card headings wrap cleanly.

5. Iterate, Recommend & Sync

  • When the user probes "why did X happen?" or "is Y too aggressive?", explain using the exact step/numbers from the simulation.
  • When recommending parameter changes, respect the user's fixed constraints and rank options by minimal diff to the existing design (preferring existing config knobs over new logic/features).
  • When the source PR, doc, or codebase receives new commits or review comments, re-diff against the latest revision and update formulas, terminology, caveats, and check.mjs.
  • If deploying to a static host or Kubernetes ConfigMap (especially with subPath mounts that require a pod restart/recreate to reflect updates), verify that the live served HTML matches the local file byte-for-byte and passes node check.mjs.

相關技能