Databricks Aibi Dashboards 标志

Databricks Aibi Dashboards

组织
databricks
databricks-aibi-dashboards

Create Databricks AI/BI dashboards. Must use when creating, updating, or deploying Lakeview dashboards as Databricks Dashboard have a unique json structure. CRITICAL: You MUST test ALL SQL queries via CLI BEFORE deploying. Follow guidelines strictly.

Add to TypingMind

概览

发布者databricks
代码仓库databricks-agent-skills
技能名称databricks-aibi-dashboards
星标数
366
复刻数
93
附带文件
9
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 9 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 databricks 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Databricks Aibi Dashboards AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/databricks/databricks-agent-skills/tree/main/plugins/databricks/claude/skills/databricks-aibi-dashboards
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/databricks/databricks-agent-skills.git /tmp/databricks-agent-skills
mkdir -p .claude/skills
cp -r /tmp/databricks-agent-skills/plugins/databricks/claude/skills/databricks-aibi-dashboards .claude/skills/databricks-aibi-dashboards
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Databricks Aibi Dashboards,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Databricks Aibi Dashboards。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Databricks Aibi Dashboards 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

AI/BI Dashboard Skill

Create Databricks AI/BI dashboards (formerly Lakeview dashboards). A dashboard should be showing something relevant for a human, typically some KPI on the top, and based on the story, some graph (often temporal), and we see "something happens". Follow these guidelines strictly.

Choose a Widget

Use standard widgets by default. Use Vega-Lite when the required visualization cannot be expressed with standard widgets. A different aggregation, color palette, tooltip, reference line, or small multiple usually does not require a custom specification.

What needs to be shown?Use
KPIs, trends, rankings, distributions, or geographic comparisonsStandard counter, line/bar, histogram/box, or map widgets
Revenue bars with a margin line on a second axisStandard combo
Retention by cohort and elapsed periodStandard pivot with a color scale
Task start/end times on a scheduleStandard gantt
Delivery routes or ordered GPS tracksStandard path-map
A target line or the same chart repeated by regionStandard annotations or faceting; see widget specifications
A bullet chart with an actual-value bar and target marker for each categorycustom-vega-viz; see the worked bullet example
Raw observations drawn as points with a rolling-mean line overlaidcustom-vega-viz; see the layered time-series example
A requested gauge, radar, or nested radial/sunburst layoutcustom-vega-viz; see custom chart patterns

For custom charts, confirm the required marks and transforms are supported by Vega-Lite. It does not support every Vega example or chart type. Keep joins and business calculations in dataset SQL; the custom specification controls how the returned data is drawn.

When a custom app fits better: A managed AI/BI dashboard is the right tool for read-only KPIs, charts, and filters over governed tables. If the user instead needs a custom-code interactive app — write-back / data entry, bespoke UI or interactions beyond the dashboard grid, embedded or auth-gated workflows, or a conversational Genie/chat assistant as the primary surface — build a Databricks App instead with the databricks-apps skill (which brings in databricks-app-design for the data-screen UX). Linking an "Ask Genie" space to this dashboard stays here (see Linking a Genie Space below).

Quick Reference

TaskCommand
List warehousesdatabricks warehouses list
List tablesdatabricks experimental aitools tools query --warehouse WH "SHOW TABLES IN catalog.schema"
Get schemadatabricks experimental aitools tools discover-schema catalog.schema.table1 catalog.schema.table2
Test querydatabricks experimental aitools tools query --warehouse WH "SELECT..."
Create dashboarddatabricks lakeview create --display-name "X" --warehouse-id "WH" --dataset-catalog CATALOG --dataset-schema SCHEMA --serialized-dashboard "$(cat file.json)" --json '{"parent_path": "/Workspace/Users/<you>/path"}' — --dataset-catalog / --dataset-schema are flag-only (REQUIRED; CLI silently drops them if put in --json); parent_path is JSON-only (no flag). Queries must use bare table names.
Update dashboarddatabricks lakeview update DASHBOARD_ID --dataset-catalog CATALOG --dataset-schema SCHEMA --serialized-dashboard "$(cat file.json)" — always re-pass --dataset-catalog / --dataset-schema on update (same flag-only rule as create); update replaces the serialized dashboard, so omitting them nulls the per-dataset defaults and breaks every bare-table query.
Publishdatabricks lakeview publish DASHBOARD_ID --warehouse-id WH
Deletedatabricks lakeview trash DASHBOARD_ID

