CommunityProgramación y desarrollogithub.com

explain-virtually

Turn questions about system architecture, runtime flows, modules, data structures, concurrency, or code mechanisms into an interactive, step-by-step visual local HTML walkthrough and open it for the user. Use when the user asks how a system, subsystem, protocol, or piece of code works and wants a friendly, progressive, visual explanation.

¿Qué es explain-virtually?

explain-virtually is a Claude Code agent skill that turn questions about system architecture, runtime flows, modules, data structures, concurrency, or code mechanisms into an interactive, step-by-step visual local HTML walkthrough and open it for the user. Use when the user asks how a system, subsystem, protocol, or piece of code works and wants a friendly, progressive, visual explanation.

Compatible con✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/Puggo1145/puggo-skills/tree/HEAD/explain-virtually

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Explain Virtually

Build a self-contained, interactive local HTML explanation (warm-paper tactile UI with adaptive module navigation, animated visual stage, bottom step rail, and concise right-hand guide) and open it directly in the user's browser — zero server, zero external runtime dependencies.

Set a shell variable once per session:

EV="<skill-dir>/bin/explain-virtually"

Replace <skill-dir> with the directory containing this SKILL.md. You can run explain-virtually from any directory.

How This Skill Is Layered (shadcn/ui Philosophy)

This skill is not a closed DSL. It cleanly separates what you never want to rebuild from the LEGO bricks you own and customize:

LayerWhere it livesWho owns it
1. App Shell & Chromeshell/ (auto-bundled on build)Skill handles it completely. Layout, responsive 3-pane UI, adaptive sidebar, bottom step rail, ←/→/R/Space/⌘K shortcuts, light/dark theme, pan/zoom, timer/rAF pause & cleanup, metric chip diff flashes, progress & checklist checkoffs. Never rebuild or worry about this.
2. Visual LEGO BricksCopied into <workspace>/blocks/Yours per explanation (shadcn/ui style). Plain, short, readable JS helpers (svg-core.js, iso-blocks.js, flow-motion.js, diagrams.js) that return real SVG/DOM nodes. Use them out of the box, edit them in <workspace>/blocks/ when you want a custom look, or skip them and render raw SVG/HTML directly into ctx.stage.
3. Explanation Content<workspace>/explain.js (+ optional custom.css)Your core job. Read the real codebase first, decompose the mental model, choreograph each step's visual evolution, and write short, high-signal guide copy.

Workflow

  1. Investigate the real code/system first. Ground every component name, file path, symbol, state transition, and edge case in actual facts — never invent hand-wavy boxes when real code exists.
  2. Scaffold a workspace (kept cleanly inside <skill-dir>/.local/explanations/<slug>/):
