/open-dashboard:dashboard-authoringfrom open-dashboard
Technical reference for writing open-dashboard dashboards: file contract, named-query SQL format, parameters, filters, panel components, layout, and chart-choice rules. Use when editing files under dashboards/<id>/.
Ships in open-dashboard. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A dashboard is a folder:
dashboards/<id>/
index.tsx the layout: which panels, in what order, showing which columns
queries.sql named SQL queries the panels refer to (any *.sql file here counts)
SQL lives in .sql files. Panels refer to queries by name.
The browser never sends SQL; it asks the dev server to run query top_products
of dashboard sales-overview with the current filter values. That keeps the
SQL reviewable, runnable from the CLI, and out of reach of anything in the page.
There is no prop that takes raw SQL — do not try to add one.
queries.sql-- name: revenue_by_month
-- source: warehouse
-- description: Paid revenue per calendar month
SELECT date_trunc('month', paid_at)::date AS month,
SUM(amount_cents) / 100.0 AS revenue
FROM payments
WHERE status = 'paid'
AND paid_at >= :from AND paid_at < :to
AND (:region IS NULL OR region = :region)
GROUP BY 1
ORDER BY 1;
-- name: starts a query. Letters, digits, _, -. Unique per dashboard.-- source: (optional) picks the datasource; omit to use defaultSource.-- description: (optional) is for humans and shows in the inspector.-- cache: (optional) how long the result is reused for everyone viewing:
30s, 5m, 1h, off. Default: the config's cache (30 s). Use off for
a "right now" number on a live board, and longer for heavy or billed queries
(BigQuery). The refresh button always runs fresh; check never uses the cache.-- alert: (optional) threshold alert expression checked against the first row, e.g.
-- alert: revenue < 50000 warn "Revenue below $50k" or -- alert: error_rate > 0.05 error "High error rate".
Shows a warning/error badge on the panel header and is included in open-dashboard report.-- expect: (optional, repeatable) — what must hold of every result, checked by
check and never shown to readers: rows > 0, rows between 1 and 31,
not_null region, amount, unique day, share between 0 and 1, amount >= 0.
Write one for every invariant you know — a share stays in 0–1, a key is unique,
a total is never negative — so a wrong number fails check instead of reaching a reader.-- uses: (optional) — see Across databases below.-- name:.; is fine. One statement per query.queries/*.sql): Named queries placed in top-level queries/*.sql are automatically inherited by all dashboards (a dashboard's own queries.sql overrides on name collision).Queries on an http or mcp source are SQLite SQL over the tables the
config defines; each table is fetched (or its tool called) when a query names
it. Values are as the API sent them — cast numeric strings (CAST(x AS REAL)),
convert odd dates in SQL, and read nested JSON with json_extract /
json_each. A table whose URL or tool args hold :name needs that
parameter, usually a <Select>.
-- uses:A query cannot join tables from two datasources. Instead, write one query per database, then a query that uses their results as tables:
-- name: spend_by_channel
-- source: marketing
SELECT channel, SUM(spend) AS spend FROM ad_spend
WHERE date >= :from AND date < :to GROUP BY channel;
-- name: revenue_by_channel
-- source: shop
SELECT acquisition_channel AS channel, SUM(total) AS revenue FROM orders
WHERE ordered_at >= :from AND ordered_at < :to GROUP BY 1;
-- name: channel_return
-- uses: spend_by_channel, revenue_by_channel
SELECT s.channel, s.spend, r.revenue, r.revenue / s.spend AS roas
FROM spend_by_channel s LEFT JOIN revenue_by_channel r USING (channel)
ORDER BY roas DESC;
-- uses: query runs in SQLite, in a scratch in-memory database
holding each input as a table named after its query. Write it in SQLite
dialect whatever the inputs run on. It has no -- source:.-- uses: query can read them too.maxRows like any
query; a cut-short input makes the combined result truncated (and wrong).
Match the join keys' shape in each dialect (same date format, same case).-- uses: query can use another one; loops and unknown names are check
errors. Inputs count as used, so they need no panel of their own.:name placeholders are bound from the dashboard's filters — never
interpolated into the SQL text, so they are injection-safe. The same
placeholder may appear several times. Inside string literals, comments and
Postgres ::casts, a colon is left alone.
| Filter | Binds |
|---|---|
<TimeRange /> | :from (inclusive) and :to (exclusive), as 'YYYY-MM-DD' |
<TimeRange compare /> | also binds :prev_from and :prev_to for previous-period comparison |
<TimeRange name="signup" /> | :signup_from, :signup_to |
<Select name="region" /> | :region — a string, or NULL when "All" is chosen |
<MultiSelect name="region" /> | :region — comma-separated string ('North,South'), or NULL when "All" is chosen |
<SearchInput name="q" /> | :q — trimmed search string, or NULL when empty |
<Toggle name="paid_only" /> | :paid_only — 1 or 0 |
<NumberRange name="amount" /> | :amount_min and :amount_max — numeric bounds |
So always write:
col >= :from AND col < :to — :to is exclusive (tomorrow, for "today").(:region IS NULL OR region = :region).(:region IS NULL OR ',' || :region || ',' LIKE '%,' || region || ',%').(:q IS NULL OR name LIKE '%' || :q || '%').(:paid_only = 0 OR status = 'paid').amount >= :amount_min AND amount <= :amount_max.A query that uses a placeholder no filter provides fails with
missing parameter :x — no filter on the dashboard provides it.
Write each SQL for the datasource's dialect — date bucketing differs a lot between SQLite, Postgres and MySQL: references/sql-dialects.md.
AS revenue, AS signups. Panels humanise names
(new_customers → "New customers") in legends, tooltips and table headers.1.0 * in SQLite / MySQL integer
division; cast numeric if needed. The CLI prints column types — check them.month, web, mobile) with y={['web','mobile']}, or long form
(month, channel, revenue) with y="revenue" series="channel". Long form is
better when the set of series comes from the data.format="percent".<Stat compare>: return the previous-period value in the
same row as the current one (see the dialect file for the bounds trick).index.tsximport {
BarChart, Dashboard, type DashboardMeta, Filters, LineChart, Row, Select, Stat, Table, TimeRange,
} from '@open-dashboard/core'
export const meta: DashboardMeta = {
title: 'Sales overview',
refresh: '5m', // default auto-refresh: '30s' | '1m' | '5m' | '1h' — the reader can change it
currency: 'USD', // for 'currency' formats
locale: 'en-US', // numbers, dates, and the page's language (CJK fonts, line breaks); e.g. 'zh-TW', 'ja-JP'
// theme: 'brand', // a themes/<id>.json (see the create-theme skill); omit for the workspace default
createdAt: '2026-10-02T00:00:00.000Z',
}
export default function SalesOverview() {
return (
<Dashboard>
<Filters>
<TimeRange default="90d" />
<Select name="region" label="Region" query="regions" />
</Filters>
<Row>
<Stat title="Revenue" query="kpis" column="revenue" compare="revenue_prev" format="currency" />
<Stat title="Orders" query="kpis" column="orders" compare="orders_prev" format="integer" />
</Row>
<Row height={320}>
<LineChart title="Revenue by month" query="revenue_by_month" x="month" y="revenue" format="currency" span={8} />
<BarChart title="Top products" query="top_products" x="product" y="revenue" horizontal span={4} />
</Row>
</Dashboard>
)
}
meta.refresh is only the default: the toolbar has an auto-refresh menu
(off, 30 s … 1 h) and the reader's choice is kept in the URL (?refresh=2m).
Do not build your own interval control.meta is a plain object literal: the dashboard list reads it without running
the file. No spreads, no imported values.<Dashboard>.<Filters> must be a direct child of <Dashboard>; it renders in the
header. Filter values live in the URL (?time=12m®ion=North), so a
filtered view can be shared as a link.title — it is how the inspector, notes, and
current-dashboard identify the panel. Keep titles unique within a dashboard.x, y, column, label, value). Defaults
exist, but open-dashboard check can only verify what is written literally.Every component, every prop: references/components.md.
The viewer has a Preview / Edit switch. In Edit, people resize panels,
reorder them within a row, and change a chart's type, columns, format and
drill — and Save writes those changes into index.tsx as ordinary props
(span, height, x, y, format…) and element order.
index.tsx before every edit. It may have changed since you last
looked. Never restore a span, height or type the person set on the page
unless they ask.<Row> emptied by a move.title.
Write props as literals (span={6}, not span={half}) wherever a person
might want to adjust them.<Row> is a 12-column band. Children split it evenly unless they set span
(1–12). height on the row sets every panel's height; a panel's own
height wins. KPI rows need no height.<Section title> groups rows under a heading on a long dashboard.datetime('now', 'localtime'),
Postgres now(), MySQL NOW(). Always cap at now — data stamped in the future
(scheduled rows, a seeded demo) must not count as "today".now − 1 day, then <Stat compare=… compareLabel="vs yesterday so far">.generate_series), otherwise a quiet hour silently disappears from the axis
and neighbouring bars look adjacent in time. See the dialect file.<BarChart> (thin bars), stacked if the
parts add up; a stacked area puts its top series' colour along the whole edge.<Select allowAll={false}> with
static options, bound into SQL as text: '-' || :days || ' days'.| The reader wants | Panel |
|---|---|
| one number, now | <Stat> — with compare if a previous period exists |
| change over time | <LineChart>; <AreaChart stacked> if the series add up to a whole |
| compare categories | <BarChart>; horizontal for rankings / long names / > 8 bars |
| part of a whole, ≤ 6 parts | <PieChart> (a donut). Close values → use a BarChart |
| part of a whole, many parts | <Treemap> |
| two measures against each other | <ScatterChart> (size for a third → bubbles) |
| intensity across two categories | <Heatmap> (weekday × hour, region × month) |
| drop-off through ordered stages | <FunnelChart> |
| one value against a scale or target | <Gauge>; without a target, <Stat> is usually clearer |
| composition over time | <BarChart stacked> (few periods) or <AreaChart stacked> (many) |
| a ranking on a tight range | <DotPlot> (bars from zero would all look alike) |
| before → after per category | <Dumbbell>; <SlopeChart> when "who rose, who fell" is the point |
| actual against target, several rows | <BulletChart> |
| signed change per category | <DivergingBar> |
| group sizes and their mix at once | <Marimekko> |
| rank changes over time | <BumpChart> |
| how a start became an end | <Waterfall> |
| a daily pattern over a year | <CalendarHeatmap> |
| many series over time (> 4 lines) | <SmallMultiples>; dozens in little space → <HorizonChart> |
| a trend with its spread or interval | <BandChart> |
| is this process stable / which days are abnormal | <ControlChart> |
| jobs, tasks or bookings in time | <Timeline> |
| a project plan: phases, dependencies, progress, working days | <Gantt> |
| open / high / low / close | <Candlestick> |
| how values are spread | <Histogram>; per group → <BoxPlot>; small samples → <StripPlot>; "N % are under X" → <EcdfChart> |
| how concentrated (top 20 % hold…) | <ParetoChart> |
| flows between stages | <Sankey> (a single path of drop-off → <FunnelChart>) |
| retention by cohort | <CohortTable> |
| none of the above, truly | a custom chart under charts/ — the create-chart skill |
| overlaps between sets | <UpSetChart> |
| values by region | <ChoroplethMap> (needs GeoJSON); every region equally visible → <TileMap>; points → <SymbolMap> |
| up / down / degraded over time | <StateTimeline> |
| look things up | <Table>; a cross-tab → <PivotTable> |
Rules that are not taste:
<Stat>.invert on <Stat>.ORDER BY month, channel), not by value.format takes a name or any Intl.NumberFormatOptions object:
| Name | 1234.5 | Note |
|---|---|---|
number (default) | 1,234.5 | |
integer | 1,235 | |
decimal | 1,234.50 | |
compact | 1.2K | |
currency | $1,235 | meta.currency; cents shown under 1,000 |
currencyCompact | $1.2K | |
percent | — | expects a fraction: 0.123 → 12% |
date / month | — | ISO strings → localized date / month |
text | as-is | raw string, e.g. timestamps in a table |
Axis ticks pick compact notation on their own when values are large.
{ style: 'unit', unit: 'millisecond' }, { style: 'currency', currency: 'TWD' }
and friends work too.
pnpm exec open-dashboard check <id> # the default filters
pnpm exec open-dashboard check <id> --param region=South # one other view
pnpm exec open-dashboard check <id> --all-params # every combination a build stores
Runs every query and reports SQL errors, unknown queries, columns a panel names
that the result does not have, unbound parameters, empty results, unused
queries, truncated results, broken -- expect: rules and slow queries. The
defaults are one reader's view: --all-params runs every filter combination a
build would store and names the first params each problem shows up at. Zero
errors with --all-params before you hand a dashboard back.
Changing a query that already works? Build first, change, then compare —
open-dashboard build before, open-dashboard diff after — and explain every
number that moved.
queries/*.sql
at the workspace root, where every dashboard can name it — never a copy per
dashboard (lint flags copies).-- uses: inputs run again for every query that uses them, and SQLite
re-runs a CTE each time it is named or read from a correlated subquery. A CTE
read more than once, or one holding a large parsed JSON, is
name AS MATERIALIZED (…).check warns past
--slow-ms (default 1000) and --all-params sums each query over every run —
what a build pays. Fix the slowest before adding filters that multiply runs.live (a database or API, read when a query asks),
collected (as of the last collector run — current only where that collector
runs) or static (files as committed). check prints each dashboard's
sources by freshness, and a build writes them into dashboards.json. Override with
freshness: on a source when you know better (a SQLite file an outside job
refreshes).live sources — an http table or a database — and keeps collectors for
what changes slowly. meta.refresh cannot make a collected source newer in
a build made elsewhere; build says so.timeZone in the config ('Asia/Taipei') for any workspace built
somewhere else: it is the wall clock builds stamp and "today" resolves against.-- description: line, not on the page.description on panels, sections or meta, and no <Text> explaining the
charts — titles and axes carry the meaning. Add them only when the user asks.>= :from AND < :to; selects use (:x IS NULL OR …).check shows rows).-- expect: rule.check --all-params passes, with no slow-query warning left unexplained.queries/.live source; timeZone is set
if the workspace is built anywhere but this machine.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/apply-commentsUse this skill when the user has left notes on panels in the open-dashboard viewer and wants them applied — "apply my comments", "do the notes I left", "I marked up the dashboard". Walks every `@dashboard-comment` marker, makes the change each asks for, verifies it, and removes the marker./connect-databaseUse this skill when the user wants to connect this open-dashboard workspace to a database or data warehouse — "connect to our Postgres", "use this SQLite file", "here is the SQL Server connection string", "hook up BigQuery / Snowflake / ClickHouse / Oracle", "query these Parquet files", "add a datasource", or when `open-dashboard sources` reports a failure. Covers SQLite, PostgreSQL (and Supabase, Neon, RDS, Redshift, CockroachDB…), MySQL (and MariaDB, PlanetScale, TiDB…), SQL Server / Azure SQL, Oracle, DuckDB / Parquet / CSV, ClickHouse, BigQuery and Snowflake. Do NOT use for writing dashboards — that is `create-dashboard`./create-chartUse this skill when a dashboard needs a chart that none of the built-in panels draws — a radar, a bespoke gauge, a domain-specific diagram — and the user wants it written once under `charts/` and reused in dashboards. Also use it to fix or restyle an existing custom chart under `charts/`. Do NOT use it when a built-in panel fits (check `dashboard-authoring` → *Choosing a panel* first), for dashboards themselves (`create-dashboard`), or for colours and fonts across a dashboard (that is a theme in `themes/`).npx claudepluginhub simonliu-ai-product/open-dashboard --plugin open-dashboardOther plugins' skills for the same job