Data Visualization Creator
Generate plots/charts/graphs from CSV or JSON via vl2svg (Vega-Lite), with
column-type detection and chart-type recommendation.
When to use
- User wants a chart/plot/graph from tabular data (file or pasted table).
- Do not use for architecture/sequence diagrams →
diagram. - Do not use for generative art, posters, or non-data images.
Prerequisites
python3and this skill'smain.py(path: skill directory next to this file).vl2svgon PATH:npm install -g vega-cli vega-lite.- Files ≥10MB also need
duckdbon PATH.
Procedure
Work phases in order. Do not skip. Do not invent column names — only use
fields from analyze output (or exact user overrides that exist in that output).
Phase 1 — Materialize data
- If data is already a file path the user gave, use it as
--data_path. - If the user pasted a table / inline JSON/CSV, write it to a file in the session scratch directory (temp). Do not write into the project working directory unless the user explicitly asks to save there.
- Completion: a real filesystem path exists and is readable.
Phase 2 — Analyze
Run (from skill dir or with absolute path to
main.py):python3 <skill-dir>/main.py analyze --data_path <path>Read the JSON stdout. On
"status": "error", reportreasonand STOP (or fix path/format and re-run once).Note
recommended_chart_type,recommended_x,recommended_y, columntype/cardinality/null_count. For large files note"engine": "duckdb"andsize_mb.Completion: you have recommended chart + axes (or a clear error reported).
Phase 3 — Choose encoding
- Default to recommended chart/x/y from analyze.
- If the user named a chart type or axes, prefer their choice only if
those fields appear in
columns. If not, re-check analyze and ask once. - Chart intents: bar = category vs measure; line = temporal vs measure; scatter = two numerics; pie = few categories (≤6) + measure.
- Completion: concrete
chart_type,x_axis,y_axis(y may be null only if analyze allowed it and user wants category counts — otherwise require y).
Phase 4 — Render
Pick
--output_pathin scratch (or user-requested path). Prefer.svg.python3 <skill-dir>/main.py render \ --data_path <path> \ --chart_type <bar|scatter|line|pie> \ --x_axis <field> \ --y_axis <field> \ --output_path <out.svg>On success JSON: keep
output_path. On error JSON: reportreason/stage; if invalid field, re-run Phase 2 — do not blind-retry.If
"aggregated": true, you must tell the user what was aggregated or sampled (aggregationfield). Never imply every row was plotted.Completion: SVG exists at
output_path, or structured error reported.
Phase 5 — Respond
- Report chart type, axes, and SVG path.
- Mention aggregation/sampling when present.
- PNG only if user asked: rasterize SVG separately (
rsvg-convertorvl2png); this skill does not emit PNG by default. - Completion: user has path + one-line interpretation of the chart.
Edge cases (summary)
- Empty file / no rows → analyze error; stop and say so.
- Missing
vl2svg/duckdb→ report install hint from error JSON; stop. - Unknown columns → list columns from analyze; do not guess.
- Wide tables: recommend using analyze picks; do not plot all columns at once.
- Details and decision table: load
references/chart-selection.mdonly if recommendation is ambiguous or user asks why a type was chosen.
Examples
Happy path
- User: "Make a bar chart of revenue by region from
sales.csv" - You: analyze → render bar with region/revenue → return SVG path.
Inline data
- User pastes a markdown table → write temp CSV → analyze → render → SVG.
Non-trigger
- User: "Draw the checkout service architecture" → do not use this skill
(use
diagram).