SkillAgentSearch skills...

ts-figure-svg

PaperBanana+ — turn a paper's figure brief into a native, editable, publication-grade SVG. Stage 1 runs the OFFICIAL PaperBanana (dwzhu-pku/PaperBanana, pulled by `setup_paperbanana.py`, its own Retriever→Planner→Stylist→Visualizer→Critic pipeline) to produce candidate PNGs.

Install / Use

npx skills add Spark-To-Paper-Skills/spark-to-paper-skills --skill ts-figure-svg

Installs into whichever agent you are using.

About this skill
📄

SKILL.md

Installable skill definition

Quality Score

93/100

Category

Automation

Supported Platforms

Claude Code

Our assessment of ts-figure-svg

ts-figure-svg scores 93/100 on our quality scale, 696th of 2,780 Automation skills we index (top 26%).

Its SKILL.md is 17 KB long, well organised into 14 sections with 6 code examples: a thorough specification that gives an agent plenty to work with.

With 1,126 GitHub stars, it is one of the more widely adopted skills in the catalogue.

Substance
30/30
Structure
20/20
Description
15/15
Adoption
13/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated about 3 months ago, so ts-figure-svg is actively maintained.
  • Our last check on 2026-10-26 found the source still online.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 100/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.

Safety scan

No issues found

Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful.

AI review by kimi-k2.7-code on 2026-10-08. Automated pattern scan on 2026-10-08. It catches known dangerous patterns, not every risk — read a skill before letting an agent act on it.

ts-figure-svg compared with similar skills

All 4 of these similar skills score higher than ts-figure-svg; compare them before choosing.

SkillScoreStarsUpdatedFormat
ts-figure-svg (this skill)by Spark-To-Paper-Skills931.1k3mo agoSKILL.md
taste-skillby Leonxlnx100116.8k8d agoCLAUDE.md
Agent-Reachby Panniantong100112.3k8d agoCLAUDE.md
rufloby ruvnet10081.9ktodayCLAUDE.md
Claude-Code-Game-Studiosby Donchitos10039.7k7d agoCLAUDE.md

Frequently asked questions

How do I install ts-figure-svg?
Run npx skills add Spark-To-Paper-Skills/spark-to-paper-skills --skill ts-figure-svg. The install tabs above show the steps for each supported agent.
Which AI agents does ts-figure-svg work with?
It is written for Claude Code, as a SKILL.md file. Other agents that read the same format can often use it too.
Is ts-figure-svg safe to use?
Our scan of the whole file found no instruction hijacking, hidden characters, credential access, data exfiltration or destructive commands. An AI review of the same text found nothing harmful. It is MIT-licensed and scores 100/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is ts-figure-svg still maintained?
The repository was last updated about 3 months ago, so ts-figure-svg is actively maintained.

name: ts-figure-svg description: > PaperBanana+ — turn a paper's figure brief into a native, editable, publication-grade SVG. Stage 1 runs the OFFICIAL PaperBanana (dwzhu-pku/PaperBanana, pulled by setup_paperbanana.py, its own Retriever→Planner→Stylist→Visualizer→Critic pipeline) to produce candidate PNGs. Stage 2 is the "+": Claude LOOKS at the chosen PNG, extracts its DESIGN LANGUAGE (palette, type scale, spacing, idiom) into a style sheet, then redraws the figure FROM THE PAPER'S FACTS as real <rect>/<path>/<text> objects — never tracing pixels, never embedding the PNG. Stage 3 is a measured repair loop: audit_svg.py (stdlib, no renderer needed) catches overflow, text-on-text, icons cutting labels, stroke-scaled and canvas-clipped arrowheads, dangling connectors, sub-legible type, font-fallback glyphs, CSS-cascade colour traps and traced path-soup; ≥4 rounds, no upper bound while defects remain. Ends on a vector PDF verified on the real compiled page. Use when a figure must be editable and correct, not merely pretty.

ts-figure-svg — PaperBanana+ : design language in, native SVG out

An image model draws a picture of a figure. This skill turns that picture into an actual figure: every label live text, every edge traceable to the method, every box measured.

Two things it is not, both learned the hard way:

  • Not a pixel replica. Auto-tracing one figure produced 59,430 paths, 10 MB, no editable text — and it was still blurry when zoomed. "No <image> element" does not mean "vector".
  • Not the PNG's logic. Generated figures invent sequential links, fabricate numbers, and garble labels. Take the PNG's look; take the paper's content.

Setup (once)

