mcpField
D
developing-in-lightdash

developing-in-lightdash

github.com/lightdashData & databases6.2k470 installsUpdated today
Repository

About developing-in-lightdash

Developing in Lightdash is a skill for CLI users and writeback sandboxes building and deploying Lightdash analytics projects. It covers the semantic layer, charts and dashboards, and CLI workflows for managing content as code.

Key features

  1. 01Define metrics, dimensions, and joins
  2. 02Create and edit charts and dashboards
  3. 03Deploy and preview projects with the CLI
  4. 04Download, upload, and lint content
  5. 05Manage data apps and custom chart types

Use cases

  1. 01Maintain dbt or Lightdash YAML projects
  2. 02Manage charts and dashboards as code
  3. 03Inspect warehouse metadata to build a semantic layer
  4. 04Deploy analytics projects and preview changes

MCP support

The README mentions creating or editing charts and dashboards through the Lightdash MCP server. This skill provides guidance for those Lightdash development tasks.

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/lightdash/lightdash --skill developing-in-lightdash

After installing, type/developing-in-lightdashin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

resources/
big-number-chart-reference.md
cartesian-chart-reference.md
cli-reference.md
content-as-code-reference.md
creating-from-warehouse-catalog.md
custom-viz-reference.md
dashboard-best-practices.md
dashboard-reference.md
data-app-themes-reference.md
dimensions-reference.md
funnel-chart-reference.md
gauge-chart-reference.md
joins-reference.md
map-chart-reference.md
metrics-reference.md
period-over-period-reference.md
pie-chart-reference.md
sankey-chart-reference.md
sql-chart-reference.md
table-chart-reference.md
tables-reference.md
treemap-chart-reference.md
user-attributes-reference.md
workflows-reference.md

Details

From the project README

Developing in Lightdash

For CLI users and writeback sandboxes working with YAML and dbt files.

Build and deploy Lightdash analytics projects. This skill covers the semantic layer (metrics, dimensions, joins) and content (charts, dashboards).

When to Use

  • Working with Lightdash YAML files (charts, dashboards, models as code)
  • Using the lightdash CLI (deploy, upload, download, preview, lint, warehouse-catalog, sql)
  • Defining metrics, dimensions, joins, or tables in dbt or pure Lightdash projects
  • Creating or editing charts and dashboards as code
  • Downloading, uploading, or locally developing data apps (enterprise)
  • Creating, downloading, editing, or uploading custom chart types built in Chart Studio (enterprise)
  • Creating, editing, migrating, downloading, or uploading organization Data App themes

Don't use for: Developing the Lightdash application itself (use the codebase CLAUDE.md), general dbt work without Lightdash metadata, or raw SQL unrelated to Lightdash models.

What You Can Do

TaskCommandsReferences
Create a pure Lightdash project from warehouse metadataUse Lightdash or an already-authenticated warehouse CLI to inspect catalog metadata and aggregate profilesCreating from a Warehouse Catalog
Discover warehouse tables and fieldslightdash warehouse-catalog --jsonCLI Reference
Explore data warehouse valueslightdash sql to execute raw sql, read .csv resultsCLI Reference
Define metrics & dimensionsEdit dbt YAML or Lightdash YAMLMetrics, Dimensions
Create or edit chartsUI, Lightdash AI agent, MCP, or YAML via lightdash download/uploadContent Workflow, Chart Types
Add period comparisonsAdd PoP additional metrics to chart YAMLPeriod over Period
Create or edit dashboardsUI, Lightdash AI agent, MCP, or YAML via lightdash download/uploadContent Workflow, Dashboard Reference
Manage content as code across project and organization resourceslightdash download, lightdash uploadContent as Code
Manage data apps as code (enterprise)lightdash download --apps <ref> (one app) or --include-apps (all), edit bundle, lightdash upload --apps <ref>; local dev via lightdash apps create/preview/validateData Apps, Content as Code
Build or edit a custom chart type (enterprise)lightdash apps create "<name>" --chart-type or lightdash download --chart-types <ref>, edit chart-types/<slug>/src/, lightdash upload --chart-types <ref>Custom Chart Types
Manage organization Data App themes as codelightdash download --organization, edit themes/<slug>/, lightdash upload --organizationData App Themes
Manage data-app external connections (enterprise)lightdash download --include-external-connections, edit YAML, lightdash uploadContent as Code
Lint yaml fileslightdash lintCLI Reference
Set warehouse connectionlightdash set-warehouse from profiles.ymlCLI Reference
Deploy changeslightdash deploy (semantic layer), lightdash upload (content)CLI Reference
Test changeslightdash previewWorkflows

