Anatomy

From huytran1120/vie-agentic-skills · View interactive version

Anatomy is an AI agent skill from the GitHub repository huytran1120/vie-agentic-skills. Build crafted, highly detailed, interactive isometric SVG figures that explain a technical idea as a real physical object (a test rig, a dial gauge, a cabinet of drawers, a plotter, a lock), with many small precise solid parts, four-tone shading, correct painter's order, a framed card with title, hi

How to use this skill

Skill file

Anatomy

This skill makes figures like a small instrument on a bench: a heavy base on feet, rails with tick rulers, a carriage on bushings, knurled knobs, coil springs, a dial gauge whose needle moves, screws as tiny dots. The reader understands the idea because they recognise the machine. Every number the figure shows comes from the same model that moves its parts.

Eight complete examples ship with the skill. Open the closest one before you start. Each framework-free example is built with node examples/<name>/build.mjs, which writes a standalone HTML page next to the script; add --light for the light theme.

The test rig is the quality bar for the drawing itself. The Raptor is the bar for shader work: a WebGL effect has to reach its standard of world-space, no-pop, seamless rendering.

The one idea that matters

The object is the explanation. Don't draw boxes, arrows and labels. Invent a real, well-made physical thing whose working is the concept. Here is how earlier figures mapped:

| Concept | Object |

|---|---|

| One shared GPU context serving many canvases | A gantry plotter: one print head visiting 16 wells |

| A cache key that skips work when nothing changed | A pin-tumbler lock: when every pin matches, the plug turns and nothing is redrawn |

| Seven render targets with different bytes per texel | A chest of seven drawers, each as deep as its bytes |

| A separable blur (49 × 49 taps vs 49 + 49) | A bed-of-nails stamp beside two combs on rails |

| A spring that presses and leans | A test rig with springs, a probe and a dial gauge |

| A height profile | A profile (contour) gauge pressed against the edge |

| Light that depends on facing | A small photo studio: key and fill lamps around a turntable |

Two ways this fails, both seen in practice:

The fix for both is the same: a recognisable machine, built from many small, precise, purposeful parts.

Every creation is highly detailed. This holds for every figure, however small the idea or the request: a quick explainer is still a dense, real machine, never a few slabs. What scales with the size (workflow step 1) is how far you push it: a Figure gets the 4× sweep over its subject and mechanism, a Hero or an Epic over the whole drawing.

Workflow

