← ClaudeAtlas

artifact-data-loadinglisted

Fit data into a self-contained page - pre-aggregating at the source, choosing a grain, embedding formats and their real byte costs, precision trimming, pagination versus virtualization, and offering a download for the full detail. Use when the data will not fit, the page is slow to open, or you are about to embed raw rows. Trigger on "too much data", "page is huge", "embed the data", "how do I get the rows in", "pagination", "virtualize", "download CSV", "aggregate".
Lukehle/chartroom · ★ 0 · Data & Documents · score 70
Install: claude install-skill Lukehle/chartroom
# Artifact data loading A page is one file with a 16MB ceiling and no network. So the question is never "how do I ship all the rows" — it is **"what is the smallest dataset that answers the question."** Almost always, the answer is far smaller than the raw data, and the reduction happens *before* embedding, not after. --- ## Aggregate at the source first The highest-leverage step, and it happens in SQL, not in the page. ```sql -- WRONG: 180,000 rows embedded so the page can group them SELECT * FROM gl WHERE period = '2026-07' -- RIGHT: 40 rows; the page renders, it does not compute SELECT account, account_name, SUM(amount) AS amount, COUNT(*) AS txn_count, SUM(amount) - SUM(prior_amount) AS variance FROM gl_with_prior WHERE period = '2026-07' GROUP BY account, account_name HAVING ABS(SUM(amount) - SUM(prior_amount)) > 25000 ``` Ship the grain the visual needs. A chart with 40 marks needs 40 rows — embedding 180,000 so the browser can produce those 40 is pure cost. **Ship a second, coarser aggregate for drill-down** rather than the detail: top 10 transactions per account, not every transaction. Full detail belongs behind a download. --- ## Choosing the grain Work backwards from the marks: | Visual | Rows needed | |---|---| | KPI tile | 1 | | Bridge / waterfall | one per bar (5-12) | | Monthly time series, 3 years | 36 per series | | Cohort heatmap, 24 ×