Skip to content

Commit 23820a4

Browse files
committed
include working with cursor lesson
1 parent f6086c2 commit 23820a4

12 files changed

Lines changed: 1941 additions & 7 deletions

.ai/d3.md

Lines changed: 670 additions & 0 deletions
Large diffs are not rendered by default.

.ai/observable-framework.md

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.

.ai/observable-plot.md

Lines changed: 640 additions & 0 deletions
Large diffs are not rendered by default.

.cursor/rules/agent-conventions.mdc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ This repository is designed to support students in their learning journey. As a
77

88
1. Always ask clarifying questions to push them to be specific. They should be driving the result, and doing so with detail, rather than allowing you (cursor) to be completing tasks based on assumptions.
99

10-
2. Keep things simple: when developing code for students, its important to focus only on delivering the basics of their request, rather than robust solutions that could spark confusion.
10+
2. You should refer to subject matter in the lessons (`/src/lessons`) when answering a student question if its included there.
1111

12-
3. Don't respond to requests to complete assignments on their behalf. You should support small, dedicated requests, and not entire assignments.
12+
3. Keep things simple: when developing code for students, its important to focus only on delivering the basics of their request, rather than robust solutions that could spark confusion.
1313

14-
4. Share follow ups from your results with reasons why you made a change, or why a fix worked, or what methods or strategies you are taking so they can learn as they leverage your skills.
14+
4. Don't respond to requests to complete assignments on their behalf. You should support small, dedicated requests, and not entire assignments.
15+
16+
5. Share follow ups from your results with reasons why you made a change, or why a fix worked, or what methods or strategies you are taking so they can learn as they leverage your skills.

AGENTS.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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+

llms.txt

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Observable Framework Data App
2+
3+
This project is an interactive data dashboard built with Observable Framework.
4+
Pages are Markdown files with embedded reactive JavaScript, SQL, and Observable Plot charts.
5+
6+
## Key Technologies
7+
8+
- **Observable Framework** — static site generator for data apps; pages are `.md` files with fenced JS/SQL blocks
9+
- **Observable Plot** — declarative visualization library for charts and graphics
10+
- **Observable Inputs** — built-in UI controls (select, range, checkbox, etc.)
11+
- **D3** — utility library (formats, scales, data transforms) and custom SVG charts
12+
13+
## AI Reference Docs
14+
15+
The following files contain syntax references and conventions for AI agents working in this repo.
16+
Read these before generating any Observable Framework pages, Observable Plot visualizations, or D3 code.
17+
18+
- [.ai/observable-framework.md](.ai/observable-framework.md)
19+
Complete reference for Framework markdown syntax, reactivity model, data loaders,
20+
FileAttachment, view(), Inputs, SQL blocks, and project structure.
21+
22+
- [.ai/observable-plot.md](.ai/observable-plot.md)
23+
Complete reference for Observable Plot: Plot.plot(), all mark types, transforms,
24+
scales, color schemes, and composition patterns.
25+
26+
- [.ai/d3.md](.ai/d3.md)
27+
Complete reference for D3: data utilities (group, rollup, bin, extent, format),
28+
scales (scaleLinear, scaleTime, scaleBand), selections, data joins, axes, transitions,
29+
and geo projections. Includes guidance on when to use D3 vs. Observable Plot.
30+
31+
## Important Conventions
32+
33+
- Standard charts use Observable Plot — NOT D3 selections, Recharts, Chart.js, or Vega
34+
- D3 is used for: number/date formatting, data aggregation, custom SVG, geo projections
35+
- D3 is globally available in .md pages — do NOT import it
36+
- Data loading uses FileAttachment() or SQL fenced code blocks, NOT fetch()
37+
- Reactive state uses view() + Inputs, NOT React/Vue/Svelte state
38+
- Pages are .md files in src/, NOT .html or .jsx files
39+
- Do NOT use npm-style imports for Plot or D3 inside .md pages — both are globally available