$EV init <slug> --title "Short Clear Title" --lang zh   # or --lang en (auto-detected from title)
  1. Author <workspace>/explain.js (and optionally tune <workspace>/blocks/*.js or <workspace>/custom.css).
  2. Build, validate, and open for the user:
$EV open <slug>

open validates JS syntax and EXPLAIN_APP structure (with soft nudges for overly long step prose or text-heavy nodeCard grids; it does not execute mount/step, so verify complex custom scenes visually when needed), bundles everything into a single self-contained index.html (optional Google Fonts link falls back cleanly offline; pass --no-remote-fonts for strict air-gapped output), opens it in the user's default browser, and prints the absolute file path. Share that file path with the user and give a 2–3 sentence summary of what the walkthrough covers.

Other useful commands:

$EV blocks                                    # list available LEGO blocks
$EV add <slug> iso-blocks diagrams            # copy/restore specific blocks into a workspace
$EV validate <slug>                           # syntax + schema + copy/visual-hygiene check
$EV build <slug> --out /abs/path.html         # export a standalone HTML to a custom location
$EV build <slug> --no-remote-fonts            # omit optional Google Fonts <link> tags
$EV list                                      # list generated workspaces
$EV clean --keep 5                            # prune old workspaces under .local/

Step 1: Decompose Complexity (Left Sidebar)

Match the sidebar structure to the actual complexity of the question — never pad a simple question with artificial modules:

  • Single focused mechanism (1 module, 4–8 steps): set modules: [ singleModule ]. The shell automatically turns the left rail into a clean Step Outline (1..N) instead of a redundant 1-item folder.
  • Medium subsystem (2–4 peer modules): set modules: [ m1, m2, m3 ]. Renders a clean flat module list with step counts and completion marks.
  • Complex multi-part system (4+ modules across concerns): set groups: [{ id, title, color, modules: [...] }]. Renders collapsible colored folder groups (sand, violet, green, orange, blue, teal, rose, slate, olive) and an expandable progress breakdown.

Step 2: Choreograph the Center Visual Stage

Stage Visual Discipline (Show on Stage, Explain on Right!)

Benchmark the center stage against designed-to-scale.vercel.app: the stage is a live visual machine, NOT a PowerPoint slide full of text boxes.

  • NO titles, subtitles, or footer summaries inside the SVG canvas. The sheet header above the stage already displays title + subtitle, and the right panel carries all narrative explanation. Extra text banners inside the canvas destroy visual breathing room.
  • Keep stage text ultra-minimal:
    • Every entity gets 1 icon + 1–3 short words (Web / Desktop, YouAgent Host, ThreadGrain, Codex, Postgres, Mac Exec). NEVER stuff sentences, bullet lists, or slash-separated lists of 5 concepts inside a diagram box.
    • Show dynamics with objects, pills, gauges, and moving packets — NOT prose inside boxes! Use floating pills (locked, epoch=3, cached · 5m, Noise 流, FOR UPDATE), load gauges (30%, 97%), red overload glow (EV.svg.setHot), dashed zones (MAC SANDBOX, APPEND-ONLY LOG), and EV.flow.stream() moving particles.
    • Move explanations to the right panel. If you catch yourself typing more than ~8 words inside a single diagram node, delete it from the SVG and put that thought in the right guide card instead.
  • Default to tactile 3D isometric blocks (EV.iso.*) first for services, hosts, processes, runtimes, gateways, clients, caches, queues, and databases! Use EV.iso.laptop, EV.iso.tile, EV.iso.cylinder, EV.iso.stack (3D pages/logs/queues), and EV.iso.zone (dashed boundary).
  • Strict Orthographic Isometric Rules (grid: 'iso') — CRITICAL FOR CLEAN PERSPECTIVE:
    • The SVG renders a true 2:1 orthographic isometric grid inside the same coordinate space as your blocks:
      • u (+1) moves forward right-up (NE, slope -0.5) — your main left-to-right flow axis!
      • v (+1) moves branch right-down (SE, slope +0.5); v (-1) branches up-left (NW).
    • ALWAYS place isometric entities on clean integer (u, v) grid coordinates (e.g. { u: 0, v: 0 }, { u: 1, v: 0 }, { u: 2, v: 0 }, { u: 2, v: -1 }, { u: 2, v: 1 }) — NEVER use arbitrary hand-guessed (x, y) pixels or fractional off-axis coordinates!
    • ALWAYS wire isometric entities with EV.flow.connect(nodeA, nodeB, opts) (NOT manual edge([a.ports.se, b.ports.top])!). connect() guarantees every arrow exits symmetrically from the ground-plane face port with an 8px breathing gap and runs 100% parallel to the 2:1 isometric grid (straight line when u or v matches; clean 2-segment orthographic elbow with bend: 'u'|'v' otherwise).
    • ALWAYS size dashed boundaries with grid bounds EV.iso.zone({ u1, v1, u2, v2, pad: 0.48, label }) so the dashed parallelogram cleanly wraps the cluster and never slices through a tile!
  • Never stamp the same 2×3 rectangle grid across multiple modules. Match spatial geometry to the actual mental model: orthographic isometric hops (u/v grid), hub-and-spoke fan-out, circular feedback loop (for agent/event loops), vertical sequence lifelines, memory/buffer slot strips, or side-by-side live state + real code.
Anti-pattern (DON'T)Target craft (DO)
6 identical 2D nodeCard rectangles arranged 2×3, each stuffed with 2–3 lines of prose3–5 iconic 3D EV.iso objects (laptop, tile, cylinder, stack, zone) labeled with 1–3 words + animated packets along edges
Big heading + subtitle + bottom summary sentence drawn inside the SVG stageClean open isometric/dot/line stage; let the sheet header and right guide card carry all prose
Static arrows where only border colors change between stepsSpatial progressive disclosure + EV.flow.stream() moving packets + holdAt blocking/waiting dots + floating status pills (HIT, locked, 97%)
Rebuilding a whole sequence diagram from scratch every stepMount const seq = EV.diag.sequence(...) once in mount(), then call seq.setActiveCount(n) in step(i)

Choosing the Visual Form per Module

Pick the visual form that fits each module — mix freely across modules or combine SVG + HTML when helpful:

Question typeStage gridRecommended blocksVisual pattern
Request path, distributed services, host/gateway/sandbox, IPC, pipelines'iso'EV.iso.* + EV.flow.*Primary default. Place 3–6 iconic 3D laptop/tile/cylinder/stack/zone entities in mount(ctx). Reveal progressively, dim inactive paths (EV.svg.setDimmed), animate packets with EV.flow.stream(), float short pills (GET /turn, locked, 30%).
Loops & feedback cycles (agent loop, event loop, reconciliation)'iso' or 'dot'EV.iso.tile arranged in a ring + curved EV.flow.edge + EV.flow.streamArrange 4–5 compact tiles in a circular loop so packets visibly orbit the cycle (Context → Model → Tool → History → Context) and branch out on exit!
Concurrency, locks, handshakes, async lifelines'line'EV.diag.sequenceMount once in mount(), then call seq.setActiveCount(n) in step(i) to reveal arrows and amber wait/lock bars (spans) smoothly.
Ring buffers, caches, WAL/rollout logs, queues, stacks'iso' or 'dot'EV.iso.stack (3D labeled slabs) or EV.diag.slotsShow physical memory/log cells lighting up (active/dirty/hit/miss/empty) with head/tail/epoch pointers.
"How does this specific function/transaction/hook work?"'none'EV.diag.splitStage + EV.diag.codePanel + compact visual on leftReal pruned 8–14 line code excerpt on the right with highlighted executing line(s) + inline runtime value annotations, synced with live visual state on the left.
State machines or compact struct/AST anatomy'dot'EV.diag.nodeCard (title + 0–2 short k: v tokens only!) + EV.flow.edgeCompact 2D state nodes wired via .ports — keep each node to a crisp state name + at most 1–2 tiny tokens, NEVER prose sentences!
Custom geometry (hash ring, flamegraph, interactive toggle)anyRaw SVG/HTML in ctx.stageDrop standard DOM/SVG directly into ctx.stage (data-interactive="true" prevents pan/zoom hijacking on controls).

The Golden Rule of Progressive Disclosure:

  • Build persistent nodes & edges once in scene.mount(ctx) and return them as state.
  • In scene.step(i, step, ctx, state), flip visibility (EV.svg.setVisible), dimming (EV.svg.setDimmed), overload glow (EV.svg.setHot), dynamic pills/gauges/cards on layers.over / layers.hud, and active EV.flow.stream(...) animations.
  • Keeping nodes spatially anchored means the reader's eyes never lose orientation between steps.
  • shell.js automatically calls ctx.clearTimers() and cleans up EV.flow.stream() particles on every step change, replay, or module switch — and respects Pause (Space) automatically.

Step 3: Right-Panel Copy Discipline

Treat the right panel like a great visual textbook, not a wall of prose:

  • Follow a clear pedagogical arc per module:
    1. problem / overview (tone: 'problem' or 'sand') — concrete trigger or symptom, minimal diagram (1–2 nodes).
    2. flow / mechanism (tone: 'flow' or 'concept') — add 1–2 elements per step, show exact cause & effect.
    3. tradeoff / edge (tone: 'tradeoff') — show failure mode, race condition, bottleneck, or cache miss.
    4. recap (tone: 'recap') — whole system at rest + optional on-stage summary EV.flow.card + 3–4 takeaways bullets.
  • Keep each step punchy: 1–2 short paragraphs (roughly 35–90 English words or 50–150 Chinese characters). Hide incidental boilerplate; focus on the single mechanism changing in this step.
  • Use semantic formatting: wrap newly introduced concepts in <span class="term">...</span> and real file/symbol/API names in <code>...</code>.
  • At most ONE rich block below the body per step: pick callout (insight / tip / warn / next), OR code (≤8 lines), OR compare table, OR takeaways (on recap).
  • Show the delta: include changes: [{ type: 'add'|'mod'|'del', text }] on progressive steps so the reader sees immediately what changed on stage.
  • Use live HUD metrics (step.metrics) whenever numbers/states evolve (good / warn / bad levels) — values automatically flash when they change from the previous step!
  • Set module.goals (3–5 concrete outcomes with atStep: <1-based step>) so the bottom-right checklist ticks off as the reader advances.

Quick Reference: EXPLAIN_APP & blocks/

window.EXPLAIN_APP shape

window.EXPLAIN_APP = {
  id: 'my-slug',
  title: 'System Title',
  highlight: 'Title',          // word underlined in sage green
  badge: 'repo / branch',      // optional topbar pill
  lang: 'zh',                  // 'zh' | 'en' (auto-detected if omitted)
  modules: [ /* OR groups: [{ id, title, color, modules: [...] }] */ ],
};