--warehouse flag: if databricks experimental aitools tools query --warehouse WH "..." fails with unknown flag: --warehouse on your CLI version, set DATABRICKS_WAREHOUSE_ID=WH in the environment instead and drop the flag — the command auto-picks it from there.


Widget Index (Version + Where Documented)

Wrong version = broken widget! This is the #1 cause of dashboard errors.

Widget TypeVersionDocumented in
text (markdown, no spec block)N/A1-widget-specifications.md#text-headersdescriptions
counter (KPI + sparkline + comparison)21-widget-specifications.md#counter-kpi
table21-widget-specifications.md#table
bar, line31-widget-specifications.md#line--bar-charts
pie31-widget-specifications.md#pie-chart
symbol-map (lat/lon point map)21-widget-specifications.md#symbol-map-bubble-map
area32-advanced-widget-specifications.md#area-chart
scatter32-advanced-widget-specifications.md#scatter-plot--bubble-chart
combo (bar+line, dual-axis)12-advanced-widget-specifications.md#combo-chart-bar--line
choropleth-map (regions colored by value)12-advanced-widget-specifications.md#choropleth-map
forecast-line (with AI_FORECAST SQL)12-advanced-widget-specifications.md#forecast-line-with-ai_forecast
pivot (with conditional cell rules)32-advanced-widget-specifications.md#pivot
histogram (with bin(col, binWidth=N))32-advanced-widget-specifications.md#histogram
sankey12-advanced-widget-specifications.md#sankey
heatmap32-advanced-widget-specifications.md#heatmap
funnel12-advanced-widget-specifications.md#funnel
box12-advanced-widget-specifications.md#box
waterfall12-advanced-widget-specifications.md#waterfall
gantt (task schedules and ranges)12-advanced-widget-specifications.md#gantt
path-map (routes and ordered tracks)12-advanced-widget-specifications.md#path-map
filter-single-select, filter-multi-select, filter-date-range-picker23-filters.md#filter-widget-structure
filter-date-picker, filter-text-entry2date picker, text entry
range-slider23-filters.md#range-slider-numeric-range-filter
custom-vega-viz (Vega-Lite custom visualization)16-custom-visualizations.md

Cohort retention charts are built as a pivot with a color-scale cell style — there is no cohort widget type. See pivot in 2-advanced-widget-specifications.md.


NEW DASHBOARD CREATION WORKFLOW

You MUST test ALL SQL queries via CLI BEFORE deploying. Follow the overall logic in these steps for new dashboard - Skipping validation causes broken dashboards.

Step 1: Get Warehouse ID if not already known

bash
# List warehouses to find one for SQL execution
databricks warehouses list

Step 2: Discover Table Schemas and existing data pattern

A good dashboard comes from knowing the data first. Spend time here — the exploration drives design decisions in Step 4 (which widgets, which filters, which groupings).

Use discover-schema as the default — one call returns columns, types, sample rows, null counts, and row count. If you only know the schema, list tables first with query "SHOW TABLES IN ...".

databricks experimental aitools tools discover-schema catalog.schema.orders catalog.schema.customers

