# Building good boards: what we learned

This is the practical guide for anyone building, remixing or reviewing a DashRemix board, by hand or with an AI
agent. The rules in `docs/boards/README.md` (the definition of done) say *what* a board must have. This guide says
*why*, and lists the mistakes we actually saw when 33 boards were built at once by agents, so you can skip them.

Every point below comes from a real board that passed its automated checks and was still wrong for the person
using it. Checks catch broken boards; only these habits catch misleading ones.

## 1. Start from the person's question, not the data

- **Write the job sentence first.** "When I ___, I want to ___, so I can ___." If you can't, the board isn't ready.
- **The first screen answers one question with a number.** "Am I on track for my goals this quarter?" → "7 of 9 on
  track". A hero that says "Programs: 1" or "Brokerage activity rows: 214" answers nothing.
- **Lead with what needs doing.** Points & Miles should lead with "1,200 miles expire in 30 days", not a count of
  programs. Event Planning should lead with overdue tasks, not a pending-vs-received split.
- **The title is the question.** "Is the house keeping up?" beats "Maintenance overview".

## 2. Every number gets a comparison, and the right colour

- A headline number without a comparison (budget, limit, last period, target) is decoration. Add one or drop it.
- **Say which way is good.** Spending, costs, open questions, overdue items, fees, cost per meal: `good=down`. A
  board that shows "+$400 cloud spend" in green tells the person the opposite of the truth.

  ```
  ::: stat label="Cloud spend" metric=spend.month field=total good=down
  ```
- **Format for what it is.** Counts aren't money: charts of counts, ratings or hours need `yfmt=num`, or the axis
  shows `$`. Ratios need decimals (a debt-service ratio of 0.75 against a 1.25 target must not show as "1 vs 1").
  Prices per unit need cents (a rise from $0.14 to $0.17 per kWh vanishes when rounded to dollars).
- **Wait for enough data.** Don't show "down 50%" from two check-ins to one. Set a minimum count before a comparison
  appears.
- **Use the board's currency everywhere**, deltas and captions included. Test with a non-USD sample.

## 3. Insights name the thing and its figure

An insight is what the person would want a friend to tell them. "Some items need attention" is useless.
"Your Vanguard 1099-B is still missing; last year it arrived by {date:2025-02-14}" is useful.

- Name the item: the assignment, the vaccine, the module, the source, the subscription.
- Put every figure in a text token so it's formatted in the person's own style and currency:
  `{money:1234.5}`, `{num:36}`, `{pct:0.12}`, `{date:2025-12-03}`, `{month:2025-12}`. Never pre-format numbers in SQL.
- Say the comparison: "{num:36} guests confirmed for {num:30} seats", not "over capacity".
- Get plurals right ("1 agreement", "1 h"). Readers notice.
- Severity matches the news: a win is a positive finding, not a warning.

## 4. Sample data has to tell a story

The sample is the board's first impression and its test bed.

- **Realistic size.** 6-12 months, enough rows that trends and comparisons mean something. A one-month sample makes
  every chart a dot and every comparison empty.
- **Plant findings** a person in that situation would really hit (a price rise, a missed clean, a document that
  didn't arrive). Tell the story in `data/sample/STORY.md` and list each finding in `data/sample/story.yaml` (id,
  kind, subject, metric: see `dashboards/personal-finance/data/sample/story.yaml`), written by the sample script.
  `dashremix eval` reads `story.yaml` and fails when the board's insights miss one; a finding only in STORY.md is
  never checked.
- **Fictional, deterministic, labelled.** Generated by a script with a seed; no real people or companies.
- **The board must install with its sample.** Two boards passed every check and installed empty, because the
  person-facing `data/inputs.yaml` didn't mirror the sample's. Check the hero isn't blank right after installing.

## 5. Importers read real files, or say they don't

- **Fixtures are copies of real export layouts** (real column headers, fictional rows), at least five rows, kept in
  `data/fixtures/<layout>/` with a `fixture.yaml` naming the source it really is. Never point a fixture at the sample,
  and never invent a "Sortly export" you haven't seen. If no real layout is known, say plainly the board is a
  hand-kept list, and read a generic CSV or spreadsheet.
