Use when (1) user provides a SQL query and asks to generate a chart, dashboard, or data visualization from the results. (2) user says "show this as a graph", "make a dashboard from this query", "visualize the results", or "plot this data". (3) user has a query result and wants a visual summary rather than raw rows.
This skill solves the specific problem of: SQL query results are rows and columns — a visual chart makes trends, comparisons, and anomalies immediately visible.
This skill IS NOT:
This skill IS activated ONLY when: SQL query or result set + visualization/dashboard intent are both present.
/sql-to-dashboard#Default mode. Takes a SQL query or result set and outputs a chart specification.
When to use: User provides SQL and wants to see the data as a chart.
/sql-to-dashboard/multi#Combines multiple queries into a single dashboard with multiple panels.
When to use: User has several related metrics they want on one screen.
SELECT columns → X-axis candidates (time, category) or Y-axis (numeric values)GROUP BY → X-axis or legend groupingsORDER BY with LIMIT → top-N pattern, suggest horizontal bar chartCOUNT, SUM, AVG aggregates → Y-axis valuesQuery PatternChart TypeReasonTime series (GROUP BY date)Line chartShows trend over timeTop-N with COUNT/SUMHorizontal barEasy to compare magnitudesPie/sum by categoryPie or donutShows proportionTwo numeric columnsScatter plotShows correlationMultiple aggregatesGrouped barCompares categories across groupsCumulative sumArea chartShows accumulationYes/No countDonut chartBinary proportion
Output a specification in a format appropriate to context:
Plotly JSON spec:
json
{
"data": [{
"x": ["Jan","Feb","Mar"],
"y": [120, 80, 150],
"type": "scatter",
"mode": "lines+markers",
"name": "Revenue"
}],
"layout": {
"title": "Monthly Revenue",
"xaxis": {"title": "Month"},
"yaxis": {"title": "Revenue ($)"}
}
}
Grafana panel JSON:
json
{
"title": "Monthly Revenue",
"targets": [{"expr": "sum(revenue)"}],
"fieldConfig": {"defaults": {"unit": "currencyUSD"}}
}
Mermaid (for simple data):
Rendering diagram...
A good output:
A bad output:
ScenarioBad OutputGood OutputSELECT date, COUNT(*) grouped by monthBar chartLine chart (time series = trend)SELECT status, COUNT(*) 3 statuses3D pie chartDonut chart with legendEmpty result setEmpty chart rendered"Query returned 0 rows — no chart to display"Very large result (10k rows)Renders all 10k pointsAggregates or samples — states "showing top 100"
references/ — Chart type decision tree, Plotly/Grafana/Redash spec templates, dashboard best practices