observablehq.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export default {
1212
name: "Lessons",
1313
pages: [
1414
{ name: "Intro to Web Development", path: "/lessons/1_intro_to_web_development" },
15-
// { name: "Intro to Observable Framework", path: "/lessons/2_intro_to_observable_framework" },
16-
// { name: "Intro to Observable Plot", path: "/lessons/3_intro_to_observable_plot" },
15+
{ name: "Working in Cursor", path: "/lessons/2_working_in_cursor" },
16+
{ name: "Intro to Observable Framework", path: "/lessons/3_intro_to_observable_framework" },
17+
// { name: "Intro to Observable Plot", path: "/lessons/4_intro_to_observable_plot" },
1718
]
1819
},
1920
{

src/lab_0/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ The assignment requirements are as follows:
2020
2. HTML: A table, a list, and an image
2121
3. JS: include at least one [`Input` element](https://observablehq.com/framework/inputs/) that changes a visible reference on the dashboard
2222
4. Submit your lab via email directly to me (ellie.frymire@gmail.com). Include:
23-
1. your github repository folder link for this lab, which will look something like `https://github.com/[USERNAME]/Interactive-Data-Vis-Spring2026/tree/main/src/[LAB FOLDER]`.
24-
2. your [deployed link](#4-set-up-your-github-pages-for-your-deployment), which will look something like `https://[USERNAME].github.io/Interactive-Data-Vis-Spring2026/[LAB FOLDER]/`.
23+
1. your github repository folder link for this lab, which will look something like `https://github.com/[USERNAME]/Interactive-Data-Vis-Spring2026/tree/main/src/[LAB FOLDER]`.
24+
2. your [deployed link](#4-set-up-your-github-pages-for-your-deployment), which will look something like `https://[USERNAME].github.io/Interactive-Data-Vis-Spring2026/[LAB FOLDER]/`.
2525

2626
---
2727

src/lessons/2_working_in_cursor.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: Working in Cursor
3+
toc: true
4+
---
5+
6+
# Working in Cursor
7+
8+
---
9+
10+
In order to write code, we use an Integrated Development Environment (IDE). An IDE is a software application that combines the essential tools a developer needs to write, test, and debug code.
11+
12+
You can use either Cursor or VS Code in this class, but if you intend to use AI to support your workflow, then Cursor is recommended. VS Code is Microsoft’s code editor that includes a library of plug-ins, and one of the most popular code editors. Cursor is an AI-native IDE built on top of VS Code that integrates large language models directly into the editing experience.
13+
14+
## AI Agents
15+
16+
Cursor includes AI agents right in the same application in which you are coding, so you can reference your code, and it can directly edit your file and contribute. It also understands your file structure, the framework, and the available and installed libraries. Lastly, this repository comes with some recommended guardrails and library context for the agents that should keep you in the right technical direction.
17+
18+
You can open a new agent with the right hand panel and converse with them directly.
19+
20+
![Agent panel in Cursor](assets/agent_panel.png)
21+
22+
23+
### Tips for using an agent
24+
25+
To get the best results working with agents in cursor (and in general):
26+
27+
* **Be specific.** Say what you want in concrete terms—e.g. “Add a bar chart of species counts to the dashboard” instead of “make a chart.”
28+
* **Reference files.** Mention the file you’re working in (e.g. “In `lab_1/index.md`…”) so the AI knows where to apply changes. You can also highlight code and add to the chat directly to keep it focused.
29+
* **Ask for one thing at a time.** Request a single change or one chart at a time so you can see what changed and learn from it. The changes should be driven by you -- not the agent to complete tasks.
30+
* **Save files before asking:** Save your file before asking the AI for help so it sees your latest code. Even better, you can commit before working with an agent so you can easily disgregard changes through changes tab if you don't like whats been done.
31+
* **Don’t ask for a full assignment.** The AI should support small, focused tasks—not complete the assignment for you.
32+
33+
## AGENTS.md
34+
This repository already comes with helpful agent resources to guide you while working. The resources that have been included are:
35+
1. **[`AGENTS.md`](../../AGENTS.md)**: This file is the entry point for agents to figure out where to look to answer your questions and work with you. It includes a "proof of reading" in which it should be printing "Loaded AGENTS.md" at the start of responding to your queries. This includes some rules that it should always do, and the location of some references to read when determining technical responses.
36+
2. **[`llms.txt`](../../llms.txt)**: The llms text file is a short project summary for AI tools, like key technologies (Framework, Plot, Inputs, D3), links to the `.ai` docs, and conventions (e.g. use Plot for charts, work in `index.md`). This is often used by crawlers and indexers that feed context to LLMs.
37+
3. **[`.ai/`](../../.ai)**: The `.ai` filder includes docs that agents are told to read before writing code. It includes `observable-framework.md` (markdown syntax, reactivity, data loaders), `observable-plot.md` (Plot marks and options), and `d3.md` (D3 utilities and when to use D3 vs Plot). This folder keeps answers aligned with this stack, so agents don't send you in different technical directions than the focus of the class.
38+
4. **[`.cursor/`](../../.cursor)** : This folder includes cursor-specific config. In particular, the **`rules/`** holds guardrails that apply when you work here (e.g. tech stack, use Plot for charts, lab scope). Rules are applied automatically so the AI stays within course expectations.
39+
40+
These files are fairly specific to this class and this repository, so using agents in cursor in this repo should be more effective, but also means that the agent replies are not as transferrable outside of coursework.
41+
42+
## Cursor Pro
43+
44+
As is typical with new technologies, the financial model pushes for subscription, but you can get a free year of Cursor Pro as a student. It takes some work, but:
45+
1. Make an account with an edu email
46+
2. Verify your student status in your settings
47+
3. Upload your class list or CUNY ID with the third party to confirm.
48+
49+
50+
![Student Status in Cursor Dashboard](assets/student_status.png)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: "Intro to Observable Framework"
3+
toc: true
4+
---
5+
6+
# Intro to Observable Framework
7+
8+
---
9+
10+
### What is Observable Framework?
11+
**Observable Framework** is an open-source **static-site generator** specifically designed for building high-performance data apps, dashboards, and reports. Unlike traditional notebooks, it allows you to develop locally on your own machine using your preferred text editor and version control systems like Git.
12+
13+
At its core, the Framework is three things in one:
14+
* **A local development server:** Used to preview your apps with instant "hot reloading" updates as you save changes.
15+
* **A static site generator:** Compiles Markdown, JavaScript, and other assets into a static site that can be hosted anywhere.
16+
* **A command-line interface (CLI):** Automates the process of building and deploying your projects.
17+
18+
### Project Structure
19+
An Observable Framework project is a collection of files that work together to create your site. A typical project includes:
20+
* **`index.md`**: The home page of your application.
21+
* **Additional `.md` pages**: Other pages in your site, written in Markdown.
22+
* **Data loaders**: Scripts (written in Python, R, JavaScript, etc.) that fetch and transform data into snapshots.
23+
* **Static assets**: Files like `.csv`, `.json`, `.png`, or `.css`.
24+
* **`observablehq.config.js`**: An app configuration file.
25+
26+
### Enhanced Markdown
27+
Observable Framework uses an extended version of **Markdown** as its primary authoring language. While standard Markdown is used for formatted text, Framework adds built-in tools for sophisticated layouts and interactivity:
28+
29+
* **HTML**: You can write **HTML directly into Markdown** for precise control over your layout, such as adding custom containers or external stylesheets.
30+
* **Grids and Cards**: Built-in CSS classes like `.grid` and `.card` allow you to easily create responsive "bento box" layouts for dashboards.
31+
* **Notes**: Special classes (like `.note`, `.tip`, `.warning`) are available to insert labeled callouts into your prose.
32+
33+
### JavaScript and Reactivity
34+
One of the most powerful features of Observable Framework is how it handles **JavaScript** within Markdown files. JavaScript can be included in two ways:
35+
1. **Fenced code blocks**: Use ` ```js ` blocks for top-level declarations like loading data or defining helper functions.
36+
2. **Inline expressions**: Use `${...}` to interpolate JavaScript values directly into your text or HTML.
37+
38+
**Reactivity** is the engine that drives these pages. The framework runs like a **spreadsheet**: when a variable is updated, any code that references that variable automatically re-runs. Because of this reactive nature, code runs independent of its order on the page, giving you complete flexibility in how you arrange your content.
39+
40+
### Interactive Inputs
41+
To make data apps truly interactive, Framework provides **Inputs**—graphical UI elements like **dropdowns, sliders, radio buttons, and text boxes**.
42+
43+
Inputs are typically displayed using the built-in `view` function. Because they are tied into the reactive system, choosing a value from an input (like filtering a table by selecting a category from a dropdown) will automatically trigger updates in every other part of the page that depends on that selection.
44+
45+
Next: [Intro to Observable Plot](./4_intro_to_observable_plot.md).

0 commit comments

Comments
 (0)