data-programs
できること
このスキルは、情報を取得、結合、合計する一度きりのデータのスクリプトを、保存されたプログラムに変えます。保存されたプログラムは結果を保持し、スケジュールに従って更新するので、多くの画面がそれを再利用できます。Agent-Nativeのアプリでダッシュボードやレポートを作る人向けです。
使う場面
- ✓その場の分析を、ほかの人も再利用できる生きたデータソースにすべきとき。
- ✓多くのビューが同じデータの取得を何度も実行していて、キャッシュしたいとき。
- ✓グラフや表で、複数のソースから集めたデータを表示したいとき。
スキルのリンク
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/data-programs/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“売上とサポートのデータを組み合わせるこのスクリプトを、ダッシュボードが更新できるソースとして保存してもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、まずスクリプトを書いてテストします。そのあとデータのプログラムとして保存します。プログラムは実行され、小さな結果のテーブルをキャッシュし、キャッシュのポリシーに従って更新されます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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 |
よくある質問
結果はどこに保存されますか?
結果は、アプリのSQLデータベースに、小さな行のセットとスキーマとしてキャッシュされます。
保存されたデータは誰が使えますか?
その結果を表示するどの画面でも使え、アクセス権を持つほかのユーザーも含まれます。
アプリごとに設定が必要ですか?
いいえ。コードの実行機能が有効なところならどこでも使えるので、追加の設定は不要です。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 7.6k
- ランキング
- #13152
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
design-exploration
7.6kUIの複数のデザインの方向性を並べて検討し、1つを選んでもらい、選んだデザインを磨き上げるようエージェントを支援します。
visual-edit
7.6k実行中のローカルのアプリをビジュアルエディターで開き、本物の画面をまとめて確認し編集できるようエージェントを支援します。
turn-into-app
7.6kワークフロー、スプレッドシート、プロジェクトを、画面にデータが入り、操作の裏でエージェントが働く、洗練されたビジュアルアプリに変えます。
visual-plan
7.6kプレーンテキストの計画を、図、ファイルのマップ、コードの断片、未解決の質問を含む、対話できるビジュアルな計画に変えます。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。