data-programs
Skill này làm gì
Skill này biến một script lấy, nối và tính tổng dữ liệu dùng một lần thành một chương trình được lưu. Chương trình đã lưu giữ kết quả và làm mới theo lịch, để nhiều màn hình có thể dùng lại. Skill dành cho người xây bảng điều khiển và báo cáo trong ứng dụng Agent-Native.
Khi nào nên dùng
- ✓Khi một phân tích đột xuất nên trở thành nguồn dữ liệu sống để người khác dùng lại.
- ✓Khi nhiều khung nhìn liên tục chạy lại cùng một truy vấn dữ liệu và bạn muốn lưu đệm.
- ✓Khi bạn muốn một biểu đồ hoặc bảng hiển thị dữ liệu thu thập từ nhiều nguồn.
Liên kết skill
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/data-programs/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể lưu script kết hợp dữ liệu bán hàng và hỗ trợ của chúng tôi thành nguồn mà bảng điều khiển của tôi có thể làm mới không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent viết và kiểm thử script trước. Sau đó nó lưu thành một chương trình dữ liệu, chương trình này chạy, lưu đệm bảng kết quả nhỏ và làm mới theo chính sách bộ nhớ đệm.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Data Programs
A data program is a named, stored, agent-authored JS script that fetches,
joins, filters, or aggregates data — provider APIs via providerFetch /
providerFetchAll / providerSearchAll, app data via appAction, or
Resources-backed workspace files — and emits a small { rows, schema }
result that gets cached in SQL. Any app can render that result through its
own table/chart components; nothing about the primitive is analytics-specific.
This ships automatically wherever run-code is available — there is nothing
to mount, wire, or configure per app. If your app already has run-code
enabled, save-data-program / preview-data-program / run-data-program /
list-data-programs / get-data-program / delete-data-program are already
registered actions.
Why this exists
Without it, "build a live view of X" tends to end in one of two bad places:
a hardcoded action per vendor/query shape (brittle, doesn't scale to every
customer's custom fields), or re-running the same fetch/join logic from
scratch on every page view (slow, and it re-spends the same provider quota
every time someone looks at a chart). A data program is the middle ground:
write the fetch/join/aggregate logic once as ordinary run-code, save it, and
let the cache + refresh policy handle "how often does this actually need to
re-run."
Authoring workflow
- Prototype the fetch/join/aggregate logic as a normal
run-codescript and confirm it returns the rows you expect. - Change it to call
emit(rows, schema?)exactly once at the end instead of returning or printing the result. - Save it with
save-data-program({ name, title, description, code, defaultParams?, refreshMode?, refreshTtlMs?, background? }). This dry-runs the code withdefaultParamsbefore persisting and rejects the save with a structured error if it fails, so a broken program is never stored. On success it returns{ programId, rowCount, columns, sampleRows }— use that as proof the program produces the rows you expect. - Bind whatever UI needs the result. Your app's own read path calls
run-data-program({ programId, params?, forceRefresh?, includeRows? })and gets back rows/schema/cache metadata to hand to your own table/chart components — there is no dashboard-specific plumbing baked into the primitive itself. (The analytics template's"program"dashboard panel source is one such adoption, not a required pattern — see itsdata-programsskill if you want a concrete UI wiring reference.) - Iterate without persisting via
preview-data-program({ code, params? })— same dry-run path, no stored row.
The sandbox surface
Exactly the run-code globals (providerFetch, providerFetchAll,
providerSearchAll, appAction, webFetch, workspace* Resources helpers),
plus:
params— a frozen global object holding the params for this run. Read-only; mutating it throws.emit(rows, schema?)— call exactly once, at the end.rowsmust be an array of plain objects.schema, when provided, is{ name: string, type: string }[]; when omitted it's inferred from the first 50 rows (a column is"json"if rows disagree on primitive type, otherwise"number"/"string"/"boolean").console.logremains free for debugging and never interferes with parsing the emitted result.
Caps enforced on every run:
| Limit | Value |
|---|---|
| Max emitted rows | 10,000 (excess dropped, truncated: true) |
| Max emitted result size | 4 MiB (rows dropped from the end to fit; a single oversized row is a hard failure) |
| Max active programs per app | 200 |
| Minimum refresh TTL | 60,000 ms |
| Run rows kept per (program, params) | 5 most recent |
Truncation is always explicit (truncated: true) — never a silent drop.
Caching and refresh model
Every (programId, paramsHash) pair has its own run history:
| Situation | Behavior |
|---|---|
Fresh cache (younger than refreshTtlMs, or refreshMode: "manual" with a prior success) |
Returns cached rows instantly, cacheHit: true |
| Stale cache | Re-executes synchronously (25s budget for view-triggered reads, 120s for agent/manual calls), replacing the cache on success |
refreshMode: "manual" |
Only refreshes on explicit forceRefresh: true |
| No cache yet | Executes synchronously like a normal first fetch |
background: true program with no fresh cache |
Serves the last good run with stale: true and enqueues a du |
Câu hỏi thường gặp
Kết quả được lưu ở đâu?
Kết quả được lưu đệm trong cơ sở dữ liệu SQL của ứng dụng dưới dạng một tập hàng nhỏ và một schema.
Ai có thể dùng dữ liệu đã lưu?
Mọi màn hình ứng dụng hiển thị kết quả đều có thể dùng, kể cả những người dùng khác có quyền truy cập.
Tôi có cần thiết lập gì cho mỗi ứng dụng không?
Không. Tính năng này có sẵn ở bất cứ nơi nào bật tính năng chạy code, nên không cần cấu hình thêm.
Chi tiết
Mô tả gốc của tác giả
Save a run-code fetch/join/aggregate script as a stored, refreshable data source any app's own charts/tables can render, instead of a hardcoded provider action or a per-view re-fetch. Use when an ad-hoc run-code or provider-api-request analysis should become a live, cached data source other users or panels can reuse.
repo: BuilderIO/agent-native
Độ phổ biến
- Sao GitHub
- 7.6k
- Vị trí xếp hạng
- #13152
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
design-exploration
7.6kGiúp agent của bạn khám phá nhiều hướng thiết kế giao diện song song, để bạn chọn một hướng rồi tinh chỉnh thiết kế đã chọn.
visual-edit
7.6kGiúp agent của bạn mở một ứng dụng cục bộ đang chạy trong trình chỉnh sửa trực quan, để bạn xem và sửa các màn hình thật cùng nhau.
turn-into-app
7.6kBiến quy trình, bảng tính hoặc dự án thành ứng dụng trực quan có màn hình đầy đủ dữ liệu, với agent làm việc phía sau các điều khiển.
visual-plan
7.6kBiến một kế hoạch viết bằng văn bản thuần thành kế hoạch trực quan tương tác, có sơ đồ, bản đồ file, đoạn code và các câu hỏi còn mở.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.