What you are building, and why not from zero
By the end of this lesson you will have a Rebuild section in your PLAN.md that puts every file of your watchlist under one of four headings — survives, generalises, new, dies — with a reason beside each, committed before a line of screener code exists.
A watchlist answers "how are my twelve doing?". A screener answers a harder question: "out of everything, which ones are worth my attention at all?"
Same data, opposite direction. The watchlist starts from a list you already have. The screener starts from a market and has to produce the list.
The instinct to start again, and why it is wrong
The obvious move is a new project. Resist it, because the interesting work of this course is not the screener — it is the rebuild.
Look at what your watchlist already contains: a server-side proxy that keeps the key safe, error handling that fails one row instead of the page, a table that renders figures so they line up, a usage meter, a deployment. Every one of those is needed here too, and every one of them took you a course to get right.
Starting again throws all of it away and, worse, teaches you nothing transferable. The skill that pays for itself across every product you will ever build is seeing what generalises in code you already have — and that is a skill you cannot practise on a blank file.
The three questions of a rebuild
Before touching anything, write the answers down in your PLAN.md. Every rebuild you ever do is these three questions.
1. What survives untouched? The proxy. The key handling. The usage meter. The deploy pipeline. These are not "watchlist code", they are "market tool code", and you were right to build them once.
2. What generalises? The table. Today it renders a fixed set of columns for a fixed set of rows. A screener needs the same behaviour with different columns and rows it did not choose. That is one component with a wider contract, not two components.
3. What is genuinely new? Filters. A universe you did not pick. Ranking. Saved criteria. This is the only part that deserves new files — and noticing that it is a small part is the point of the exercise.
There is a fourth question people forget: what dies? Notes and thresholds belong to instruments you chose deliberately; they make no sense against a result set that changes every time you run it. Say so in the plan, or your assistant will helpfully carry them over. "Dies" means "does not move into the screener": the watchlist keeps its notes and thresholds, and nothing is deleted from it.
What a screen actually is
Three things, and it is worth naming them separately because they fail separately:
- A universe — the set you are choosing from. Not "the market": a specific, listable set of instruments.
- Filters — the conditions that cut it down.
- An ordering — what comes first, which decides what you actually look at.
The endpoint that does this in one request is /screener. A single request with filters and a sort returns matching instruments with the fields you need to judge them. Unit 1 lesson 3 runs your first one.
The honest framing, stated once and meant
A screener finds instruments matching conditions you chose. That is all it does.
It does not know whether your conditions are sensible, whether the result is a good idea, or what happens next. A list of companies with low P/E is a list of companies with low P/E — some are bargains, some are cheap for excellent reasons, and the screen cannot tell you which. Nothing this course produces is investment advice, and a tool that implies otherwise is worse than no tool.
That is not a legal footnote bolted to the end. It changes what you build: it is why unit 4 makes you write down the reasoning behind a shortlist rather than just the shortlist.
Try it now
Open your watchlist repository and write the rebuild section of PLAN.md before reading on. Four headings — survives, generalises, new, dies — and put every file you already have under one of them. If a file is hard to place, that is the file worth discussing with your assistant first.
The prompt
One thing to know before you start: live screens need a plan that includes EODHD's screener (All-In-One or EOD+Intraday — All World Extended). The free plan covers prices and the symbol list but not the screener, so every screener step in this course has a mock path too, and you can finish the whole course on it.
Put EODHD_MOCK=1 in .env.local, so nothing here can spend a call. Start the agent in the repository, press Shift+Tab until plan mode shows under the prompt, and paste:
I am turning this watchlist into a watchlist plus a screener, as a
rebuild, not a new project. The watchlist stays; nothing is deleted
from it. List every file under src/ and tests/, plus .githooks/ and the
CI workflow, and put each under one of four headings: Survives
(market-tool code the screener needs unchanged), Generalises (one thing
with a wider contract), New (does not exist yet: name things such as a
universe, filters, ranking, saved screens, not files), Dies (does not
move into the screener because it makes no sense against results that
change on every run; the watchlist keeps it). Each file goes under one
heading only. One line of reason per file. Put a file you cannot place
under Unsure and say why. Make no API call. After I approve, write it
as a "Rebuild" section at the end of PLAN.md and change nothing else.
A good plan places every file once and changes one file, PLAN.md: key, proxy, cost and usage code under Survives, the table under Generalises, notes and thresholds under Dies, and things rather than files under New.
Check it yourself
git statusshowsPLAN.mdmodified and nothing else.- Every path that
git ls-files src testsprints appears exactly once in the section. Rather than count by eye, ask the agent: "List every path from git ls-files src tests that appears zero times, or more than once, in the Rebuild section." An empty list is the pass. - Dies is not empty: notes and thresholds are there, each with a reason.
- New names things, not files — a universe, filters, ranking, saved screens — because none of them exists yet.
- You read the Unsure list and placed each of those files yourself.
Compare with ours
## Rebuild: watchlist to screener
Survives src/lib/eodhd.ts (key, timeout, mock mode), src/lib/proxy.ts,
src/lib/cost.ts, src/app/api/usage/route.ts, .githooks/, CI
Generalises src/components/Watchlist.tsx: one table, two sets of columns
src/lib/quotes.ts: the fetch-check-narrow part moves out
New universe decision, filters, ranking, saved screens, a screen page
Dies notes and thresholds: they belong to instruments I chose (the watchlist keeps them)
Unsure the stored sort choice: sorting generalises, a per-list setting may not
The full state at the end of this unit is on the starter's branch ref/build-a-screener/u1. Its PLAN.md was finished at the end of the unit, after the first screen existed, so its New line also names the files that screen created, and it puts the manual sort under Dies rather than Unsure. A borderline file can go either way; what matters is the reason written beside it.
Checkpoint
git status # PLAN.md, nothing else
git add PLAN.md
git commit -m "Plan the screener as a rebuild: survives, generalises, new, dies"
Then answer this lesson's questions.