Common Mistakes

MistakeConsequencePrevention
Guessing filter valuesCase mismatches ('Payment' vs 'payment') cause charts to silently return no dataAlways run lightdash sql "SELECT DISTINCT column FROM table LIMIT 50" -o values.csv and use exact values
Not updating dashboard tiles after renaming a chartDashboard tile still shows old title — title and chartName are independent overrides that do NOT auto-updateDownload the dashboard, find tiles with matching chartSlug, update title and chartName to match (see checklist)
Including unused dimensions in metricQuery"Results may be incorrect" warning — extra dimensions change SQL grouping and produce wrong numbersEvery dimension in metricQuery.dimensions must appear in the chart config. For cartesian: layout.xField, layout.yField, or pivotConfig.columns
Unsorted YAML keyslightdash upload warns "unsorted YAML keys" and diffs become noisyAlways sort keys alphabetically at every nesting level — the CLI writes with sortKeys: true
Deploying to wrong projectOverwrites production contentAlways run lightdash config get-project before deploying
Downloading content into the dbt project and committing itThe repository gains dashboard, chart, or data app files nobody maintains, and they go stale as soon as someone edits the content in the UIDownload to a scratch directory, upload, then delete it. Commit content only when the user asks or the repository already tracks it (see Content Workflow)
Missing contentType fieldContent type can't be determined without relying on directory structureAlways include contentType: chart, contentType: dashboard, or contentType: sql_chart at the top level
Adding --include-apps to an --apps <ref> selection--include-apps always requests ALL project apps (capped at 50), so the command downloads every app plus the ref — not just the one app--apps <ref> alone downloads/uploads only that app (by slug, app URL, or UUID). Use --include-apps only when you want every app
Editing a data app without reading its bundled skillsApp code violates the SDK-only data access and dependency boundaries (direct fetch, pnpm add, vendored libraries) and the upload rejects or the app breaks when deployedEvery app bundle ships the developing-data-apps-locally and lightdash-data-app skills — read them before editing files in an app folder (see Data Apps)
Building a reusable chart as a Vega-Lite custom chartThe visualization lives inside one saved chart and can't be reused or picked from the explorer's chart type pickerFor a new reusable visualization, build a custom chart type (see Custom Chart Types). Use Vega-Lite only for existing chartConfig.type: custom charts or when the project has no custom chart types (enterprise)
Editing a chart type without reading its bundled skillsThe component queries or fetches data itself, or its vizSchema drifts from what src/ reads, so the chart type breaks or never appears in the chart type pickerEvery chart type folder ships AGENTS.md plus the reusable-visualization and developing-chart-types-locally skills — read all three before editing files in chart-types/<slug>/
Inventing a theme-only CLI command or treating a missing folder as deletionThe command does not exist, or a supposedly deleted remote theme returns on the next downloadUse organization download/upload, and read Data App Themes before changing themes/

Before You Start

Every lightdash download or lightdash upload follows the Content Workflow: files go in a scratch directory, not the user's repository, and are not committed unless the user asks.

When a task uses lightdash download or lightdash upload, especially for bulk edits, spaces and access, scheduled content, AI agents, data apps, custom chart types, organization themes, external connections, users, groups, or custom roles, read and follow Content as Code first. Project and organization content require separate commands, and a default download is not a complete snapshot.

