hand-svg-structure-figure
Skill13 starsChanged 33 days agoMITView on GitHub
Replicate a bitmap/screenshot structure diagram (block diagram, flowchart, network, schematic) as a hand-authored static SVG — programmatic geometry/color probing, live-page export, full pitfall list.
In this repository8 other files it gives its agents.
- codex-figure-workflowSkill
- data-figures-rerenderSkill
- declarative-engine-figuresSkill
- game-arch-diagramSkill
- paper-figureSkill
- parametric-diagram-scriptSkill
- style-presetsSkill
- visual-acceptance-loopSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 15
Copy text verbatim: Every string checked against the reference.
≈ “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.
Files
Hand-authored SVG structure-figure replication
When to use
The reference is a bitmap (paper screenshot, scan, slide export) showing a structure figure — block diagram / flowchart / network / schematic — and you need an editable, print-quality vector replica. Do not use this route for data plots (see data-figures-rerender).
Workflow (five steps)
- Probe, don't eyeball. Use
probe_geometry.py(this folder) to extract exact pixel values from the reference bitmap: box bounds via fill-color connected components, circle centers/diameters via ring scans, text-row baselines, connector endpoints, dash/fill/border colors. Build the first draft in the reference's coordinate system — it lands ~80% right with zero guessing. - Copy text verbatim. Every string checked against the reference. Sub/superscripts via
tspan dy(math letters in italic serif; upright digit subscripts need explicitfont-style="normal"— tspans inherit italics). - Hand-write the SVG. Styles centralized in a
<style>block + semantic color constants (see repo-rootMETHOD.md); structural comments per region; default ink color inherited from a wrapping<g fill="...">. - Export PNG.
prepare_export_pages.pybuilds inline-HTML pages → set the browser viewport to the exact content size → plain screenshot (never fullPage — it triggers the tiling bug); for content taller than ~2160 px, capture top/bottom halves and stitch with PIL. - Acceptance. Live-page screenshot + an independent vision-model judge comparing replica vs reference (criteria: every string, arrow source→target topology, no overflow/overlap; intentional style upgrades are not defects). On FAIL, fix root causes using the judge's pixel evidence.
Hard-won pitfalls (all real)
- SVG
<style>overrides presentation attributes:text{fill:…}beatsfill=""on elements → colored titles render near-black. Keepfillout of CSS; inherit defaults from a wrapping<g fill>and set colors per-element. - Never export via
<img src="*.svg">: renders wrong (italic leakage, cascade anomalies); standalone SVG documents screenshot as scaled tiles. Inline HTML is the only reliable channel. - Signature style of fully-connected network figures: incoming edges converge on the target circle's left pole, arrowheads stacked in a cluster — radial rim distribution reads as "wrong".
- Judge "likeness" at the structural-semantic level: the reference is a semantic target, not a pixel template.
Examples (examples/)
fig-prefix-classifier— two-section pipeline figure (blue/orange dashed groups, feedback loop), replicated from a bitmap in the reference coordinate system (ecg_reference.pngis the source bitmap).fig1-1_roadmap— four-stage research roadmap redrawn from a matplotlib source script (coordinates mapped 1:1).
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
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.

