Module 2 Lab: Empty Folder to Verified Figure
In this lab you run the same loop you watched in the demo: empty folder, download script, clean panel, publication-style figure, reproducibility README. The difference is that you choose the measure. The demo built R&D intensity, and your lab measure is a different one, so when you check your figure at the end you are checking your own work rather than a copy of the demo. The starter pack (lab2_starter.zip) contains an opening-prompt template with blanks for your measure, tags, and aggregation; a verify checklist; and a card explaining DECISIONS.md and LOG.md. The zip has no data in it. FSDS is public, and downloading it yourself is part of the exercise.
Choose your measure
Start the same way the demo did: mkdir ~/lab2 && cd ~/lab2 && claude. Because the folder is empty, Claude sees this project and nothing else. Then pick one of the three measures below. They are tiered by ambition. Choose the tier that matches how much cleaning judgment you want to practice in this module, which need not be the hardest one.
Base: leverage by industry and year. Compute book leverage (long-term debt divided by total assets) as the median by two-digit SIC code (sic2) and year. This is the closest variant of the demo: the same join and the same aggregation, with a different pair of XBRL tags.
Standard: R&D intensity, different industry grain. Build the demo’s R&D-intensity measure (R&D expense over total assets), but aggregate by one-digit SIC (sic1) instead of the demo’s sic2. You already know the measure. What is new is the grouping decision and how it changes the pattern you see.
Stretch: revenue concentration. For each year, compute the share of total reported revenue that comes from the ten largest filers by revenue. This tier takes more cleaning judgment than the other two. You have to decide how to handle firms that report revenue under more than one tag, and how to break ties at the tenth-largest boundary. Pick it if you want more practice with ambiguous cleaning decisions rather than with the mechanics of the join.
Whichever tier you pick, use the known-good quarters the starter pack pins for you: Q4 of 2012, 2015, 2018, 2021, and 2023. Five quarters give you a long enough time series for a meaningful plausibility check without downloading and cleaning fourteen quarters in an 80-minute lab. Tag coverage in FSDS also varies by quarter. A value reported under one tag in an earlier filing sometimes appears under a slightly different tag in a later one. That is another reason to pin exact quarters instead of defaulting to all of them.
Requirements, regardless of tier
The deliverable has the same shape as the demo’s:
- named scripts only;
DECISIONS.mdandLOG.mdrequested in your opening prompt before any analysis runs, not added later once something looks off;- an attrition table showing every point where your sample size changed and why;
- one publication-style figure;
- a README that lets a stranger, or you in three weeks, rerun the whole pipeline from scratch.
Adapt the opening-prompt template in the starter pack to your tier. Fill in the measure, the tags, and the aggregation. Leave the paper-trail section exactly as written, and do not trim it if you are short on time. It is the part that produces DECISIONS.md and LOG.md.
Stretch for finishers: if your pipeline is done with time to spare, do one of two things. Either rerun the same research question with a second measure and compare what changes, or write a paragraph (not code) on what the WRDS version of this pipeline would need to change: which table replaces sub.txt and num.txt, which key replaces adsh, and which filters Compustat would require that FSDS does not. This previews Module 4. It is not homework, and a few sentences is enough.
Debrief and exit ticket
We regroup for a short debrief. Whose first-draft figure was right on the first attempt? If almost nobody’s was, that is the expected outcome and not a problem with the lab. Where did Claude recover from an error on its own, and where did you have to step in and redirect it?
Complete the standard three-question exit ticket (one concept that clicked, one thing that broke, one thing you’d want to verify before trusting a similar result). Then add this module’s two items: the WRDS checkpoint above, and one sentence on sub-agents. If you saw Claude start a sub-agent at any point during your lab, what do you think it was for? We will answer that properly in Module 4.