Sample rows alone don't tell you what to build. you can write aggregate SQL through databricks experimental aitools tools query --warehouse <WH> "..." to probe typically:

  • Cardinality of candidate grouping columns → decides chart color-group vs. table (≤8 distinct values for charts, see Cardinality & Readability below).
  • Top categorical values → populates filter options and chart legends meaningfully.
  • Numeric distribution (min/max/avg/percentiles) → decides KPI with delta vs. trend chart (flat metrics shouldn't be line charts, see Data Variance Considerations below).
  • Trend viability at daily/weekly/monthly grain → picks the right trend granularity.
  • Story confirmation — run the aggregations you plan to put in the dashboard and check they're not flat, empty, or uninteresting. Fix the query or adjust the story before moving on.

Fan out independent probes in one call — pass several positional SQLs (and/or repeated --file) and they run in parallel (default --concurrency 8):

bash
DATABRICKS_WAREHOUSE_ID=<WH> databricks experimental aitools tools query --output json \
  "SELECT COUNT(*) FROM catalog.schema.orders" \
  "SELECT region, COUNT(*) FROM catalog.schema.orders GROUP BY region ORDER BY 2 DESC LIMIT 10" \
  "SELECT MIN(ts), MAX(ts) FROM catalog.schema.orders"
  • --output json is mandatory in multi-query mode. Returns one object per statement: {sql, state, rows, error}; failures are per-statement (state: "FAILED"), others still succeed.
  • ⚠️ Don't trust the exit code (a failed statement can still exit 0) — gate on each object's state != "SUCCEEDED".

Dashboard queries are different — inside the dashboard JSON, the FROM clause must reference ONLY the table name, with no catalog or schema prefix:

  • ✅ Correct: FROM trips
  • ❌ Wrong: FROM nyctaxi.trips
  • ❌ Wrong: FROM samples.nyctaxi.trips

The catalog and schema are supplied separately via the --dataset-catalog and --dataset-schema flags when you run databricks lakeview create. These flags do NOT rewrite the query — they only fill in the catalog/schema when the query omits them. If you hardcode a catalog or schema in the FROM clause, the flags are ignored for that query and the dashboard won't be portable across environments.

Step 3: Verify Data Matches Story

The datasets.querylines in the dashboard json (see example below) must be tested to ensure

Before finalizing, run the SQL Queries you intend to add in each dataset to confirm that they run properly and that the result are valid. This is crucial, as the widget defined in the json will use the query field output to render the visualization. The value should also make sense at a business level. Remember that for the filter to work, the query should have the field available (so typically group by the filter field)

If values don't match expectations, ensure the query is correct, fix the data if you can, or adjust the story before creating the dashboard.

Step 4: Plan Dashboard Structure

Before writing JSON, plan your dashboard:

  1. You must know the expected specific JSON structure. For this, Read reference files: 1-widget-specifications.md, 3-filters.md.

Always make sure you read an entire example to understand the structure, like 4-examples.md.

  1. Think: What widgets? Map each visualization to a dataset:

    WidgetTypeDatasetHas filter field?
    Revenue KPIcounterds_sales✓ date, region
    Trend Chartlineds_sales✓ date, region
    Top Productstableds_products✗ no date
    ...
  2. What filters? For each filter, verify ALL datasets you want filtered contain the filter field.

    Filters only affect datasets that have the filter field. A pre-aggregated table without dates WON'T be date-filtered.

  3. Build the dashboard JSON as a local working file (intermediate step, not the deliverable).

Step 5: Deploy

Now deploy the JSON to the workspace. Run databricks lakeview create (below). Your task is not complete until this command succeeds and returns a dashboard ID — the JSON file alone is an intermediate working artifact.

Give the user the dashboard link (host from databricks auth env -o json → .env.DATABRICKS_HOST). Note the v3 — /sql/dashboards/ without it is the wrong legacy path:

  • Draft: https://<host>/sql/dashboardsv3/<DASHBOARD_ID>
  • Published: append /published (only valid once you've run databricks lakeview publish DASHBOARD_ID)

After deploying, the same lakeview subcommands manage the dashboard's lifecycle (list, get, update, publish, trash).

bash
# Deploy: creates the dashboard in the workspace and returns a dashboard ID.
# Canonical form — MIX flags + --json. Each field has exactly ONE valid place:
#   --dataset-catalog / --dataset-schema : FLAG-ONLY (REQUIRED — no JSON field).
#       The CLI silently warns "unknown field" and drops them if put in --json,
#       leaving every dataset query unable to resolve its catalog.schema.
#   parent_path : JSON-ONLY (no flag). Without it, dashboard lands at
#       /Users/<you>/<display-name>.
#   display_name / warehouse_id / serialized_dashboard : either form works;
#       prefer flags for readability.
# Queries inside dashboard.json MUST use bare table names ("FROM trips", never
# "FROM schema.trips" or "FROM catalog.schema.trips") — --dataset-catalog and
# --dataset-schema only fill in missing parts, they do NOT rewrite hardcoded
# prefixes.
#
# parent_path must ALREADY EXIST or create fails "Tree node ... does not exist":
databricks workspace mkdirs /Workspace/Users/me@co.com/dashboards

# Capture the dashboard_id with -o json. Do NOT add 2>&1: create echoes the
# serialized dashboard back, and merging stderr breaks the output so jq can't
# parse it (the dashboard IS created, but you lose the id and the step looks failed).
DASHBOARD_ID=$(databricks lakeview create \
  --display-name "My Dashboard" \
  --warehouse-id "abc123def456" \
  --dataset-catalog "my_catalog" \
  --dataset-schema "my_schema" \
  --serialized-dashboard "$(cat dashboard.json)" \
  --json '{"parent_path": "/Workspace/Users/me@co.com/dashboards"}' \
  -o json | jq -r '.dashboard_id')

# List all dashboards
databricks lakeview list

# Get dashboard details
databricks lakeview get DASHBOARD_ID

# Update a dashboard
# ALWAYS re-pass --dataset-catalog / --dataset-schema: update replaces the
# serialized dashboard, so omitting them nulls the defaults and breaks queries.
databricks lakeview update DASHBOARD_ID \
  --dataset-catalog "my_catalog" \
  --dataset-schema "my_schema" \
  --serialized-dashboard "$(cat dashboard.json)"

# Publish a dashboard
databricks lakeview publish DASHBOARD_ID --warehouse-id WAREHOUSE_ID

# Unpublish a dashboard
databricks lakeview unpublish DASHBOARD_ID

# Delete (trash) a dashboard
databricks lakeview trash DASHBOARD_ID

# By default, after creation, tag dashboards to track resources created with this skill
databricks workspace-entity-tag-assignments create-tag-assignment \
  dashboards DASHBOARD_ID aidevkit_project --tag-value ai-dev-kit

UPDATING AN EXISTING DASHBOARD

To change a dashboard that already exists, build the updated JSON with the creation workflow above, then deploy it with update + publish on the same DASHBOARD_ID — never re-run create/import.

  • Don't create/import to update. That mints a new dashboard id + URL and breaks any link you've already shared; create is for brand-new dashboards only.
  • update changes only the draft. The /published link viewers see stays on the last snapshot until you publish again — so always publish after update.

JSON Structure (Required Skeleton)

Every dashboard's serialized_dashboard content must follow this exact structure:

Important: ALWAYS add a space or \n at the end of each queryLines value as they are concatenated to create the dataset.

json
{
  "datasets": [
    {
      "name": "ds_x",
      "displayName": "Dataset X",
      "queryLines": ["SELECT col1, col2 ", "FROM my_table"]
    }
  ],
  "pages": [
    {
      "name": "main",
      "displayName": "Main",
      "pageType": "PAGE_TYPE_CANVAS",
      "layout": [
        {"widget": {/* INLINE widget definition */}, "position": {"x":0,"y":0,"width":2,"height":3}}
      ]
    }
  ]
}

Structural rules (violations cause "failed to parse serialized dashboard"):

  • queryLines: Array of strings, NOT "query": "string". Elements are joined verbatim with no separator — end each line with or \n (or strip -- comments). A line ending in -- comment with no newline swallows the next line.
  • Widgets: INLINE in layout[].widget, NOT a separate "widgets" array
  • pageType: Required on every page (PAGE_TYPE_CANVAS or PAGE_TYPE_GLOBAL_FILTERS)
  • Query binding: chart, table, counter, and custom-viz query.fields[].name values must exactly match their encodings.*.fieldName values. Filters have widget-specific bindings; range sliders expose MIN/MAX query fields for one underlying fieldName, and parameter-bound date filters use query.parameters.

Theme & Color (always set this — it makes or breaks the dashboard)

Top-level uiSettings.theme controls colors, fonts, and widget chrome across every widget on the dashboard. Without it, the dashboard inherits the workspace default and looks generic. Set the full block on every dashboard you create — a coherent palette is the single highest-impact polish item.

Mental model — 60/30/10 rule mapped to theme keys: 60% neutral = canvas/widget/border backgrounds (set widgetBorderColor = widgetBackgroundColor to hide borders); 30% secondary = fontColor + visualizationColors (the content weight); 10% accent = selectionColor for filters / tabs / active selections — pick something distinct from text and palette; a safe-blue around #2272B4 matches the hyperlink convention and works as a default.

json
{
  "datasets": [...],
  "pages": [...],
  "uiSettings": {
    "theme": {
      "canvasBackgroundColor": {"light": "#FCFCFC", "dark": "#1F272D"},
      "widgetBackgroundColor": {"light": "#FFFFFF", "dark": "#11171C"},
      "fontColor":             {"light": "#11171C", "dark": "#E8ECF0"},
      "selectionColor":        {"light": "#2272B4", "dark": "#8ACAFF"},
      "visualizationColors": [
        "#FFA600", "#FF7054", "#DE5582", "#995495",
        "#4E5185", "#1D425C", "#99DDB4"
      ],
      "widgetHeaderAlignment": "LEFT"
    }
  }
}

Theme keys (mechanics):

  • visualizationColors: ordered palette every chart series and category mapping cycles through. Positions are 0-indexed: position: 0 = first color (#FFA600 above), position: 6 = seventh (#99DDB4). Length 5–8 is typical.
  • Background / font / selection colors take light + dark pairs; the dashboard auto-selects based on viewer mode.
  • fontColor also drives the counter number color — counters have no per-widget color, so this is the only lever for them (it colors every counter's value on the dashboard, not per-tile).
  • widgetHeaderAlignment: "LEFT" (default), "CENTER", or "RIGHT". Optional top-level: fontFamily (e.g. "Space Grotesk", "Inter" — sans-serif keeps dense data readable; don't override per widget) and widgetCornerRadius (integer px, e.g. 12 for rounded corners; 0 or omit = square).
  • Per-widget color references (charts only): {"themeColorType": "visualizationColors", "position": N} (0-indexed) to pin to a palette slot, or {"hex": "#FF0000"} for an exact color outside the palette. Counters do NOT support a per-widget color — a color on a counter's value renders the widget as "unsupported widget definition"; color counters via fontColor above.

Palette-design rules (this is what separates a polished dashboard from a noisy one):

  1. One coherent color family per dashboard, distinct across the suite. Walk across hues (e.g., amber → coral → pink → purple → navy), not one color faded toward white — a single-hue lightness ramp reads as one color and the viewer can't tell categories apart. Adjacent stops must be visually distinct: if you squint and two blur into one, push them further apart. Single-hue ramps are for quantitative widgets only (colorRamp.mode: "custom-sequential"), never for visualizationColors.
  2. Pin semantic colors as literal hex, outside the palette. "Bad" = a warm coral (e.g. #FF7E5C), "good" = a calm teal/green. Use color.scale.mappings with a bare hex string — {"value": "Critical", "color": "#FF7E5C"} — not {"hex": "..."} or themeColorType: position (both are silently dropped on chart widgets). Reuse the good-teal that's already in the palette so it never clashes.
  3. Color non-categorical widgets explicitly so they join the family. Maps & heatmaps: colorRamp.mode: "custom-sequential" with {start, end} from the family (if directional: start = bad color, end = good color). Forecast / multi-series: pin per-series via color.scale.mappings keyed on displayName (actual = solid family color, forecast = contrast/alert, threshold = muted tone). Counters (incl. sparkline counters) take no per-widget color — their number color comes from the theme's fontColor; do NOT set value.color (it renders "unsupported widget definition").
  4. "Lighter / more pastel" tweak: nudge all stops up in lightness together; don't recolor individual ones. Re-sync the pinned semantic hex values; keep enough contrast on the alert color that it still reads as a warning.

Starter palettes (pick one and adapt — extend to 7-8 stops if needed; semantic red/green stay as literal hex per rule 2):

#094074  #3C6997  #5ADBFF  #FFDD4A  #FE9000
#003F5C  #594E90  #BC4C96  #FF5F66  #FFA600
#4A8CC7  #F59770  #FFD84A  #F0E09E  #6DD980
#440154  #3B528B  #21918C  #5EC962  #FDE725
#4E79A7  #F28E2C  #E15759  #76B7B2  #59A14F
#0072B2  #E69F00  #009E73  #CC79A7  #D55E00
#0D0887  #7E03A8  #CC4778  #F89441  #F0F921
#6929C4  #1192E8  #005D5D  #9F1853  #FA4D56

~4-5% of viewers have color blindness (mostly red/green). Rows 4 and 6 above (viridis, Okabe-Ito) are CB-safe by design; verify customized palettes via simulator (Adobe Color, colorbrewer2.org). Don't put red and green adjacent, and rely on lightness contrast — not hue alone — between adjacent stops.

Linking a Genie Space (Optional)

To add an "Ask Genie" button to the dashboard, or to link a genie space/room with an ID, add uiSettings.genieSpace to the JSON (alongside theme if you have one):

json
"uiSettings": {
  "theme": { /* ... */ },
  "genieSpace": {
    "isEnabled": true,
    "overrideId": "your-genie-space-id-here",
    "enablementMode": "ENABLED"
  }
}

Genie is NOT a widget. Link via uiSettings.genieSpace only. There is no "widgetType": "assistant".


Design Best Practices

Apply unless user specifies otherwise:

  • Global date filter: When data has temporal columns, add a date range filter. Most dashboards need time-based filtering.
  • KPI time bounds: Use time-bounded metrics that enable period comparison (MoM, YoY). Unbounded "all-time" totals are less actionable.
  • Value formatting: Format values based on their meaning — currency with symbol, percentages with %, large numbers compacted (K/M/B).
  • Chart selection: Match cardinality to chart type. Few distinct values → bar with color grouping (or pie if you really want a snapshot); many values → table.

Reference Files

Before generating any dashboard JSON, read 4-examples.md first. It's a complete reference dashboard exercising every construct (dataset measures + MEASURE(), sparkline counters, forecast-line with annotations, pivot with conditional cells, symbol-map, histogram, range-slider filter, theme). Use it to learn the JSON shape; then adapt to the user's data and demo story — keep the structure, swap the tables, metrics, palette, and narrative for the case you're building.

What are you building?Reference
Start here — full working dashboard template4-examples.md
Any widget (text, counter, table, chart)1-widget-specifications.md
Advanced charts (area, scatter/bubble, combo, Gantt, choropleth/path maps)2-advanced-widget-specifications.md
Dashboard with filters (global or page-level)3-filters.md
Custom Vega-Lite widgets (layered charts, bullet, gauge, radar, sunburst)6-custom-visualizations.md
Debugging a broken dashboard5-troubleshooting.md

Implementation Guidelines

1) DATASET ARCHITECTURE

  • Fewer datasets is better — aim for one dataset that backs as many widgets as possible. Clicking a value on a chart (e.g., a bar, a slice) acts as a filter on that dataset, and every other widget sharing the same dataset re-renders with the click applied. Splitting widgets across many narrow datasets breaks this cross-filtering and forces users to set explicit filter widgets for what should "just work". Prefer one wide dataset per domain (orders, cases, customers); only split when a widget genuinely needs different grain, pre-aggregation, or a parameter the others can't tolerate.
  • Two ways to define a dataset:
    • SQL query: {"name": "ds_x", "displayName": "...", "queryLines": ["SELECT ...", "FROM table"]} — full control, can include WITH / JOIN / AI_FORECAST / etc.
    • UC asset shorthand: {"name": "ds_x", "asset_name": "catalog.schema.table_or_view"} — no SQL needed. Works for tables, views, and metric views. You can still stack columns (measures + derived dimensions) on top: {"name": "ds_x", "asset_name": "...", "columns": [{"displayName": "Total Revenue", "expression": "SUM(\amount_usd`)"}]}— sameMEASURE()` pattern.
  • Exactly ONE valid SQL query per dataset when using queryLines (no multiple queries separated by ;)
  • Queries must use bare table names only — no catalog, no schema prefix. Example: FROM orders, never FROM gold.orders or FROM main.gold.orders. The catalog and schema come from the --dataset-catalog and --dataset-schema flags at creation time. These flags only fill in missing parts — they do NOT override any catalog/schema written in the query.
  • SELECT must include all dimensions needed by widgets and all derived columns via AS aliases
  • Put ALL business logic (CASE/WHEN, COALESCE, ratios) into the dataset SELECT with explicit aliases
  • Contract rule for visualizations: For chart, table, counter, and custom-viz widgets, every fieldName must match its corresponding query.fields[].name; that query field's expression references dataset columns or aliases. Use the filter-specific contracts in 3-filters.md, including range-slider and parameter-binding exceptions.
  • Add ORDER BY when visualization depends on data order:
    • Time series: ORDER BY date for chronological display
    • Rankings/Top-N: ORDER BY metric DESC LIMIT 10 for "Top 10" charts
    • Categorical charts: ORDER BY metric DESC to show largest values first
Dataset-level measures + MEASURE()

Widget expressions are usually inline aggregations ({"name": "sum(x)", "expression": "SUM(\x`)"}`). But you can also declare reusable measures on the dataset itself and reference them by name — every widget that consumes the dataset can use the same metric without redefining it.

Two ways to define measures:

  1. Dashboard-level columns (works on any dataset — SQL query or asset_name):

    json
    {
      "name": "ds_support",
      "queryLines": ["SELECT * FROM support_cases"],
      "columns": [
        {"displayName": "Total Cases",     "description": "Count of cases",
         "expression": "COUNT(`case_id`)"},
        {"displayName": "Reopen Rate %",   "description": "% of reopened cases",
         "expression": "SUM(CASE WHEN `reopened_flag` THEN 1 ELSE 0 END) * 100.0 / COUNT(`case_id`)"},
        {"displayName": "Priority Level",  "description": "Sorted priority label",
         "expression": "CASE WHEN `priority`='Critical' THEN '1-Critical' ELSE '4-Low' END"}
      ]
    }
  2. Metric-view source — if the dataset's asset_name (or FROM clause) is a UC metric view, its YAML-defined measures are already queryable. Do not redeclare them in columns. See databricks-metric-views.

Either way, widgets reference the measure by name:

json
"fields": [{"name": "measure(Total Cases)", "expression": "MEASURE(`Total Cases`)"}],
"encodings": {"value": {"fieldName": "measure(Total Cases)", "displayName": "Total Cases"}}

MEASURE(\...`)` works in counter, table, bar, line, pie, pivot — any widget that takes a field expression. Mix it with inline aggregations freely.

2) WIDGET FIELD EXPRESSIONS

CRITICAL: Field Name Matching Rule For chart, table, counter, and custom-viz widgets, each selected name in query.fields MUST exactly match its fieldName in encodings. If they don't match, the widget shows "no selected fields to visualize" error!

For custom-vega-viz, also match spec.encodings.fields[].fieldName to the Vega-Lite input field names. Set spec.data.queryName to the widget query name. The inner Vega-Lite spec reads data.name: "databricks_query" and is stored as a JSON string in spec.jsonSpec.spec. Read 6-custom-visualizations.md before generating a custom widget.

Correct pattern for aggregations:

json
// In query.fields:
{"name": "sum(spend)", "expression": "SUM(`spend`)"}

// In encodings (must match!):
{"fieldName": "sum(spend)", "displayName": "Total Spend"}

WRONG - names don't match:

json
// In query.fields:
{"name": "spend", "expression": "SUM(`spend`)"}  // name is "spend"

// In encodings:
{"fieldName": "sum(spend)", ...}  // ERROR: "sum(spend)" ≠ "spend"

Allowed expressions in widget queries (you CANNOT use CAST or other SQL in expressions):

json
{"name": "(sum|avg|count|countdistinct|min|max)(col)", "expression": "(SUM|AVG|COUNT|COUNT(DISTINCT)|MIN|MAX)(`col`)"}
{"name": "(daily|weekly|monthly)(date)", "expression": "DATE_TRUNC(\"(DAY|WEEK|MONTH)\", `date`)"}
{"name": "field", "expression": "`field`"}

If you need conditional logic or multi-field formulas, compute a derived column in the dataset SQL first.

Some widgets support additional expressions: Gantt can use FIRST(...) for status fields, and geometry map bindings require ST_ASGEOJSON(...). See the corresponding widget reference for these shapes.

3) SPARK SQL PATTERNS

  • Date math: date_sub(current_date(), N) for days, add_months(current_date(), -N) for months
  • Date truncation: DATE_TRUNC('DAY'|'WEEK'|'MONTH'|'QUARTER'|'YEAR', column)
  • AVOID INTERVAL syntax - use functions instead

4) LAYOUT (12-Column Grid, NO GAPS)

Every page must include "layoutVersion": "GRID_V1" alongside pageType.

json
{
  "name": "overview",
  "displayName": "Overview",
  "pageType": "PAGE_TYPE_CANVAS",
  "layoutVersion": "GRID_V1",
  "layout": [...]
}

Each widget has a position: {"x": 0, "y": 0, "width": 4, "height": 4}

Pick the subdivision based on the audience. The 12-column grid divides cleanly into 3, 4, or 6 columns: a 3-column layout (each widget width: 4) reduces cognitive load and fits an executive overview; a 4-column (width: 3) is the all-rounder; a 6-column (width: 2) packs the most density for technical / operations dashboards where the reader is hunting through many metrics at once.

Default rule: each row should fill width=12 exactly — no gaps. Once you're confident with the grid, you can stagger heights across columns (a tall widget on the left paired with several shorter ones on the right) so the two halves don't share row boundaries — see 4-examples.md for the pattern. Start with strict rows; relax only when the stagger reads better visually.

CORRECT:                            WRONG:
y=0: [w=12]                         y=0: [w=8]____  ← gap!
y=1: [w=4][w=4][w=4]  ← fills 12    y=1: [w=2][w=2][w=2][w=2]__  ← gap!
y=4: [w=6][w=6]       ← fills 12

Recommended widget sizes:

Widget TypeWidthHeightNotes
Text header121Full width; use SEPARATE widgets for title and subtitle
Counter/KPI43-4NEVER height=2 - too cramped!
Line/Bar/Area chart65-6Pair side-by-side to fill row
Pie chart65-6Needs space for legend
Full-width chart125-7For detailed time series
Table125-8Full width for readability

Standard dashboard structure:

text
y=0:  Title (w=12, h=1) - Dashboard title (use separate widget!)
y=1:  Subtitle (w=12, h=1) - Description (use separate widget!)
y=2:  KPIs (w=4 each, h=3) - 3 key metrics side-by-side
y=5:  Section header (w=12, h=1) - "Trends" or similar
y=6:  Charts (w=6 each, h=5) - Two charts side-by-side
y=11: Section header (w=12, h=1) - "Details"
y=12: Table (w=12, h=6) - Detailed data

5) CARDINALITY & READABILITY (CRITICAL)

Dashboard readability depends on limiting distinct values:

Dimension TypeMax ValuesExamples
Chart color/groups3-84 regions, 5 product lines, 3 tiers
Filters4-158 countries, 5 channels
High cardinalityTable onlycustomer_id, order_id, SKU

Before creating any chart with color/grouping:

  1. Check column cardinality via discover-schema or a COUNT DISTINCT query
  2. If >10 distinct values, aggregate to higher level OR use TOP-N + "Other" bucket
  3. For high-cardinality dimensions, use a table widget instead of a chart

6) QUALITY CHECKLIST