- **One malformed fixture** per importer: skipped rows are counted and shown, never guessed.
- **Rows never silently vanish.** Rows read = imported + skipped + reported. Crypto exports full of transfers and
  staking rows must not abort the import; record them as non-disposals or "to review".
- **Never overwrite the person's data on an error.** An import that fails leaves the last good database in place.
- **Reuse shared parsers** (bank files, calendars) instead of copying one into your board.
- **Mind the engine.** Boards run on older SQLite builds and in the browser: compute dates once in a CTE instead of
  nesting macros deeply, and avoid `ln`, `exp` and `pow`.

## 6. Use the standard, extend it properly

- Read a published standard at a pinned version. If you need a new table or field, propose a **minor** version of
  the standard (with a conformance check) instead of filling private `d_`/`x_` tables from imported files.
  Category scores for reviews, CI runs, sprint snapshots and funnel attribution all belong in a standard.
- Some boards really read two standards (a rental ledger reads rental and bank data). Pinning more than one standard
  is planned but not built yet: until it is, pin the main one and say in your pull request which other standard the
  board reads.
- Write import problems to the standard's issues table so the quality page can show them.

## 7. Privacy that keeps the board useful

- The privacy blur hides what's on screen; it doesn't need you to delete data. Two boards dropped calendar titles
  ("Field trip", "Picture day") and a third dropped vaccine names to be safe, and were left with rows nobody could
  read. Keep the person's own labels locally behind the blur; strip what isn't theirs (attendees, locations,
  descriptions).
- Name the toggle for what it hides: "Hide amounts" on money boards, "Hide details" elsewhere.

## 8. Say where the data comes from, in one place

- Declare `sources:` in `dashremix.yaml`: each source by its Connector Directory id, how it gets in (a file, a
  read-only connection, or the person's assistant), the fixture layouts that prove it, and the connector for a
  connection. The board page, the connection pages, the agent pages and the app all read this one list.
- Only list what the importer really reads. The build checks each fixture's files against the source it claims.
- Write for people: "a folder on your computer", never a path or a command.

## 9. Every board ships its own agent

A board is most useful when something reads it for the person. Each board has its own agent (`agents/<id>/`):

- a person-like name and a one-line job;
- a weekly routine that reads the board's `insights.*`, plus a daily or event routine when the job has deadlines
  (a renewal, a streak, an import);
- it only writes notes, annotations or drafts: it never sends, pays, posts or deletes;
- its connectors are ones the board's sources name;
- evals that run its routines on the sample and find the planted findings.

Wave-1 boards attached themselves to existing cross-board agents whose routines never read them. Cross-board agents
are welcome as extras; they don't replace the board's own.

## 10. Test the board, not just the build

- A `tests/test_<board>.py` covering the fixtures, row accounting and a failed import that leaves data untouched.
- `dashremix eval` finds every planted finding.
- **Look at it.** Desktop and phone, light and dark, with the blur on. Truncated labels ("Third qua…"), `$` on a
  count axis, an empty number spilling out of its card and a one-point chart were all invisible to the checks and
  obvious on screen.

## Quick review checklist

- [ ] The first screen answers the board's question with a number and a comparison.
- [ ] Every compared stat says which way is good; costs go down.
- [ ] Counts, ratios and unit prices are formatted as what they are.
- [ ] Insights name the thing and its figure, with tokens and correct plurals.
- [ ] The sample is 6-12 months, tells a story, and the board installs with it.
- [ ] Fixtures are real layouts (5+ rows) plus one malformed file; rows are accounted for.
- [ ] Data lives in a standard, not private tables; import problems are reported.
- [ ] The privacy blur hides, it doesn't delete.
- [ ] `sources:` lists exactly what the importer reads.
- [ ] The board has its own agent, with routines that read it and evals that pass.
- [ ] Someone looked at it on a phone.
