chart-specification-structural-representations
Installation
SKILL.md
Chart Specification: Structural Representations for Chart-to-Code Generation
This skill enables Claude to generate structurally faithful plotting code from chart images or descriptions by first constructing a Chart Specification -- a structured JSON intermediate representation that decomposes a chart into its semantic topology and numerical primitives. Instead of attempting to produce code directly (which leads to hallucinated values and wrong chart types), Claude first reasons about the chart's structure declaratively, then generates code grounded in that verified specification. This approach, from He et al. (2026), achieves up to 61.7% improvement over direct generation on complex chart benchmarks.
When To Use
- When the user provides a chart image and asks Claude to generate matplotlib, plotly, or seaborn code that reproduces it
- When the user describes a complex chart verbally and needs structurally correct plotting code
- When generated chart code has the wrong structure (e.g., bar chart instead of grouped bar, missing subplots, wrong axis ranges)
- When the user needs to reverse-engineer the data and layout from an existing visualization
- When reproducing multi-panel or composite charts where layout fidelity matters
- When the user asks to convert between plotting libraries while preserving chart semantics