Logo Developing Data Apps Locally

Developing Data Apps Locally

Tổ chứcPhổ biến
lightdash
developing-data-apps-locally

Dùng khi chỉnh sửa data app Lightdash được tạo hoặc tải xuống trên máy — cách chỉnh sửa cục bộ, build và tải lên, cũng như những phần chỉ có thể đọc.

Tổng quan

Nhà phát hànhlightdash
Kho mãlightdash
Tên kỹ năngdeveloping-data-apps-locally
Sao
6.1K
Bản fork
778
Tệp đi kèm
Chỉ có hướng dẫn
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được lightdash công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Developing Data Apps Locally trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/lightdash/lightdash/tree/main/packages/cli/src/handlers/apps/authoring/developing-data-apps-locally
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lightdash/lightdash.git /tmp/lightdash
mkdir -p .claude/skills
cp -r /tmp/lightdash/packages/cli/src/handlers/apps/authoring/developing-data-apps-locally .claude/skills/developing-data-apps-locally
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Developing Data Apps Locally trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Developing Data Apps Locally ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Developing Data Apps Locally với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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 preview uses a loopback proxy restricted to the same SDK routes and project. Do not add direct fetch or REST calls.
  • For the SDK surface (query builder, useLightdash, filters, downloads), read the lightdash-data-app skill 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 the lightdash-data-app skill).
  • The app's links are declared in this folder's lightdash-app.yml under externalConnections (- 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 connectionSlug that doesn't exist in the target project is skipped with a warning (the app uploads, but externalFetch on that alias fails at runtime). Linking requires either the admin-level manage:ExternalConnection permission 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, edit lightdash/external-connections/<slug>.yml, lightdash upload with the secret in LIGHTDASH_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 add to 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.

  1. Edit files under src/ only.
  2. Run lightdash apps validate to check the source, manifest, dependencies, external-connection aliases, and semantic references against the downloaded context. Use lightdash apps validate --build to add the Cloud-parity Vite production build; use --live to check against fresh project explores or --format json in CI. A green run reports any call sites it could not fully analyze instead of silently claiming complete coverage.
  3. lightdash upload --apps <slug> --path ../.. (the slug from this folder's lightdash-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 --build assembles src/ in an isolated copy of the CLI's trusted template and invokes bare vite build — it deliberately does not typecheck because the Cloud build does not typecheck.
  • Apps made with lightdash apps create already have the standard template dependencies installed. After lightdash download, run npm install before requesting --build if node_modules is absent. Validation does not install the standard dependency set implicitly.
  • Apps with custom dependencies are restored into the isolated build directory with pnpm install --frozen-lockfile --ignore-scripts, matching Cloud. An install or Vite failure is a validation error, includes the command output, and exits non-zero.
  • Do not modify machine configuration, .npmrc files, registry settings, or the project's dependency files to force the check to pass. The server rebuild on upload remains authoritative.
  • Exception — adding a dependency (only for organizations with custom dependencies enabled — see "Library boundaries" above). This is the one workflow that still requires pnpm: upload rejects new dependencies unless pnpm-lock.yaml was regenerated to match package.json, so dependency resolution MUST succeed locally. Use pnpm add <pkg> — prefixed with Socket Firewall when available (sfw pnpm add <pkg>; check with command -v sfw) to block known-malicious packages — or after editing package.json run pnpm install --lockfile-only (updates the lockfile without installing). If resolution fails, stop and report the exact pnpm error to the user — never hand-edit package.json and proceed without the lockfile; the upload will fail.
  • Never run dependency lifecycle scripts. The app's .npmrc sets ignore-scripts=true — leave it. A downloaded app can be authored by someone else, and their dependencies' install scripts must not execute on this machine. Explicit npm run build/npm run dev and pnpm build/pnpm dev commands still work.

Preview locally against real data

lightdash apps preview (run in this folder) starts a local dev server that renders the app against the Lightdash instance you are logged into, using your CLI credential. Requires npm install to have succeeded; if it hasn't, skip preview and rely on the server rebuild.

  • Preview does not pass your API key to vite or browser code: the CLI holds it behind a loopback proxy that only forwards the SDK route allowlist (query execution, result polling, downloads, current user), pinned to this app's project. No credential is written to the app folder. Never put a real key in .env.local or any VITE_-prefixed var — anything VITE_* is inlined into the page and readable by any code running there.
  • There is no manual npm run dev equivalent with data access — bare npm run dev starts the page but API calls fail with 401. Always use lightdash apps preview.
  • An endpoint that works in preview but not when deployed means it is outside the data-app SDK surface — use the SDK, don't work around the proxy.
  • Declared custom dependencies work in preview too — the dev server bundles whatever the dependency install put in node_modules, the same set the server installs on upload.
  • Preview shows your data under your permissions and user attributes — viewers of the deployed app may see different data. Do not treat preview as verification of viewer-specific behavior.
  • Local preview keeps the credential out of the app environment/browser but is not a sandbox: vite and the downloaded tooling execute as your OS user, can read that user's files (including the existing CLI config), and the app can read the query results it requests. Only preview source and dependencies you trust.
  • The dev server applies a CSP that forces API traffic through its same-origin proxy, but script-src stays permissive (vite needs it), so preview is not a full stand-in for the deployed Content-Security-Policy. A library that works in preview may still be blocked when deployed; the app page after upload is the final check.
  • Host-mediated features are not emulated locally. External connections (externalFetch), data-app-viz row/field context, Google Sheets export, the product inspector, and product URL-state integration must be tested after upload.

Project context (read-only reference)

.lightdash/context/ holds a point-in-time snapshot of the source project:

  • models/ — the semantic layer, one YAML file per model: the real tables/dimensions/metrics you can query. Use these exact names. Start with models/_index.md, then read only the model files you need. (Apps downloaded with an older CLI carry the whole semantic layer in semantic-layer.yml instead and have no models/.)
  • parameters.yml — project-wide parameters (if any).
  • prompt-history.md — the prompts used to generate each version.
  • theme/ — styling instructions and assets.

Read-only files

Most root config is reference only — editing it has no effect because the server rebuilds against its trusted template. This applies to vite.config.js, tailwind.config.js, tsconfig.json, and other build/tooling files.

package.json is partially editable only when custom dependencies are enabled for the Lightdash organization — see "Library boundaries" above; treat it as read-only otherwise. When enabled, you may add npm dependencies with pnpm add <pkg> — registry packages with plain semver versions only (no git/file/url specs), up to 60 direct dependencies, and pnpm-lock.yaml must be updated alongside (see the exception above — this is the one step that still requires pnpm and must succeed locally). On upload the CLI warns which packages will be installed in the build sandbox; install scripts never run. Other root config (vite/tailwind/tsconfig) remains read-only.

Câu hỏi thường gặp

Kỹ năng AI Developing Data Apps Locally làm được gì?

Dùng khi chỉnh sửa data app Lightdash được tạo hoặc tải xuống trên máy — cách chỉnh sửa cục bộ, build và tải lên, cũng như những phần chỉ có thể đọc.

Vì sao nên dùng Developing Data Apps Locally trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Developing Data Apps Locally là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Developing Data Apps Locally trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/lightdash/lightdash/tree/main/packages/cli/src/handlers/apps/authoring/developing-data-apps-locally. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Developing Data Apps Locally?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Developing Data Apps Locally với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Developing Data Apps Locally với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Developing Data Apps Locally có miễn phí không?

Kỹ năng này được lightdash phát hành trên GitHub. Hãy xem điều khoản giấy phép trong kho mã. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