python3 scripts/setup_paperbanana.py            # clone official PaperBanana into engine/ + deps
export OPENROUTER_API_KEY="sk-or-v1-..."        # one key covers VLM agents + image generation
python3 scripts/setup_paperbanana.py --check-only

engine/PaperBanana/ is gitignored — upstream's code, pulled, not vendored. If no key is configured, stop and ask the user; do not substitute a different image backend silently.

Probe the local toolchain with ; between checks, not && — chaining dies at the first missing tool and tells you nothing about the rest: command -v inkscape; command -v rsvg-convert; command -v pdftoppm; command -v pdffonts; fc-match 'Times New Roman'. There is no python, only python3; xmllint/jq/zip may all be absent (use python3 -c, stdlib json, and 7z a -tzip).

Stage 0 — lock the figure brief before drawing anything

Per figure, not per paper. Scan the TeX for real placeholders, captions, labels and body references: one paper often has 2–3 missing figures, and a "one overview figure each" guess is how the denominator ends up wrong. The compile entry file is found, not assumed — rg -l '^\\documentclass' -g '*.tex'; in an 11-paper batch two built from acl_latex.tex and nine from main.tex.

Write <work>/<label>.brief.md with these sections, in this order — this is the shape that worked:

## Reader question and role      one line: what the reader learns from this figure
## Caption intent                the existing caption, verbatim
## Scientific facts to preserve  every module/edge/symbol/constraint, quoted from the method text,
                                 marking which edges are parallel vs sequential and what is shared
## Must not appear               results numbers in a method figure; causal claims the paper does not
                                 make; anything true only under an assumption the figure cannot show
## Visual design                 hard numbers: canvas ~1520x640, at most five semantic modules,
                                 minimum 20px body / 25px section titles at this canvas size

The input is the paper's existing Method/Design text plus its existing caption — not the whole paper (that yields a whole-paper summary figure) and not a hand-written slogan (that yields generic boxes).

Build the paper's baseline PDF now (without -shell-escape; the svg package is not loaded yet) and record its page count and pre-existing warnings, so a later overfull box is attributable to a source line rather than to your figure. Quarantine stale aux files with mv, never rm.

Stage 1 — PaperBanana (official) → candidate PNGs

python3 engine/PaperBanana/skill/run.py \
  --content-file "<work>/<label>.brief.md" \
  --caption "<the figure's caption intent>" \
  --task diagram --aspect-ratio 3:2 \
  --num-candidates 3 --max-critic-rounds 3 \
  --retrieval-setting random --exp-mode demo_full \
  --output "<work>/paperbanana/<label>.png"
  • --retrieval-setting random, never none. PaperBanana is reference-driven; with none it skips the reference dataset entirely, the Planner gets zero exemplars, and the Stylist paints a generic conference look over it. That single flag is why an entire early batch came out as identical pale box-and-arrow pipelines. auto is unusable with a normal context window — it feeds the Retriever the full method text of 200 reference papers in one call.
  • Filenames: --num-candidates 1 writes --output verbatim; N>1 writes <stem>_0.png, _1.png, …
  • --num-candidates N also sets the concurrency — N simultaneous image requests. Three candidates × 2–3 critic rounds is a ~40 minute serial job per figure; a batch is not an interactive turn.
  • On repeated 504/timeout: retry the same paper with identical parameters, at most 3 consecutive times, then mark it blocked and move on. Do not raise concurrency, swap models, swap keys, cut the candidate count, or pass a failed run off as a success.
  • demo_full inserts a Stylist that can over-simplify; demo_planner_critic is the same chain without it and keeps more method detail. When a figure comes back thin, run one of each and compare.

A finished run is not a passed run. The known silent failure: when the Critic's text call exhausts its 5 retries the runner prints Error: All 5 attempts failed to validate the input. and then, on the very next line, [Critic Round 1] No changes needed. Stopping iteration. — a total API failure logged as convergence, exit 0, PNG written. Grep the run log for All 5 attempts failed next to No changes needed; if you see it, the critic chain did not run and the candidate is incomplete, not selected.

Choose in two stages, never one. First identify -format '%f\t%wx%h\t%b\n' + sha256sum all candidates, then a thumbnail contact sheet for triage (montage <cands> -thumbnail 768x512 -tile 1x3 -geometry +0+18 sheet.png); only then read the finalists at full size. Priority is strict: (1) relations, directions, formulas and numbers all correct → (2) reader grasps input→process→output in seconds → (3) legible at the real column width → (4) geometric tidiness → (5) beauty. Real rejections to reuse as a checklist: a candidate that was better laid out but labelled the third sealed card E2 instead of E3 (correctness beats layout, outright); fabricated example scores and invented timestamps; seven framed states that dissolve at column width.