Work in this order. Write the concept and the parts list before any geometry. Most of the quality is decided there.

  1. Size it before you start. Name the size before any other work, and tell the user roughly how long it will take when the tier below calls for an estimate.
  1. Truth first. Collect the real numbers and behaviour of the thing being explained: sizes, counts, thresholds, curves. The readout, motion and caption must all be true. If you can, write the model as a small pure module, like rig.ts in the test-rig example, and drive everything from it.
  2. Invent the object. Pick a machine, tool, instrument or piece of furniture whose mechanism maps one-to-one onto the concept. Say in one sentence what moves and what that motion means. Never copy a reference image: take its finish, not its object.
  3. Parts list. Write at least 40 parts (40–80 for a Figure, 80–150 for a Hero, more for an Epic), grouped: base (plate, feet, groove, corner screws, label plate, ruler strip), structure (posts, rails, frame bars, end stops), mechanism (carriage, bushings, springs, plunger, needle), controls (knurled knob, thumb screw, crown) and the subject itself, which is the one lit part. Each part sits on another part. references/craft.md has a vocabulary of parts with recipes.
  4. Plan the world. Use world units of about 1 px of the real thing: x and y on the floor, z up. Lay out plans as rounded rectangles {x, y, w, d, r} and circles. Choose the camera: azimuth 45° by default, 35–60° to show the long side, elevation 30° (higher, like the ripple tank's 44°, to look into something open). Then fit with fitProjection(points, width, height, { pad, azimuth }).
  5. Build geometry once. Precompute every static path in a geometry module with the kit: slabOf, cylinder, extrude, planOutline, topTicks, knurl, coil, radialTicks and so on. Round parts on any axis (bells, flanges, valves, actuators) come from kit/lathe.mjs, and pipes and cables from kit/tube.mjs. Moving parts are built once at a rest position and moved with translateAlong. Only parts whose shape changes are rebuilt per frame.
  6. Paint back to front, bottom to top. Sort repeated parts with depthOf. Split anything that wraps another part into a back half and a front half: the springs around a rod, the bars of a frame around a carriage. A moving part is drawn in the slot where it physically sits. See "Painter's order" in references/craft.md. Once a figure has pipes, cables and round parts, stop tuning keys by eye: record each item's shape as you put it into A.recorder(P, { order, spring }), let A.settle(R, P) measure true depth wherever two items overlap and set the keys, and end the build with A.auditOrExit(R, P). Route pipes before you draw them: real ports at both ends, legs along the structure, crossings on straights, collars gapping the pipe (references/craft.md, section 8). Record the true shape of what you draw: a stand-in shape that silences the audit is a bug, and the audit fails one. A rod that slides out of a gland is one rod from G.rodOut, recorded with A.slide.
  7. Frame it. Put the figure in a card: Fig n at top left, a short title at top right, the interaction hint at bottom left and the live readout at bottom right. Legend keys and a true caption go under the card, and words stay out of the drawing apart from at most one tiny engraved label.
  8. Make it live. Use calm time-based motion: exponential follow or real springs. An idle tour loops when nobody touches it. The figure responds to pointer and keyboard, stops when offscreen, and goes still under reduced motion. Write attributes on refs and don't re-render per frame. See references/motion.md.
  9. Verify like a critic. The owner finds faults by zooming in, so you zoom in first. Read every PNG you make.

Setup

The kit is in kit/:

| File | Use it for |

|---|---|

| kit/iso-kit.ts | The whole core in one file: camera, solids, a parts library, an SVG string renderer, card and page builders, and the CSS (ISO_CSS). Copy it into a TypeScript project. |

| kit/iso-kit.mjs | The same core compiled to plain ESM, for Node scripts. Import it directly. |

| kit/iso.css | ISO_CSS written out. Import it once and put class="iso" (plus data-theme="light" for light) on a wrapper or <body>. |

| kit/react/draw.tsx | Server-safe React components: Solid, Line, Wire, Dots, FaceText, IsoFigure, Plate. |

| kit/react/live.tsx | "use client" hooks: useReadout, useLoop, useEased, useInView, useStillness, plus spring and follow. |

| kit/lathe.mjs | Round parts along any axis: frameAlong, lathe (smooth shading switches on by itself for any profile with a smooth knot), solidOf, disc, ringBand, sphereOf, saddleOf, bandsOf (one curved body cut into depth-sortable bands that share one surface, with one outline from sidesOf), visible arcs, ribs and bolt circles on round surfaces (ribsOf and dotsOf take fade, ribsOf takes seams), rodOut for a rod that slides out of a gland, and fillet for pipe routes. |

| kit/tube.mjs | tubePieces splits a 3D pipe or cable into depth-sortable chunks (with breaks, gaps under collars and clamps, elliptical end caps, and rings for a braid, corrugation or wrap that follows the cross-section through every joint), and tubeSvg draws one; crossingsOf finds where a route passes through a clamp, runsOf the drawn runs. Its .tb-* fills are in ISO_CSS. |

| kit/audit.mjs | Proves the geometry. recorder(P, { order, spring }) collects items, shapes (turned bodies, slabs, prisms, boxes, balls, tubes, pads cut by their host) and routes as the helpers draw them; settle(R, P) ray-casts every overlapping pair for true depth, at rest, apart and in the replayed explode, and sets the painter's keys (overlapsOf, orderKeys); auditOrExit(R, P) is the --audit hook that runs every check (clearances, solidClearances, terminals, looseEnds, supports, folds, selfOverlaps, crowding with slender solids as lines, coverage for stand-in shapes, wobble, seats, depthOrder) and exits non-zero on any problem. A.slide records a rod that slides out of a gland. references/kit.md, section 12. |

| kit/gl.mjs | The WebGL layer for shaders inside the drawing: GLSL_ISO (the camera in GLSL, including rayOf and pixelOf), glCamera(P), glLayer(...), and the JS envelopes smooth, burst and settle. For 3D figures, GLSL_TURN and glslPose(name) bring world points into a moving group and mask a front canvas with coverOf. |

| kit/turn.mjs, kit/turn-build.mjs, kit/turn-audit.mjs | The optional 3D mode. turn-build.mjs has turning(P, { recorder }): groups (turn, slide, hinge, free), live layers, convex parts with materials, and T.build. turn.mjs is the runtime: TURN.mount, the controller, TURN.cover, TURN.poseUniforms and TURN_CSS. turn-audit.mjs has orbitOrExit, the orbit audit over every turn angle and motion clip. references/3d.md. |

| scripts/capture.mjs | Headless Chrome screenshots, close-ups and console checks, with WebGL on. Run with node. |

| scripts/drive.mjs | Scripted headless Chrome with WebGL: move, click, key, slow motion, wait-until, eval, shots and contact sheets that catch pops; --no-webgl and --preload. |

| scripts/lines.mjs | The line-end check on a built page, in headless Chrome: every texture line must end on a stroke, a dot or an outline. Rings the failures with --out; exits 1 on any. |

| scripts/inline-kit.mjs | kitScript(), glScript() and turnScript() return the kit, the WebGL layer and the 3D runtime as source to inline into a standalone page. |

| scripts/turn-check.mjs, scripts/turn-bench.mjs | 3D figures: fidelity against the kit builders, a z-buffer order check, pixel pops, line ends at 24 angles and frame timing in the browser; Node CPU time per part kind. |

| scripts/print.mjs, scripts/print-sheet.mjs | Printable sheets: freeze poses of a built page as vector stills and lay them out as an A4 or Letter PDF in three formats (poster, drawing, detailed). references/print.md. |

Pick the path that fits the project:

Craft rules (short form)

These are the rules that separate a crafted figure from a diagram. references/craft.md gives the full reasoning and recipes.

WebGL inside the drawing

Use a shader only for what lines can't draw: fire and exhaust, water and caustics, real lamp light, glow, steam. The parts stay SVG. The core rules come from the first shader figure, whose colour change between phases looked cut rather than crossfaded:

Read references/webgl.md before writing any shader.

3D: figures that turn (beta)

3D is an option like WebGL. Use it when a part moving in depth is the idea: a dial or turntable that turns, fingers that flex, a piece that breaks off and falls. The rest of the figure stays static kit art.

It is in beta: the engine is proved on its example and one test figure, not yet on a production figure. Turn one subject at a time and keep the clutter around it static. A small figure runs at 60 fps; a dense 380-part flexing hand measured about 20 fps at 1440 and 13–15 fps on a phone profile (390 px, 4× CPU throttle) on a heavily loaded machine.

Read references/3d.md first.

Printable sheets (A4)

When the user wants the figure on paper (a handout, a poster, a PDF, an A4 or Letter sheet), print it from the finished figure instead of drawing again. Write a sheet.mjs next to the build: the poses to capture as drive.mjs actions, the parts as CSS selectors over the live SVG, and the words, every one of them true to the model. Then run node scripts/print.mjs sheet.mjs --format all --png and read every page.

Offer all three when the user hasn't picked one. When the page shows a figure that has a PDF, put a link to it on the card with pdfButton(href) from kit/pdf-button.mjs inside the plate body (see examples/push-button/build.mjs); print first, then rebuild the page. examples/raptor-engine/sheet.mjs and examples/arcade-cabinet/sheet.mjs are the references. Read references/print.md first.

References

Read these as you need them:

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.