agentleFS
wilbeibiwilbeibi/wilbeibi-skills/skills/mechanism-viz/SKILL.md

mechanism-viz

Skill2 starsChanged 2 months agoMITView on GitHub

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), or a standalone chart (use dataviz).

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write each slot down. An empty slot is the usual reason a figure shows state without showing the idea.

    line 13
  2. Distinctive:

    Expose the trace: Add a read-only inspect/trace interface to the system.

    line 34
  3. Distinctive:

    Build the explorer: when readers gain from choosing their own instance.

    line 53
  4. Very specific:

    Present the evidence: Run benchmark-checklist on every claim.

    line 56
  5. Distinctive:

    Audit and log: After each iteration, critique against a heuristic list and score it.

    line 60
  6. Distinctive:

    Every animation passes the motion test in step 3.

    line 70

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.

SlotFill withbbtree example
Reader baselineWhat they already know; teach only the deltaknows B-trees, not bbtree
Payoff2-3 concrete outcomes with numbers, shown first5x std BTreeMap, 30% less memory
Cost modelUnit price of each cost, levers ranked by itmiss ~100 ns, instruction ~0.5 ns, coherence >100 ns
InstanceThe single thing the reader followsone key's lookup
Cost unitWhat gets drawn so the reader can count it64-byte cache line, solid dot = read
Trace sourceRead-only inspect/trace API of the real systeminspect views, trace_many with a no-op watch
ViewsStructure / resource / state, linked by one hoverpath cards / memory map / slot table
InvariantsShown in place, next to what they constrainfences beside each node
ScenariosCurated happy, contended, failure/recovery cases"lookups worth seeing"
Time axisFor ordering or concurrency: lanes or time-runs-downbatch-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? The payoff with numbers and the charts.
    • How it works. The cost model, then the levers in ranked order. 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, and every number on screen traces to a data file.

  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. Done when a copied link reproduces the same picture.
  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.
  • 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)

TriedWhat went wrongFix
Whole structure drawn at scaleRead as color strips; said nothingFollow one instance
State shown without the ideaNo legend, views unlinked, no motionLegend, terms explained in place, shared hover, scenarios
Step-by-step guide panelTook half the space to repeat the inspectorDelete it; explain in place
Cost model simulated timingDrawn speedups disagreed with measurementsDraw order only
Marked where threads waitThe trace cannot know (non-blocking)Delete it
Per-op latency with fenced timersThe fences were half of what was measuredReport 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.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.