developing-data-apps-locally
它能做什么
这项技能指导在本地编辑使用 CLI 创建或下载的 Lightdash 数据应用。适合基于 Lightdash 构建自定义数据应用的开发者。
适用场景
- ✓当你想在自己的电脑上编辑 Lightdash 数据应用时。
- ✓当你需要构建、预览或上传数据应用时。
- ✓当你想通过已链接的连接把外部 API 接入数据应用的时候。
技能链接
https://github.com/lightdash/lightdash/blob/main/packages/cli/src/handlers/apps/authoring/developing-data-apps-locally/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在本地设置我下载的 Lightdash 数据应用,预览它,并在它正常工作后上传。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能说明,数据访问只能通过 Lightdash 查询 SDK 进行,外部 API 则使用已链接的连接。然后它会逐步讲解构建、预览和上传步骤,以及上传输出中显示的检查项。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Developing Lightdash Data Apps Locally
You are editing a Lightdash data app that was created or downloaded with the Lightdash CLI.
The only way to reach data is the SDK
- All app data access goes through
@lightdash/query-sdk. Deployed apps use Lightdash's postMessage bridge;lightdash apps previewuses a loopback proxy restricted to the same SDK routes and project. Do not add directfetchor REST calls. - For the SDK surface (query builder,
useLightdash, filters, downloads), read thelightdash-data-appskill in this folder.
External HTTP APIs go through linked connections
- The one sanctioned path to a third-party API is
lightdash.externalFetch('<alias>', ...)against an external connection a project admin configured and linked to this app (see thelightdash-data-appskill). - The app's links are declared in this folder's
lightdash-app.ymlunderexternalConnections(- alias: stripe/connectionSlug: stripe-api). When the key is present, upload reconciles the app's links to match it exactly — so to link a connection that already exists in the project, add its{alias, connectionSlug}entry and upload. Do not remove entries casually: an entry removed from the list (or an empty list) unlinks on upload, and a manifest without the key leaves links unchanged. - Watch the upload output: a
connectionSlugthat doesn't exist in the target project is skipped with a warning (the app uploads, butexternalFetchon that alias fails at runtime). Linking requires either the admin-levelmanage:ExternalConnectionpermission or an admin-enabled connection plus permission to manage the target data app — if a link is skipped or forbidden, report it to the user instead of retrying. - If the app needs an API with no existing connection, stop and say so — do not vendor an HTTP client or try to reach it another way. An admin must create the connection first (in project settings, or as code:
lightdash download --include-external-connections, editlightdash/external-connections/<slug>.yml,lightdash uploadwith the secret inLIGHTDASH_EXTERNAL_CONNECTION_SECRET_<SLUG>); then it can be linked via the manifest as above.
Library boundaries — build with what's preinstalled
- The app builds against a fixed template dependency set — see
package.json(React, Recharts, d3 + d3-cloud/d3-sankey, Radix primitives, Tailwind, lucide-react, date-fns, html-to-image, jspdf, and more). Design within this set; it covers almost all data-app needs. - Adding new npm packages only works when the Lightdash organization has custom dependencies enabled — assume it does not. When disabled, upload rejects new dependency declarations. Do not attempt
pnpm addto find out; ask the user whether their organization has custom dependencies enabled before considering a new library. - Do not work around a missing library by vendoring its source into
src/, inlining minified code, or fetching code at runtime. If the template set genuinely cannot express what's asked, say so and let the user decide.
The edit → build → upload loop
Run these commands from this folder under apps/<slug>/. The upload path ../.. selects the Lightdash content root.
- Edit files under
src/only. - Run
lightdash apps validateto check the source, manifest, dependencies, external-connection aliases, and semantic references against the downloaded context. Uselightdash apps validate --buildto add the Cloud-parity Vite production build; use--liveto check against fresh project explores or--format jsonin CI. A green run reports any call sites it could not fully analyze instead of silently claiming complete coverage. lightdash upload --apps <slug> --path ../..(theslugfrom this folder'slightdash-app.yml) — the server rebuilds and serves the app. The server rebuild remains the final result that ships.
Cloud-parity local builds
lightdash apps validate --buildassemblessrc/in an isolated copy of the CLI's trusted template and invokes barevite build— it deliberately does not typecheck because the Cloud build does not typecheck.- Apps made with
lightdash apps createalready have the standard template dependencies installed. Afterlightdash download, runnpm installbefore requesting--buildifnode_modulesis absent. Validation does not install the standard dependency set implicitly. - Apps with custom dependencies are restored into the isolated build di
常见问题
我可以直接调用数据吗?
不可以。技能说明,所有数据访问都必须通过查询 SDK,而不是直接请求。
外部 API 如何工作?
管理员设置外部连接,应用在其清单文件中链接到该连接。
上传后应检查什么?
技能要求阅读上传输出,其中会警告连接名称是否不存在。
详情
作者的原始描述
Use when editing a locally created or downloaded Lightdash data app — how local editing, building, and uploading work, and what is read-only.
repo: lightdash/lightdash
热度
- GitHub 星标
- 6.2k
- 排名
- #14403
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
breakup-pr
6.2k帮你的智能体把一个大型拉取请求拆分成较小的、可堆叠的切片,每次可以审阅并合并一个。
lightdash-agent-slack-messaging
6.2k帮你的智能体根据现有证据,为 Lightdash 管理员撰写简短、友好的维护与活动报告。
developing-in-lightdash
6.2k帮你的智能体以 JSON 形式读取、创建和编辑 Lightdash 仪表板与图表,包括每种图表类型的设置。
filter-expressions
6.2k帮你的智能体为 Lightdash 指标查询编写正确的筛选表达式,包括针对自定义指标的筛选。