Mechanism Viz
ASecurityPlan and build a trace-grounded explanation of how a mechanism in your own system works, as a post with animated figures, an interactive explorer that replays one real instance, and benchmark charts. Use when writing a deep-dive or launch post for your own system, or visualizing how a request, lock, scheduler, cache, protocol, storage engine, or concurrent data structure behaves step by step. Do NOT use for a narrated lesson built from someone else's source (use html-lesson), an in-chat diagr...
- 4 stars
- 0 votes
- 0 copies
- 2 views
- Added November 9, 2026
Works with
Security analysis
100/100Pro scans all 3 files and shows the line behind each finding
npx -y skills add wilbeibi/wilbeibi-skills --skill mechanism-viz --agent claude-codeAre you the author of Mechanism Viz?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/wilbeibi-mechanism-viz)---
name: mechanism-viz
description: Plan and build a trace-grounded explanation of how a mechanism in your own system works, as a post with animated figures, an interactive explorer that replays one real instance, and benchmark charts. Use when writing a deep-dive or launch post for your own system, or visualizing how a request, lock, scheduler, cache, protocol, storage engine, or concurrent data structure behaves step by step. Do NOT use for a narrated lesson built from someone else's source (use html-lesson), an in-chat diagram (use show-me), a single illustration (use sketch-concept), a demo of a proposed state model (use state-prototype), or a standalone chart (use dataviz).
---
# mechanism-viz
Show one real instance passing through the mechanism, drawn from the system's own trace, with cost counted in a
unit the reader can see. The system describes itself; the viewer only reads and draws.
## Slots (REQUIRED before drawing anything)
Write each slot down. An empty slot is the usual reason a figure shows state without showing the idea.
| Slot | Fill with | bbtree example |
|---|---|---|
| Reader baseline | What they already know; teach only the delta | knows B-trees, not bbtree |
| Payoff | 2-3 concrete outcomes with numbers, shown first | 5x std BTreeMap, 30% less memory |
| Cost model | Unit price of each cost, levers ranked by it | miss ~100 ns, instruction ~0.5 ns, coherence >100 ns |
| Instance | The single thing the reader follows | one key's lookup |
| Cost unit | What gets drawn so the reader can count it | 64-byte cache line, solid dot = read |
| Trace source | Read-only inspect/trace API of the real system | `inspect` views, `trace_many` with a no-op watch |
| Views | Structure / resource / state, linked by one hover | path cards / memory map / slot table |
| Invariants | Shown in place, next to what they constrain | fences beside each node |
| Scenarios | Curated happy, contended, failure/recovery cases | "lookups worth seeing" |
| Time axis | For ordering or concurrency: lanes or time-runs-down | `batch-lanes`, `version-lock` |
For your own system, the cost unit is often an RPC, round trip, fsync, page, lock handoff, retry, or queue hop. For
a mechanism that is mostly about ordering, the time-axis slot carries the explanation. See
`references/bbtree-case.md` for the full mapping with a blank column to fill.
## Workflow
1. **Expose the trace.** Add a read-only inspect/trace interface to the system. The viewer consumes events and
computes no semantics (offsets, decisions, which branch). Done when a test fails if the viewer and the code
disagree, and the instrumentation adds no hot-path work, or its cost is measured and reported.
2. **Write the post skeleton.**
- *What can it do?* Open on the cost or failure the reader already hits and the measured payoff (with workload and
scale named) before pitching the system's name, followed by the charts.
- *How it works.* The cost model, then the levers in ranked order. The cost model is one pure function: unit prices
and the workload mix in, the lever ranking and the "worth it" sentence out, computed at the measured prices.
When a reader would challenge a price, that price is a control. Their sentence sits beside the measured one and
is labeled as theirs. The trace is not an input, and the figures do not re-time or grow events from the new
prices. Skip the controls when the post has no cost model. Each lever follows the same order:
1. A toy thought experiment: the smallest case where the effect is countable, two alternatives side by
side, one animation step per cost unit.
2. How the lever applies to the real system.
3. The measured results.
4. Optionally, a bonus.
- *How do we know it is correct?* The guards, each with a link: a reference implementation diffed under
fuzzing, model checking or deterministic simulation, proofs, and the accountable human.
- *Reviewers.*
Done when every lever has a toy figure and a result number, every number on screen traces to a data file, and the
headline payoff reads as one self-contained sentence a reader could paste into a team Slack with the link. When
prices are editable, both sentences are return values of the cost function.
3. **Draw the figures.** Each figure is one self-contained file. Motion either explains a step or enacts the
measured quantity; nothing else moves. Done when reduced motion shows the complete final frame, and the
legend defines the cost unit and what one step or turn is.
4. **Build the explorer** when readers gain from choosing their own instance. Give it one screen at a stated
viewport, the URL as full state with a deterministic seed, curated scenarios, and step and play controls.
When the cost model is on the page, the URL includes the reader's prices, so a copied link opens that scenario.
Done when a copied link reproduces the same picture and, if prices are editable, the same two sentences.
5. **Present the evidence.** Run `benchmark-checklist` on every claim. Highlight your own implementation in one
color and keep the competitors in muted grey. Demote reference-only rows that have different semantics.
Name the cells you lose. Compute the headline sentence from the data, not by hand. Done when the charts read
raw result files directly.
6. **Audit and log.** After each iteration, critique against a heuristic list and score it. Append a dated
decision to a design log: what was tried, why it was dropped, and whether it was the author's call or an
audit finding. Done when the log has one entry per visual change.
## Gates
- One instance at a time; never the whole system rendered at once.
- Nothing drawn that the instrument cannot observe. A simulated duration, an inferred wait, or a modeled speedup
is out, or it is labeled illustrative. A control never writes the trace, an offset, or a decision the system made.
- The measured "worth it" sentence and the reader's sentence are both on screen when prices are editable, and only
the measured one is the post's claim.
- Order is shown, not time, unless the time was measured.
- Every animation passes the motion test in step 3; decorative transitions fail.
- Text is at least 11 px, secondary text keeps 4.5:1 contrast, and touch targets on mobile are 44 px.
- Lower-is-better metrics read "23.7% fewer", not "1.3x fewer".
## Failure -> fix (from bbtree's design log)
| Tried | What went wrong | Fix |
|---|---|---|
| Whole structure drawn at scale | Read as color strips; said nothing | Follow one instance |
| State shown without the idea | No legend, views unlinked, no motion | Legend, terms explained in place, shared hover, scenarios |
| Step-by-step guide panel | Took half the space to repeat the inspector | Delete it; explain in place |
| Cost model simulated timing | Drawn speedups disagreed with measurements | Draw order only |
| Marked where threads wait | The trace cannot know (non-blocking) | Delete it |
| Per-op latency with fenced timers | The fences were half of what was measured | Report the back-to-back mean |
## References
- `references/implementation.md`: self-contained SVG figures, the step-based motion model, the single-variable
playback timeline, URL state, chart motion, and post layout.
- `references/bbtree-case.md`: source pointers and the bbtree -> general -> yours mapping table.
Files in this skill
- SKILL.md
- references/bbtree-case.md
- references/implementation.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.