For any task that creates, edits, migrates, downloads, uploads, or tests an organization Data App theme, always read and follow Data App Themes before touching themes/. Theme packages are strict multi-file resources, organization upload has no theme-only mode, and lightdash lint does not validate them.

Check Your Target Project

Always verify which project you're deploying to. Deploying to the wrong project can overwrite production content.

lightdash config get-project        # Show current project
lightdash config list-projects      # List available projects
lightdash config set-project --name "My Project"  # Switch project
Detect Your Project Type

The YAML syntax differs significantly between project types.

TypeDetectionKey Difference
dbt ProjectHas dbt_project.ymlMetadata nested under meta:
dbt Fusion / dbt 1.10+Has dbt_project.yml, uses dbt Fusion or dbt >= 1.10Metadata nested under config: meta:
Pure LightdashHas lightdash.config.yml, no dbtTop-level properties
ls dbt_project.yml 2>/dev/null && echo "dbt project" || echo "Not dbt"
ls lightdash.config.yml 2>/dev/null && echo "Pure Lightdash" || echo "Not pure Lightdash"

dbt Fusion / dbt 1.10+: Lightdash metadata must be nested under config: meta: instead of meta:. The properties are identical — only the nesting changes. Example:

models:
  - name: orders
    config:
      meta:
        metrics:
          total_revenue:
            type: sum
            sql: "${TABLE}.amount"
Syntax Comparison

dbt YAML (metadata under meta:):

models:
  - name: orders
    meta:
      metrics:
        total_revenue:
          type: sum
          sql: "${TABLE}.amount"
    columns:
      - name: status
        meta:
          dimension:
            type: string

Pure Lightdash YAML (top-level):

type: model
name: orders
sql_from: 'DB.SCHEMA.ORDERS'

metrics:
  total_revenue:
    type: sum
    sql: ${TABLE}.amount

dimensions:
  - name: status
    sql: ${TABLE}.STATUS
    type: string

Setting Up Warehouse Connection

If the project needs a different warehouse connection (e.g., switching from Postgres to BigQuery), update it from your profiles.yml:

lightdash set-warehouse --project-dir ./dbt --profiles-dir ./profiles --assume-yes

This reads credentials from profiles.yml, updates the warehouse connection on the currently selected project, and triggers a recompile. Run this before lightdash deploy.

To target a specific project:

lightdash set-warehouse --project-dir ./dbt --profiles-dir ./profiles --project <uuid> --assume-yes

Core Workflows

Verify Filter Values Before Using Them

CRITICAL: Never guess filter values. Case mismatches (e.g., 'Payment' vs 'payment') cause charts to silently return no data.

Filters are case-sensitive by default. The case_sensitive key can override this in order of priority:

  • Dimension metadata
  • Model/explore metadata
  • lightdash.config.yml defaults.case_sensitive

Before writing any string filter, query actual values from the warehouse:

lightdash sql "SELECT DISTINCT category FROM payments LIMIT 50" -o category_values.csv

Read the CSV and use the exact values in your filter YAML. This applies to all equals/notEquals filters with string values — in charts and dashboards.

