|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Instructions for AI agents working in this repository. |
| 4 | + |
| 5 | +## Proof of reading |
| 6 | + |
| 7 | +Respond with: "Loaded AGENTS.md" |
| 8 | + |
| 9 | +## Overview |
| 10 | + |
| 11 | +This is an Observable Framework data app. Pages are `.md` files in `src/` with |
| 12 | +embedded reactive JavaScript and SQL. Charts use Observable Plot. |
| 13 | + |
| 14 | +**Before writing any page code or visualization, read:** |
| 15 | + |
| 16 | +- [`.ai/observable-framework.md`](.ai/observable-framework.md) — Framework markdown syntax, |
| 17 | + reactivity, data loaders, FileAttachment, view(), Inputs, SQL blocks, project structure |
| 18 | +- [`.ai/observable-plot.md`](.ai/observable-plot.md) — Observable Plot marks, transforms, |
| 19 | + scales, and composition patterns |
| 20 | +- [`.ai/d3.md`](.ai/d3.md) — D3 utilities (format, scale, group, rollup), custom SVG charts, |
| 21 | + data joins, axes, transitions, and geo projections |
| 22 | + |
| 23 | + |
| 24 | +**Responding to student questions** |
| 25 | + |
| 26 | +- Whenever available, refer to examples and content in the lessons files |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Key Rules |
| 31 | + |
| 32 | +- All charts use **Observable Plot** — not D3, Chart.js, Recharts, or Vega |
| 33 | +- Data loading uses FileAttachment() or SQL fenced code blocks — not fetch() |
| 34 | +- Reactive state uses view() + Inputs — not React/Vue/Svelte |
| 35 | +- Plot is globally available in .md pages — do not import it |
| 36 | +- D3 is globally available in .md pages — do not import it |
| 37 | +- Use simple javascript methods (`.map`, `.filter`, `.reduce`) for data manipulation |
| 38 | +- Only use D3 if the student specifically requests it, otherwise default to Plot |
| 39 | +- Use D3 for: number/date formatting, data aggregation (group/rollup), custom SVG, geo projections |
| 40 | +- Pages are .md files in src/ — not .html or .jsx |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## Dev Commands |
| 45 | + |
| 46 | +```bash |
| 47 | +npm run dev # start local preview server (hot reload) |
| 48 | +npm run build # build static site to dist/ |
| 49 | +``` |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Project Structure |
| 54 | + |
| 55 | +``` |
| 56 | +src/ |
| 57 | +├─ index.md # home page |
| 58 | +├─ lessons/ # lesson pages (e.g. 1_intro_to_web_development.md) |
| 59 | +└─ lab_0/, lab_1/, ... # each lab has readme.md (instructions) + index.md (dashboard) |
| 60 | +``` |
| 61 | + |
| 62 | +Sidebar and routing are defined in `observablehq.config.js` under `pages`. Build output is cached in `src/.observablehq/cache/`. Data can be loaded via `FileAttachment()` (e.g. from npm sample datasets or future `data/` loaders). |
| 63 | + |
| 64 | + |
| 65 | +## Observable Framework and Plot Syntax |
| 66 | + |
| 67 | +When you need Observable Framework or Plot syntax while helping with labs or dashboards, read the reference docs in **`observable_docs/`**: |
| 68 | + |
| 69 | +- **Observable Framework** (markdown, code blocks, grids, cards, `resize`, etc.): [`observable_docs/observable-framework-syntax.md`](observable_docs/observable-framework-syntax.md) |
| 70 | +- **Observable Plot** (marks, options, transforms): [`observable_docs/observable-plot-syntax.md`](observable_docs/observable-plot-syntax.md) |
| 71 | + |
| 72 | +Use these when writing or editing Framework `index.md` files or Plot charts. |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
0 commit comments