mcpbeat Sign in

Charting Vega Lite Skill for Claude

Create interactive data visualizations using Vega-Lite declarative JSON grammar. Supports 20+ chart types (bar, line, scatter, histogram, boxplot, grouped/stacked variations, etc.) via templates and programmatic builders. Use when users upload data for charting, request specific chart types, or mention visualizations. Produces portable JSON specs with inline data islands that work in Claude artifacts and can be adapted for production.

24k tokens
context cost
the whole folder, loaded on every use
19
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
137
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/oaustegard/claude-skills --skill charting-vega-lite

The instruction itself

18 sections, as written by the author

Overview

This skill creates interactive Vega-Lite visualizations from uploaded data. The workflow:

  • Analyze data structure and context
  • Select 5-10 meaningful chart types based on what the data represents
  • Build chart specifications programmatically
  • Generate React artifact with embedded visualizations

Critical Technical Constraint: Inline Data Island

Claude artifacts cannot use fetch() for computer:// URLs.

All data must be embedded as an inline JavaScript constant:

const DATA = [ /* embedded data array */ ];

// Later in chart specs:
spec.data = { values: DATA };

DO NOT:

  • Use fetch() to load external files
  • Reference external data URLs
  • Create separate data files

This is the only pattern that works in Claude's artifact environment.

Primary Workflow: Data Upload → Chart Explorer

Execute this sequence when user uploads data without specifying chart type:

1. Analyze Data Structure

python /mnt/skills/user/charting-vega-lite/scripts/analyze_data.py /mnt/user-data/uploads/<filename>

Extract from output:

  • fields[] (with types and statistics)
  • suggested_charts[] (suggested chart types with encodings)
  • sample_data (first 10 rows for understanding context)

If script fails: Use manual pandas analysis

import pandas as pd
df = pd.read_csv('/mnt/user-data/uploads/<filename>')
# Classify: numeric→quantitative, datetime→temporal, <20 unique→nominal

2. Understand Data Context

Read sample data and column names to infer what the data represents:

  • Biomedical data? → Biomarkers, patient outcomes, clinical relevance
  • Financial data? → Trends, comparisons, performance metrics
  • Sensor data? → Temporal patterns, anomalies, correlations
  • E-commerce? → Sales trends, product comparisons, conversions

Ask: What questions would someone analyzing this data want answered?

Examples:

  • Assay data: Which biomarkers strongest? Patterns across samples? Variability?
  • Financial: What are trends? How volatile? Seasonal patterns?
  • IoT: Temporal patterns? Anomalies? Sensor correlations?

3. Select Meaningful Charts (5-10 suggestions)

Filter analyze_data.py suggestions based on context and readability:

Apply readability filters:

  • Pie chart with >7 categories → Skip (unreadable)
  • Heatmap with >50 categories per axis → Aggregate first
  • Multi-line with >10 series → Consider faceting

Prioritize charts that answer domain questions:

  • Comparison needs → Bar, box plot, grouped bar
  • Distribution analysis → Histogram, box plot
  • Pattern recognition → Heatmap, scatter
  • Temporal trends → Line, area
  • Part-to-whole → Stacked bar (pie only if <7 categories)

Don't suggest charts just because data types match - choose charts that reveal insights.

4. Generate Chart Specs

Build specs programmatically using analyze_data.py encodings:

For each suggested chart type, construct spec using:

  • Templates from assets/templates/ for basic types (bar, line, scatter, pie, heatmap, area)
  • Builder patterns from references/spec-builder-patterns.md for variations (histogram, boxplot, grouped-bar, etc.)
  • Vega-Lite examples from references/vega-lite-examples-inventory.md for uncommon types

Structure each chart as:

{"type": "Chart Name", "reason": "Why this chart", "spec": {/* vega-lite spec */}}

5. Create Artifact with Inline Data Island

Load data, read template, replace __DATA__ and __CHART_SPECS__ placeholders, write using bash heredoc.

