Every course has a concept that students only half understand from a figure: why growth levels off, what “95% confidence” means, how a lens forms an image. A small interactive demo lets them move the parameter themselves and see what happens. Until recently, writing one took a programmer days. With an agent, it takes an afternoon, and most of that afternoon is yours: deciding what the learner should discover, and checking that the model is right.
One HTML file. No install, no build step, no internet; it opens in any browser and on a phone.
Learning goal first. Write down what the learner should discover before anyone talks about sliders.
Few controls. One or two things to move, a reset, and presets for the interesting cases.
Check the model against a known case. A demo can look right and be wrong.
Accessible, tested on a phone, embedded in your page.
A hands-on unit. It builds on A course or project page, where the demo ends up. Apps that explore real data come next, in Shiny apps.
Every course has a concept that a static figure does not explain
Try it: a demo lets students move the parameter themselves
A demo here is one HTML file that runs anywhere, offline
One file, no build step, no internet: we insist on all three
Rule
Why
What to tell the agent
One file
you can email it, open it, put it anywhere
“a single self-contained HTML file”
No build step
nothing to install or run before it works
“plain HTML, CSS and JavaScript, no frameworks”
No internet
works offline and on locked-down networks; nothing breaks when a website changes; no tracking of students
“do not load anything from the internet: no CDN, no fonts, no libraries”
No data sent anywhere
students’ clicks stay in their browser
“no analytics, no forms that send data”
The agent’s first idea is often a plotting library loaded from the internet. It works on your laptop today and fails in a lecture hall without wifi. Say the rule in the first prompt.
A sister course uses some 30 demos; they share a shape
What those demos have in common
Demo
What the learner moves
What the learner discovers
Gaussian elimination
steps through row operations one at a time
why a system has no solution or infinitely many
Dot product
drags two arrow tips
scaling changes the distance, not the angle
Random walkers
presses play, changes the rates
the fractions settle; individuals never do
Random events
changes the rate, switches views
counts follow one pattern, gaps another
Leakage
presses “run again”
a subtle mistake fakes high accuracy on noise
Confidence intervals (this unit)
sample size, “draw 20”
about 1 in 20 intervals misses, whatever you do
Each demo has one message, few controls, a reset or presets, and something that changes visibly when you move a control.
Start with what the learner should discover, not with the sliders
Write the discovery as one sentence you could test
Too vague
A discovery you can test
“Understand logistic growth”
“Growth is fastest when the population is at half of K, whatever r is.”
“Show confidence intervals”
“About 1 in 20 of the 95% intervals misses the true mean, and you cannot tell which.”
“Explain drug dosing”
“With a dose every half-life, the level settles at about twice a single dose.”
“Visualise diffusion”
“Spreading distance grows with the square root of time: four times as long, twice as far.”
“Interactive Fourier”
“A square wave needs many odd harmonics; the corners never get perfectly sharp.”
Test it on a colleague: give them the demo and no explanation. Can they say the sentence after five minutes?
Fewer controls teach more
The prompt describes the learner, the discovery and the controls
Make a single self-contained HTML file, logistic-growth.html, that teaches
first-year biology students about logistic population growth.
What students should discover: growth looks exponential at first, then slows,
and it is fastest when N is half of the carrying capacity K.
Controls: sliders for growth rate r (0.1-1.5 per day), K (100-1000) and start
population N0 (1-100); let students drag a horizontal line for K. A reset button
and two presets ("bacteria in a flask", "deer on an island").
Show: N over 40 days, a marker at the steepest point, and the key numbers as text.
Rules: plain HTML, CSS and JavaScript in one file; nothing loaded from the
internet; works on a phone; labelled controls that work with the keyboard;
text at least 16 px. Tell me the formula you use and one known case I can
check by hand.
The agent writes one file and tells you what is inside
Opening the demo is a double-click
Say what a student would see, not what to change in the code
Good feedback describes the experience:
When I drag K below the current population, the curve jumps. A student
would think that is a mistake in the demo. Make the population fall
smoothly towards K instead.
The numbers under the plot change too fast to read while I drag.
Round them to one decimal and keep their position fixed.
A student will not know what "N0" means. Use "start population" and
show the unit (individuals) next to every number.
Change one thing per round, reload, and try again. If the demo gets worse, git gets you back (Git as undo button and lab notebook).
A demo that looks right can still be wrong
Try it: what does “95% confidence” mean?
Check the model against a case where you know the answer
Known cases exist in every field
Demo
A known case to check
Logistic growth
N = K/2 at t = ln((K - N0)/N0) / r
Confidence intervals
about 95% of 1000 intervals contain the true mean
Drug dosing (one compartment)
after one half-life, half the drug is left
Michaelis-Menten kinetics
at substrate concentration Km, the rate is Vmax/2
Diffusion
mean squared distance = 2Dt in one dimension
RC circuit / cooling
after one time constant, 63% of the way there
Projectile without air resistance
the longest throw is at 45 degrees
Hardy-Weinberg
p² + 2pq + q² = 1; with p = 0.5, half are heterozygous
Compound interest
at 7% a year, money doubles in about 10 years
Ask for a check mode that prints these values next to the expected ones. Then do one by hand.
Ask for a check mode, fixed random numbers and a formula in the file
Check mode: a button that compares the demo’s numbers with known cases and says “agrees” or “does not agree”.
Fixed random seed: “Start again” gives the same random numbers every time. Then 1000 draws at n = 10 give the same result in every lecture (in our demo, 940 of 1000, 94.0%) and you can write it in the exercise.
The model in words at the top of the file: formula, units, assumptions, known cases. Anyone can open the file in a text editor and read it.
Extreme settings: try the smallest and largest value of every slider. Nothing should jump, freeze or show NaN.
A second opinion: ask a fresh agent session (or the other agent) “Is the model in this file correct for teaching X? Compare it with a textbook formula.”
Accessible demos work for everyone, including on a projector
Test on a phone before your students do
Embed the demo in your course page with one line
Publishing is the git loop you already know
Topic ideas: life sciences and medicine
Topic
What the learner discovers
Logistic growth
growth is fastest at half of the carrying capacity
Enzyme kinetics (Michaelis-Menten)
doubling the substrate does not double the rate near saturation
Genetic drift
small populations lose alleles by chance alone
Predator-prey (Lotka-Volterra)
the predator peak comes after the prey peak
Repeated drug doses
the level settles; the dosing interval sets the swings
Epidemic (SIR model)
an epidemic stops before everyone is infected
Screening test
with a rare disease, most positive results are false
Dose-response and EC50
the curve shape depends on the Hill coefficient
Topic ideas: physical sciences, engineering, social sciences
Topic
What the learner discovers
Diffusion of particles
four times as long, twice as far
Damped spring or pendulum
one damping value settles fastest; more damping is slower again
RC circuit, heating and cooling
one time constant gets you 63% of the way
Fourier series
a few sine waves already make a square wave; the corners overshoot
Projectile with air drag
with drag, the best angle is below 45 degrees
Sampling and polls
the margin of error depends on the sample size, not the population size
Regression and outliers
one point far out can turn a slope around
Compound interest and loans
small rate differences become large over decades
Segregation model (Schelling)
mild individual preferences produce strong segregation
Where this goes wrong
A plausible but wrong model. The demo looks fine and teaches a mistake (the 1.96 shortcut, a wrong unit, a formula that only holds for small values). Check a known case.
Too many controls. The demo becomes a toy without a message. Remove what the discovery does not need.
Loaded from the internet. It works at home and shows a blank page in the lecture hall. One file, nothing external.
Silent edge cases. Sliders at zero or at the maximum give NaN, a frozen page or a jump. Try every extreme.
Inaccessible. Mouse only, colour only, tiny text. Test with the keyboard and on a phone.
Not your material. A figure or photo pasted in from a textbook or a website may not be yours to publish. Use your own drawings or openly licensed material, and say where it comes from.
Nobody tested it on a student. Five minutes with one student finds more than an hour of your own clicking.
What the agent does and does not do here
The agent does
You do
writes the HTML, CSS and JavaScript
choose the concept and the discovery sentence
lays out controls and plots, phone layout
decide which controls the goal needs
implements the model you describe
check the model against known cases, by hand
adds a check mode, a seed, labels
test with the keyboard, on a phone, on a student
writes the embed line for your page
check the published page, not only the preview
Summary
Concept
Key fact
Demo
one self-contained HTML file: no install, no build step, no internet
Learning goal
write the discovery as one sentence before any sliders
Controls
one or two sliders, a reset, presets; fix everything else
Correctness
compare with a known case by hand; ask for a check mode and a fixed seed
Accessibility
labels, keyboard, not colour alone, text ≥ 16 px, numbers as text
Phone
stacked layout; test in the browser’s phone view and on a real phone
Publishing
file in your page folder, one iframe line, listed under resources; render, commit, push, check live
Next (Shiny apps): from a demo that explains a model to an app that explores your own data, published next to your course page.