figure-view
Skill file engineering/figure-view/SKILL.md in alirezarezvani/claude-skills. Read the publisher’s upstream source.
Description could not be read from the source metadata.
Try your first task
A source-grounded starter task has not been verified for this skill yet.
SKILL.md
name: figure-viewdescription: "Use when an agent produces or hands over a diagram, chart, screenshot or other image file: render HTML, SVG, PNG, JPG, GIF or WebP figures to a PNG the agent can look at before claiming the figure is right, deliver figures as file:// links with browser zoom controls instead of inline previews that cannot be enlarged, and show them enlarged in the terminal with zoom, pan and fit. Standard-library scripts plus a local Chrome, Chromium or Edge; the viewer works in Kitty-graphics terminals (kitty, Ghostty, WezTerm, Konsole, herdr). Not for designing the figure itself."license: MITmetadata: version: 1.1.0 author: whatthetaff category: engineering updated: 2026-12-01Figure View
A figure is only finished when someone has looked at it. Agents write diagrams as HTML or SVG and never see them render; people get a thumbnail in chat they cannot enlarge. This skill closes both gaps with two standard-library scripts:
scripts/render_figure.pyturns any figure into a PNG, so the agent can open the picture and check it.scripts/view_figure.pyshows a figure enlarged in the terminal, with zoom, pan and fit.
Do not use it to design the figure (use a diagram skill), for remote files the browser cannot read, or as a general image editor.
Before starting
Check the machine instead of asking:
python3 scripts/render_figure.py --sample --json # the script runs; no browser needed for this
python3 scripts/render_figure.py fig.html --json # a clear error names the fix if no Chrome is found
HTML, SVG, JPG, GIF and WebP need a local Chrome, Chromium or Edge (found automatically, or set with
--browser / FIGURE_VIEW_BROWSER). A PNG within the 4-megapixel cap needs nothing.
Modes
- Look (default for agents): render the figure and inspect the PNG before saying it is done.
- Deliver: hand the figure to the person so they can enlarge it.
- View: show it enlarged in the person's terminal.
- Wire in: connect the viewer to a harness's link clicks or panes.
Workflow: look at your own figure
- Write the figure to a stable absolute path, for example
/tmp/billing-architecture.html. python3 scripts/render_figure.py /tmp/billing-architecture.html --jsonprints{png, width, height}. Renders are cached until the file changes.- Open the PNG with the harness's image reading and check it: labels clipped, arrows crossing nodes, text too small, the legend cut off. Fix the source and render again. Never describe a figure you have not looked at.
- Limit: for an HTML page, only its largest inline
<svg>is rendered, with the page's Google Fonts and paper colour. Other page<style>rules and:rootcustom properties are not carried over, so an SVG styled by page CSS renders unstyled. Inline the styles into the SVG before you check it.
Workflow: deliver a figure
- For HTML diagrams, paste assets/enlarge-controls.html into the page
(style block in
<head>, controls before the.diagram-container) and replaceSLUGwith the diagram's slug. The CSS-only Normal / Fit screen / 2x / 3x buttons work in any browser and add no script. - In the reply, put the figure's
file://URL on its own line. Most terminals open it on a modified click. - Offer the terminal view when the person works in a Kitty-graphics terminal (next workflow).
Workflow: view in the terminal
python3 scripts/view_figure.py /tmp/billing-architecture.html # in a terminal pane or split
The viewer checks for Kitty graphics first. Without them it prints the rendered PNG's path and exits 1,
so the person can open it in an image viewer. Run it in a split pane beside the session where the harness
allows, so the conversation stays visible.
To keep one viewer and switch figures, start it with --follow and hand figures to it:
python3 scripts/view_figure.py --follow # the long-running viewer pane
python3 scripts/view_figure.py --send /tmp/next-figure.png --json
# {"sent": true, "viewer_running": true, "viewer_command": [".../python3", ".../view_figure.py", "--follow"]}
When viewer_running is false, start viewer_command in a new pane. That pair is the whole integration
contract for a harness; see the README for a Herdr example.
Example
The diagram shows the four billing services and the two queues between them.
file:///tmp/billing-architecture.html
Open it to zoom in, or view it here: python3 scripts/view_figure.py /tmp/billing-architecture.html
Viewer controls
| Input | Action |
|---|---|
[ - ] [ + ], + -, wheel at the pointer | Zoom between fit (100%) and 800% |
[ Fit ], 0, double-click | Back to fit (double-click toggles fit and 200% at the pointer) |
Drag, arrows, h j k l | Pan; the figure always covers the frame |
[ Open in browser ], o | The original file in the default browser |
r | Render again |
[ Close ], q, Esc | Close the viewer |
Troubleshoot
| Symptom | Cause and fix |
|---|---|
No Chrome, Chromium or Edge found | Install one, or pass --browser / set FIGURE_VIEW_BROWSER to its executable |
| Viewer prints a PNG path and exits 1 | The terminal has no Kitty graphics; open the PNG, or use kitty, Ghostty, WezTerm or Konsole |
| Pane shows "could not draw the image" | The terminal refused the image size; set FIGURE_VIEW_MAX_PIXELS lower (default 4000000) |
| Web fonts missing in the PNG | The render had no network; the figure falls back to system fonts |
Rendering limits, the security model and terminal quirks: references/design.md.
Anti-patterns
- Claiming a figure looks right without rendering it. Look at the PNG first.
- Delivering only an inline image. Chat previews cannot be enlarged; always give the
file://URL. - Rendering untrusted pages with scripts on. Keep the script-blocking wrapper; never pass pages to a browser that runs their code.
- Starting a new viewer for every figure. Use
--followand--sendso one pane switches figures. - Editing the cached PNG. Fix the source; the cache follows it.
Proactive Triggers
- An agent writes a diagram, chart or screenshot to a file and is about to describe it.
- The person squints at, or asks to enlarge, an inline preview.
- A diagram skill produces HTML that will be viewed both in a browser and in the terminal.
- Several figures are delivered in one session (one
--followviewer, not one per figure). - A figure's labels or layout were changed and need a visual re-check.
Output Artifacts
| Artifact | Where |
|---|---|
| Rendered PNG | render_figure.py --json prints its path (cache in ~/.cache/figure-view/renders/) |
| Figure with browser zoom controls | the HTML path given in the reply |
file:// link on its own line | the reply |
| Enlarged terminal view | a pane running view_figure.py |
| Viewer state and log | ~/.cache/figure-view/ |
Related Skills
diagramming-processesand other diagram skills: use them to design the figure; use figure-view to check and deliver it. Not a replacement for either.chart-designer: use it for chart configs; render the chart's HTML here to check it.readme-polish: use it for figures inside a README on GitHub; figure-view covers local viewing only.demo-video: use it for motion; figure-view shows still images (an animated GIF shows its first frame).