Editing Metrics & Dimensions
  1. Find the model YAML file (dbt: models/*.yml, pure Lightdash: lightdash/models/*.yml)
  2. Edit metrics/dimensions using the appropriate syntax for your project type
  3. Validate: lightdash lint (pure Lightdash) or dbt compile (dbt projects)
  4. Deploy: lightdash deploy

See Metrics Reference and Dimensions Reference for configuration options.

Creating a Pure Lightdash Project from a Warehouse Catalog

When the prepared project has no usable dbt project and the task is to bootstrap a semantic layer from warehouse metadata, always read and follow Creating from a Warehouse Catalog before inspecting data or writing YAML. This applies whether warehouse access comes from the selected Lightdash project or an already-authenticated warehouse CLI such as Snowflake CLI or bq. Do not use that workflow when an existing dbt semantic layer can be extended.

Content Workflow

This is the one loop for charts, dashboards, data apps, custom chart types, and other content. The sections below add only what is specific to each resource.

Creating content. Charts and dashboards can be created in the Lightdash UI, by a Lightdash AI agent, through the Lightdash MCP server, or as YAML with the CLI. All of these are equally valid; follow the user's preference.

Lightdash is the source of truth. Downloaded files are temporary working copies, not files to commit. To edit content as files, or to create it as YAML:

  1. Confirm the target: lightdash config get-project
  2. Download into a scratch directory outside the user's repository, never into the dbt project:
    LD_DIR="$(mktemp -d)/lightdash"
    lightdash download --dashboards executive-summary --path "$LD_DIR"   # or --charts <slug>, --apps <ref>, ...
    
    To create content, skip the download and write new YAML in $LD_DIR.
  3. Edit the files in $LD_DIR, working through the checklist below
  4. Lint: lightdash lint --path "$LD_DIR"
  5. Upload with the same selectors: lightdash upload --dashboards executive-summary --path "$LD_DIR"
  6. Delete $LD_DIR. Do not copy the files into the repository, git add them, or commit them.

For bulk or cross-scope changes (spaces and access, users, groups, roles, scheduled content, AI agents), follow the Agent-Safe Workflow in Content as Code instead.

When content belongs in git. Only when the user asks for it or the repository already tracks content (for example, git ls-files lightdash/ returns content files). That covers version-controlled templates, CI/CD deploys of content, and strict change management with code review. See Edit dashboards with agents. This applies only to content: dbt models, metrics, dimensions, and other semantic-layer YAML do live in the repository and ship with lightdash deploy.

Chart and Dashboard Checklist
  • Filter values: if you added or changed a string filter, query the real values first (see Verify Filter Values).
  • Dashboard tile titles: a saved_chart tile's title and chartName are independent overrides and do NOT auto-update when a chart is renamed. If you change a chart's name or purpose, download every dashboard with a tile whose chartSlug matches, update both properties, and upload those dashboards too:
    tiles:
      - type: saved_chart
        properties:
          chartSlug: total-revenue-kpi
          title: "Gross Profit"        # ← Update this when chart name/purpose changes
          chartName: "Gross Profit"    # ← Update this too
    
  • Chart config: see Chart Types and the Dashboard Reference.
Working with Data Apps (Enterprise)

Data apps are multi-file React bundles under apps/<app-folder>/ with a lightdash-app.yml manifest — not single YAML files. Full flag semantics and manifest details: Content as Code.

Apps follow the Content Workflow: work in a scratch directory and do not commit the bundle unless the user asks. The commands below are the app-specific flags.

Download one app — --apps <ref> alone is the complete command (ref = slug, app URL, or UUID; also finds apps not added to any space):

lightdash download --apps revenue-explorer --path "$LD_DIR"

Never add --include-apps to "scope" the download — it always requests ALL project apps (see Common Mistakes).

Download all apps: lightdash download --include-apps (capped at 50; raise with --apps-limit <n>). Add --apps-only to skip charts, dashboards, and spaces.

Upload:

lightdash upload --apps revenue-explorer --path "$LD_DIR"   # one app (slug = folder name, URL, or UUID)
lightdash upload --include-apps --path "$LD_DIR"            # every app folder on disk
  • --app-space <spaceRef> — space (slug or UUID) for apps this upload creates; existing apps keep their space.
  • --create-new — create a fresh app (new slug) instead of updating the app referenced in lightdash-app.yml.
  • --allow-custom-dependencies — required for non-interactive uploads of apps that declare custom npm dependencies.

Develop locally with the lightdash apps subcommand group:

lightdash apps create "Revenue Explorer" --path "$LD_DIR"   # scaffold a new app under $LD_DIR/apps/
lightdash apps preview                     # run the app locally against your real Lightdash instance, authenticated as you
lightdash apps validate                    # check source, manifest, dependencies, and semantic-layer references

Every created or downloaded app bundle ships its own skills inside the app folder:

  • developing-data-apps-locally — the edit → validate → upload loop, local preview, SDK-only data access, and dependency boundaries
  • lightdash-data-app — the @lightdash/query-sdk reference for the app's source code

When editing files inside an app folder, read those bundled skills first. They are version-matched to the app and authoritative for local development — this skill only covers moving apps between disk and Lightdash.

Working with Custom Chart Types (Enterprise)

A custom chart type is a reusable visualization built in Chart Studio: one React component that Lightdash hands query results and settings to, offered in the explorer's chart type picker for every chart in the project. On disk it is a multi-file bundle under chart-types/<slug>/ with a lightdash-app.yml manifest whose vizSchema declares the fields and options the component reads. It is not a data app (it runs no query of its own) and not the legacy Vega-Lite custom chart.

Chart types follow the Content Workflow: work in a scratch directory and do not commit the bundle unless the user asks.

Create one locally:

lightdash apps create "Radial Gauge" --chart-type --path "$LD_DIR"   # scaffolds $LD_DIR/chart-types/radial-gauge/

Download — --chart-types <ref> alone is the complete command (ref = slug, URL, or UUID):

lightdash download --chart-types radial-gauge --path "$LD_DIR"
lightdash download --include-chart-types   # every chart type in the project (capped at 50; raise with --chart-types-limit <n>)
lightdash download --chart-types-only      # chart types only, skipping charts, dashboards, and spaces

Downloading a chart that renders with a custom chart type also downloads that chart type. In chart YAML the binding is chartConfig.type: data_app_viz with config.dataAppVizSlug, fieldMapping, and optionValues.

Upload:

lightdash upload --chart-types radial-gauge --path "$LD_DIR"   # one chart type (slug = folder name, URL, or UUID)
lightdash upload --include-chart-types --path "$LD_DIR"        # every chart type folder on disk

A chart YAML that binds to a chart type by dataAppVizSlug fails to upload unless that chart type exists in the target project. Upload the chart type first, or pass --chart-types <ref> in the same run (chart types upload before charts).

Edit inside the folder. Change into chart-types/<slug>/ and read its AGENTS.md plus the reusable-visualization and developing-chart-types-locally skills before touching src/:

  • reusable-visualization — the component contract: useVizContext() is the only channel to the host, and the component never queries or fetches anything itself
  • developing-chart-types-locally — keeping vizSchema in lockstep with the component, lightdash apps validate --build, the fixture preview, and the upload-and-verify loop

Those files are version-matched to the chart type and authoritative for editing it. This skill only covers moving chart types between disk and Lightdash.

Working with Organization Data App Themes

Organization Data App themes are multi-file packages under themes/<slug>/ and participate automatically in lightdash download --organization and lightdash upload --organization. They do not have a standalone command group or theme-specific selectors.

Before creating, editing, migrating, synchronizing, or testing a theme, read and follow Data App Themes for the manifest contract, asset rules, synchronization behavior, and generation boundaries.

Testing with Preview

For larger changes, test in isolation:

lightdash preview --name "my-feature"
# Make changes and iterate
lightdash stop-preview --name "my-feature"

CLI Quick Reference

CommandPurpose
lightdash deploySync semantic layer (metrics, dimensions)
lightdash uploadUpload charts/dashboards
lightdash downloadDownload charts/dashboards as YAML
lightdash lintValidate YAML locally
lightdash previewCreate temporary test project
lightdash warehouse-catalog --jsonDiscover raw warehouse tables
lightdash sql "..." -o file.csvRun SQL queries against warehouse
lightdash run-chart -p chart.ymlExecute chart YAML query against warehouse
lightdash apps create <name>Scaffold a new data app locally (enterprise)
lightdash apps create <name> --chart-typeScaffold a new custom chart type locally (enterprise)
lightdash apps previewRun a data app locally against your Lightdash instance
lightdash apps validateValidate data app or chart type source, manifest, and semantic references
lightdash download --chart-types <ref> / lightdash upload --chart-types <ref>Move custom chart types between disk and Lightdash (enterprise)

See CLI Reference for full command documentation.

Semantic Layer

The semantic layer defines your data model. See individual references for full configuration:

Chart Types

All charts share a common base structure:

chartConfig:
  config: {}        # Type-specific — see individual references
  type: <type>
contentType: chart              # Required: chart, dashboard, or sql_chart
dashboardSlug: my-dashboard  # Optional: scopes chart to dashboard (won't appear in space)
metricQuery:
  dimensions:
    - my_explore_category
  exploreName: my_explore     # Required: which explore to query
  filters: {}
  limit: 500
  metrics:
    - my_explore_total_sales
  sorts: []
name: "Chart Name"
slug: unique-chart-slug
spaceSlug: target-space
tableConfig:
  columnOrder: []
tableName: my_explore           # Required: top-level explore/table name
version: 1

Key ordering: All YAML keys must be sorted alphabetically at every nesting level. The CLI writes files with sortKeys: true and warns on upload if keys are unsorted. When writing or editing YAML by hand, keep keys in alphabetical order to avoid warnings and noisy diffs.

Chart scoping: Use spaceSlug only for shared charts. Add dashboardSlug to scope a chart to a specific dashboard (it won't appear in the space).

Nested spaces: Spaces can be nested. In YAML, spaceSlug uses parent/child syntax to address a sub-space — the / denotes hierarchy. Examples:

spaceSlug: sales              # Top-level space "sales"
spaceSlug: sales/maps         # Sub-space "maps" inside "sales"
spaceSlug: sales/eu/forecasts # Deeper nesting works the same way

Each path segment must be the slug of an existing (or to-be-created) space at that level. A bare slug like sales-maps is a flat top-level space, NOT a sub-space — the slash is the only thing that creates the hierarchy.

Choosing the Right Chart Type
Data PatternRecommended ChartWhy
Trends over timeLine or area (cartesian)Shows continuous change with time on X-axis
Category comparisonsBar (cartesian)Easy visual comparison between discrete categories
Part-of-whole relationshipspie or treemapShows proportions summing to 100%
Single KPI metricbig_numberFocuses attention on one important value
Conversion stagesfunnelVisualizes drop-off between sequential steps
Progress toward targetgaugeShows current value relative to goal
Geographic datamapPlots data points or regions on a map
Flow between categoriessankeyShows how values move from source to target nodes
Detailed recordstableDisplays raw data with sorting and formatting
Visualization none of the above coverCustom chart typeReusable React component offered in the chart type picker — see Custom Chart Types
Vega-Lite chartcustom (legacy)For charts already saved with chartConfig.type: custom, or projects without custom chart types (enterprise)
TypeUse CaseReference
cartesianBar, line, area, scatterCartesian
pieParts of wholePie
tableData tablesTable
big_numberKPIsBig Number
funnelConversion funnelsFunnel
gaugeProgress indicatorsGauge
treemapHierarchical dataTreemap
mapGeographic dataMap
sankeyFlow diagramsSankey
customLegacy Vega-Lite custom chartCustom Viz
data_app_vizChart rendered by a custom chart typeCustom Chart Types

A SQL chart (contentType: sql_chart) is saved from raw warehouse SQL instead of an explore. See SQL Chart Reference.

Dashboards

Dashboards arrange charts and content in a grid layout. See Dashboard Reference for YAML structure, tile types, tabs, and filters.

Exploring the Warehouse

Use lightdash sql to explore data when building models:

# Preview table structure
lightdash sql "SELECT * FROM orders LIMIT 5" -o preview.csv

# Check distinct values for a dimension
lightdash sql "SELECT DISTINCT status FROM orders" -o statuses.csv

# Test metric calculations
lightdash sql "SELECT SUM(amount) FROM orders" -o test.csv

Workflow Patterns

PatternWhen to Use
Direct (deploy + upload)Solo dev, rapid iteration
Preview-FirstTeam, complex changes
CI/CDAutomated on merge

See Workflows Reference for detailed examples and CI/CD configurations.

Resources

Semantic Layer
Charts
Dashboards & Workflows
External

Comments

Markdown supported