Before deploying, verify:

  1. All widget names use only alphanumeric + hyphens + underscores
  2. Every page has "layoutVersion": "GRID_V1"
  3. All rows sum to width=12 with no gaps
  4. KPIs use height 3-4, charts use height 5-6
  5. Chart dimensions have reasonable cardinality (≤8 for colors/groups)
  6. All widget query expressions reference existing dataset columns or aliases
  7. Visualization field bindings match exactly: for charts, tables, counters, and custom viz, each query.fields[].name matches its encoding fieldName (for example, both "sum(spend)"). Validate filters against their widget-specific contracts instead.
  8. Counter datasets: use disaggregated: true for 1-row datasets, disaggregated: false with aggregation for multi-row
  9. Percent values must be 0-1 for number-percent format (0.865 displays as "86.5%", don't forget to set the format). If data is 0-100, either divide by 100 in SQL or use number format instead.
  10. SQL uses Spark syntax (date_sub, not INTERVAL)
  11. All SQL queries tested via CLI and return expected data
  12. Every dataset you want filtered MUST contain the filter field — filters only affect datasets with that column in their query
  13. abbreviation: "compact" needs decimalPlaces — without it the value isn't rounded (renders $9.756278496M, not $9.76M)

Data Variance Considerations

Before creating trend charts, check if the metric has enough variance to visualize meaningfully:

sql
SELECT MIN(metric), MAX(metric), MAX(metric) - MIN(metric) as range FROM dataset

If the range is very small relative to the scale (e.g., 83-89% on a 0-100 scale), the chart will appear nearly flat. Consider:

  • Showing as KPI with delta/comparison instead of chart
  • Using a table to display exact values
  • Adjusting the visualization to focus on the variance

Related Skills

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Databricks Aibi Dashboards AI 技能有什么作用?

Create Databricks AI/BI dashboards. Must use when creating, updating, or deploying Lakeview dashboards as Databricks Dashboard have a unique json structure. CRITICAL: You MUST test ALL SQL queries via CLI BEFORE deploying. Follow guidelines strictly.

为什么在 TypingMind 中使用 Databricks Aibi Dashboards?

因为您只需安装一次,就能搭配任何模型使用。Databricks Aibi Dashboards 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Databricks Aibi Dashboards?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/databricks/databricks-agent-skills/tree/main/plugins/databricks/claude/skills/databricks-aibi-dashboards。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Databricks Aibi Dashboards?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Databricks Aibi Dashboards 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Databricks Aibi Dashboards 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Databricks Aibi Dashboards AI 技能免费吗?

databricks 已在 GitHub 上发布了该技能。请查看代码仓库了解许可条款。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