Record the decision in <work>/<label>.design_selection.md: chosen filename + SHA-256 (the reference is now immutable), Retained design language, and Scientific and visual corrections required — the list of things you are deliberately not copying. Copy the winner to <work>/<label>.target.png.

--aspect-ratio is a request, not a guarantee — some backends hardcode their own size. Record the requested ratio and the identify measurement.

Then stop and show the user the contact sheet. Candidate acceptance is a human gate; do not roll straight into SVG work.

Stage 2 — learn the design language, then redraw from the paper

2a. Extract the style sheet. Read the target PNG and write <work>/<label>.style.json: background and card fills, accent/semantic colours (what each hue means), stroke weights, corner radius, type scale, spacing rhythm and column grid, icon idiom, arrow style, and the layout skeleton. This file — not the pixels — is what carries over.

2b. Draw round_01.svg from the brief, styled by the sheet. Read references/svg-craft.md first; it is the defect catalogue this loop exists to prevent. Non-negotiables:

  • real <rect>/<path>/<line>/<circle>/<text>/<tspan>/<marker>/<g>, semantic ids, no <image>, no data URI, no external reference, no traced pixel paths;
  • font-family="Times New Roman, Nimbus Roman, serif", sizes as classes (a per-element fill/ font-size attribute loses to any stylesheet rule — that is the white-text-on-colour trap);
  • fixed small arrowheads: markerUnits="userSpaceOnUse", 6.4×4.8, refX="6.1" refY="2.4";
  • connectors drawn before nodes, nodes before text; endpoints docking on card edges;
  • canvas sized by target column (see svg-craft), not by taste.

Stage 3 — the measured repair loop (≥4 rounds, no upper bound)

One block per round, in this order — snapshot first so you can diff round N against N-1, and || true the audit so a failure still leaves you the picture that explains it:

cp <work>/current.svg <work>/round_0N.svg                      # 1. snapshot BEFORE any check
python3 scripts/audit_svg.py <work>/round_0N.svg \
        --json <work>/round_0N.audit.json || true              # 2. structure + geometry
python3 ../ts-figure-optimize/scripts/render_svg.py \
        <work>/round_0N.svg <work>/round_0N.png --width 1440   # 3. wide: geometry + typography
python3 ../ts-figure-optimize/scripts/render_svg.py \
        <work>/round_0N.svg <work>/round_0N_col.png --width 480 # 4. real column width: legibility

Two widths, two different jobs — a figure that reads fine at 1440 can be unreadable at 480. Then look at both yourself, zoom every flagged hit at 4×, and re-read the figure against the method text. Append one line per round to figures/repair_logs/<label>.log: what the audit found and what you changed — the observed diff, not the intended edit.

audit_svg.py fails the round on: forbidden element, data URI, external reference, duplicate id, unresolved url(#…), no live text, path_soup (traced rather than drawn), font stack not starting with Times, size under the floor, markerUnits="strokeWidth" or an oversized head, canvas overflow including a clipped arrowhead, text–text overlap, a label whose clearance is under max(4px, 0.35 × font-size), a shape painted over text, a glyph that will trigger a silent font fallback, and a fill/font-size presentation attribute that the stylesheet beats. It warns on floating text and connectors docking on nothing. Text boxes come from Adobe core-14 Times metrics, so no renderer is required and the numbers are exact for the mandated stack.

Round 4 has a job of its own: the column-width + vector gate. Export the PDF and confirm pdfimages -list returns zero image rows and pdffonts shows every font emb=yes sub=yes uni=yes.

Stopping rule: four rounds is the floor, not the target. A round that still finds problems means there is a next round — one figure went to six because round 4 was "close to final" but had one badge overhanging and one card touching its edge. Neither "the audit passes" nor "nothing looks wrong at 1440px" ends it: at round 4 of one batch all three SVGs returned passed: true and actual-size review still found a 5px label overlap.

When it is genuinely clean, copy the last round to figures/<label>.svg and:

python3 scripts/svg_to_pdf.py figures/<label>.svg figures/<label>.pdf

The backend ladder is rsvg-convert → headless browser → Inkscape → cairosvg, and the result is rejected unless it embeds fonts. Inkscape's SVG→PDF outlined every glyph even with --export-text-to-path=false: pdffonts came back empty and it scored RMSE 0.1

Truncated for display — read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars1.1k
CategoryAutomation
Updated2mo ago
Forks19

Languages

Python

Trust signals

100/100

From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.

No cautions