[View chart explorer](computer:///mnt/user-data/outputs/ChartExplorer.jsx)

Created 7 contextually relevant charts for your data.

Secondary Workflow: Specific Chart Request

When user specifies chart type (e.g., "make a bar chart"):

1. Analyze Data

python /mnt/skills/user/charting-vega-lite/scripts/analyze_data.py /mnt/user-data/uploads/<filename>

2. Validate Chart Fits Data

Check requirements:

  • Bar: needs 1 nominal + 1 quantitative
  • Line: needs 1 temporal + 1 quantitative
  • Scatter: needs 2 quantitative
  • Heatmap: needs 2 nominal + 1 quantitative
  • Pie: needs 1 nominal + 1 quantitative + <7 categories

If data doesn't fit:

  • Explain: "Bar chart needs categorical data, but all columns are numeric"
  • Suggest 2-3 alternatives
  • Use Primary Workflow to create explorer with alternatives

3. Generate Spec

Use templates or programmatic builders based on chart type complexity.

4. Create Artifact

Same pattern as Primary Workflow step 5, but with single chart.

Error Prevention

Common failures:

  • Using fetch() in artifacts
  • Solution: Always use inline data island pattern
  • Never create external data files
  • Chart doesn't render
  • Verify scripts load: Vega → Vega-Lite → Vega-Embed
  • Check data is injected: spec.data = {values: DATA}
  • Confirm field names match data columns
  • Generic/random chart suggestions
  • Solution: Consider data context and meaning
  • Filter suggestions for relevance and readability
  • Prioritize charts that answer meaningful questions

Resources

Scripts:

  • scripts/analyze_data.py - analyze structure, suggest 8-12 chart types

Components:

  • assets/components/ChartExplorer.jsx - multi-chart explorer template

Templates:

  • assets/templates/*.json - 6 basic chart templates (bar, line, scatter, pie, heatmap, area)

References - Progressive Disclosure:

Read spec-builder-patterns.md when building charts programmatically (histogram, boxplot, grouped/stacked bars, multi-line, etc.)

Read vega-lite-examples-inventory.md when user requests uncommon chart type not in spec-builder-patterns

Read chart-types.md when validating specific chart requirements or user asks "what chart should I use for..."

Read advanced-charts.md for complete specs of specialized charts (sankey, waterfall, violin plots, complex layered compositions)

Read contextual-chart-selection.md for extended domain examples if unfamiliar with data domain (biomedical, financial, IoT, etc.)

Read online-resources.md to fetch Vega-Lite docs for advanced features (custom selections, transforms, conditional encoding)

Complete Workflow Example

User uploads assay data CSV (51 assays, 74 samples)

# 1. Analyze
python /mnt/skills/user/charting-vega-lite/scripts/analyze_data.py /mnt/user-data/uploads/assay_data.csv

# 2. Understand context: Multi-analyte immunoassay
#    Questions: Which biomarkers strongest? Patterns across samples? Variability?

# 3. Build contextual charts (5-7 specs)
#    Bar: Mean signal by assay
#    Heatmap: Sample × Assay
#    Box plot: Signal distribution by assay
#    Histogram: Overall signal distribution
#    etc.

# 4. Load data and template
df = pd.read_csv('/mnt/user-data/uploads/assay_data.csv')
data = df.to_dict(orient='records')
template = open('/mnt/skills/user/charting-vega-lite/assets/components/ChartExplorer.jsx').read()

# 5. Replace placeholders and write
artifact = template.replace('__DATA__', json.dumps(data)).replace('__CHART_SPECS__', json.dumps(charts))
# Use bash heredoc to avoid XML conflicts in tool parameters

# 6. Provide link

View chart explorer

Created 7 charts for your assay data - bar charts show biomarker signals, heatmap reveals sample patterns, box plots display variability.

Critical Rules

  • ALWAYS use inline data island pattern - No fetch(), no external files
  • Consider data context - Choose meaningful charts based on what data represents, not just data types
  • Filter by readability - Avoid charts with too many categories
  • Use bash heredoc for file creation - Prevents XML conflicts when creating artifacts
  • Provide links, not content - Output token efficiency

Other skills for the same job

different authors, same section of the catalogue
XLSX
by anthropics
vendor ×15

Comprehensive spreadsheet creation, editing, and analysis with support for formulas, formatting, data analysis, and visualization. When Claude needs to work with spreadsheets (.xlsx, .xlsm, .csv, .tsv, etc) for: (1) Creating new spreadsheets with formulas and formatting, (2) Reading or analyzing data, (3) Modify existing spreadsheets while preserving formulas, (4) Data analysis and visualization in spreadsheets, or (5) Recalculating formulas

5k tokens scripts
XLSX
by w95
×7

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \"the xlsx in my downloads\") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

3k tokens
Raffle Winner Picker
by frostant
×5

Picks random winners from lists, spreadsheets, or Google Sheets for giveaways, raffles, and contests. Ensures fair, unbiased selection with transparency.

949 tokens
Fda Database
by christophacham
×4

Query openFDA API for drugs, devices, adverse events, recalls, regulatory submissions (510k, PMA), substance identification (UNII), for FDA regulatory data analysis and safety research.

32k tokens scripts
Matlab
by christophacham
×4

MATLAB and GNU Octave numerical computing for matrix operations, data analysis, visualization, and scientific computing. Use when writing MATLAB/Octave scripts for linear algebra, signal processing, image processing, differential equations, optimization, statistics, or creating scientific visualizations. Also use when the user needs help with MATLAB syntax, functions, or wants to convert between MATLAB and Python code. Scripts can be executed with MATLAB or the open-source GNU Octave interpreter.

25k tokens
Umap Learn
by ComeOnOliver
×4

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

14k tokens
D3 Viz
by chrisvoncsefalvay
×3

Creating interactive data visualisations using d3.js. This skill should be used when creating custom charts, graphs, network diagrams, geographic visualisations, or any complex SVG-based data visualisation that requires fine-grained control over visual elements, transitions, or interactions. Use this for bespoke visualisations beyond standard charting libraries, whether in React, Vue, Svelte, vanilla JavaScript, or any other environment.

20k tokens
Alphafold Database
by christophacham
×3

Access AlphaFold 200M+ AI-predicted protein structures. Retrieve structures by UniProt ID, download PDB/mmCIF files, analyze confidence metrics (pLDDT, PAE), for drug discovery and structural biology.

7k tokens

How to use it

Copy the folder

Take oaustegard/charting-vega-lite from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.