Each module: { id, title, subtitle, tags, legend, goals, steps, scene }. Each step: { id, label, phase: { text, tone }, title, body, callout?, code?, compare?, takeaways?, changes?, metrics?, legend? }. Scene lifecycle: { grid: 'iso'|'dot'|'line'|'none', mount?(ctx, mod) => state, step(i, step, ctx, state), replay?(...), pause?(paused, ctx, state), destroy?(ctx, state) }.

blocks/ LEGO Bricks (copied locally — edit freely!)

  • EV.svg (blocks/svg-core.js): createStage(ctx, { container?, grid?, panZoom?, clear? }) -> { svg, layers: { floor, links, packets, ents, over, hud } } (when grid: 'iso', embeds an SVG-native 2:1 drafting grid aligned to iso(u, v)), el(tag, attrs, children), icon(name, { x, y, size, color }), iso(u, v) -> { x, y } (u=NE forward, v=SE branch), fitViewBox(svg, pad), focus(ctx, svg, elements, pad), setVisible(el, bool), setDimmed(el, bool), setHot(el, bool).
  • EV.iso (blocks/iso-blocks.js): tile({ u, v, rx?, ry?, depth?, tone, icon, title, subtitle?, status?: 'ok'|'bad' }), cylinder({ u, v, tone, icon, label, labelSide? }), laptop({ u, v, label }), stack({ u, v, count|items, axis?: 'u'|'v', tone, activeIndices, label }), zone({ u1, v1, u2, v2, pad?, label }). All nodes accept { u, v } grid coords (or { x, y }) and expose symmetric .ports and ._iso.
  • EV.flow (blocks/flow-motion.js): connect(nodeA, nodeB, { bend?: 'u'|'v', style?, arrow?: 'end'|'start'|'both', label?, labelDx?, labelDy? }) -> { g, path, label } (primary isometric connector — guarantees exact 2:1 grid-parallel arrows!), edge(points, { ... }), isoEdge(fromPt, toPt, { ... }), stream(ctx, layers.packets, edge.path, { kind: 'req'|'res'|'slow'|'heavy'|'write'|'msg'|'purple'|'err'|'ping', count, duration, reverse, holdAt }), pill({ x, y, text, tone, icon, anchor }), gauge({ x, y, pct, label, tone }), card({ x, y, title, icon, rows, footer }), burst(layer, x, y, 'ok'|'fail').
  • EV.diag (blocks/diagrams.js): nodeCard({ x, y, tone, icon, title, subtitle?, items?, titleSize?, bodySize?, rowHeight?, state }) (with .ports; keep compact, no prose!), sequence(parent, { actors, messages, spans, activeCount }) (returns <g> with .setActiveCount(n), .rows, .spans), slots(parent, { x, y, title, items, cellW, cellH, orientation }), splitStage(ctx, { leftWidth }) -> { left, right }, codePanel(parent, { filename, badge, lines, highlight, annotations }).

For a complete working multi-pattern reference (isometric cache path + sequence row lock + ring buffer synced with code), read examples/demo-explain.js.

Skills relacionados