An AI coding agent for economics research. Day 1
2026-04-22
| Part | Topic | Minutes |
|---|---|---|
| 0 | Why this workshop | 5 |
| 1 | Chatbot vs agent: felt difference | 10 |
| · | Live demo | 5 |
| 2 | The ladder of AI coding tools | 5 |
| 3 | Mental models | 10 |
| 4 | Meet Claude Code | 5 |
| 5 | Setup: Max subscription or API tokens | 15 |
| 6 | Basic interaction loop | 15 |
| 7–9 | CLAUDE.md · Essentials · Pitfalls | 25 |
| · | Hands-on: tutor-guided messy-project session | self-paced |
Speed. Tasks that used to fill a day (reorganising a folder, drafting a README, writing a download script, styling a figure) compress to minutes. You still make the research decisions. The agent does the typing.
Calibration. Your adviser, future co-authors, and the researchers whose papers you read will all be using these tools. You need to know what they can and can’t do, and where they cut corners.
Two ways to pay. A Claude Max subscription (flat monthly, unlimited within reason) or API tokens on an Anthropic key (pay-as-you-go, about $0.10–$0.50 per session). We set up both paths in Part 5.
An agent is not a smarter chatbot.
The chatbot is locked inside a text box. The agent has hands: it reads files, runs commands, writes code, closes its own error loops.
The next four slides show the same research task under both tools, side by side.
library()".~10 min.
~20 sec. A working script.
The agent opens your files and writes new ones. The chatbot cannot.
You're a courier.
Agent closes its own loop.
The agent sees its own output. The chatbot needs you to paste.
Done, with a revertible commit. No sed, no regex pain.
Three PDFs. Compare side by side. Pick one.
| ✅ Big win | ❌ Keep for yourself |
|---|---|
| Inventory or audit an unknown folder | Novel research ideas |
| Bulk rewrites (rename, reformat, port) | Non-trivial identification strategy |
| Run, fail, fix loops | Final writing (the voice matters) |
| Generate and compare variants | Sensitive data (IRB, PII) |
| Glue work (download, parse, plot) |
Agents win on the paperwork around the research, not the research itself.
You won’t get the felt difference from reading. Open a terminal, start a session, try things like:
data.table pipeline to dplyr.notes.md.A few cents of tokens (or five minutes of a Max session) buys a lot of trying.
Six prompts. Empty folder. Claude Sonnet.
$ mkdir ~/demo && cd ~/demo
$ claude
▸ Write plot_iris.R: load iris, plot sepal length by species.
▸ Run Rscript plot_iris.R.
▸ Restyle it following Kieran Healy's ggplot2 best practices.
▸ Save to figures/iris.pdf and figures/iris.png at 300 DPI.
▸ /cost
Watch: diff previews, permission prompts, /cost reporting tokens used.
That was Level 3. Next: the ladder.
| Level | What it is |
|---|---|
| 0 | Copy-paste between ChatGPT and your editor |
| 1 | IDE autocomplete (Copilot) |
| 2 | IDE-based agent (Cursor, Continue) |
| 3 | Terminal agent (Claude Code, Aider, Codex, Gemini CLI). TODAY. |
| 4 | Orchestrated agents: headless CI, multi-agent review |
| 5 | Long-horizon autonomy: task, walk away, PR |
…you were at Level 1. Level 3 is a different tool.
Not a search engine. Not a chatbot.
A competent but junior RA with a terminal open on your project.
If you’d hire an RA without checking their first output, you’re hiring wrong. The agent is no different.
You are passing a very long document back and forth.
Each turn, the model receives:
Up to 200k or 1M tokens. Sounds like a lot. Fills up faster than you’d think.
As the document grows, performance drops. The agent forgets rules, makes sloppier edits, gives foggy summaries.
Fix it with session hygiene, not a bigger context:
/clear when switching topics/compact to compress a long session and keep goingMost of the work is in step 4.
Claude Code is Anthropic’s terminal-native coding agent.
CLAUDE.md briefing file on startup (see Part 7)./plan (draft first, act second), /init, /compact, /cost.We use Claude Code for the rest of today and all of Day 2.
claude login./cost shows spend in real time.export ANTHROPIC_API_KEY=...Either path works today. If you don’t already have Max, start with $5 in API credits.
Claude Code uses Claude. For other model families, Aider + OpenRouter is the flexible alternative.
We don’t teach it in the main flow, but the Day 2 tutorial appendix has a full setup: one API key, ~300 models, per-key spend caps.
That setup is useful for:
$ claude login # opens browser, OAuth with claude.ai $ claude # first session
workshop-day1, set a spend cap.sk-ant-....$ export ANTHROPIC_API_KEY=sk-ant-... $ claude ▸ /cost # watch spend per message
The prompt shows ▸, the working directory, and a permission indicator. First-time shell commands trigger an approval prompt. Type /help for all built-in commands.
| # | Pattern | One-liner |
|---|---|---|
| 1 | Vague start, then iterate | State the goal loosely. Let the agent ask. Refine. |
| 2 | Scripts, not commands | Ask for plot_mtcars.R, never “make a plot”. |
| 3 | Style by reference | “Follow Kieran Healy’s ggplot2 best practices.” |
| 4 | Small iterations | Three narrow prompts beat one monster prompt. |
Same four patterns, a different dataset. Your hands on the keyboard.
$ mkdir ~/warmup && cd ~/warmup
$ claude
▸ Load mtcars, plot mpg vs weight coloured by cyl.
Write as plot_mtcars.R.
▸ Run Rscript plot_mtcars.R.
▸ Restyle following Kieran Healy's ggplot2 best practices.
▸ Save as figures/mpg_vs_weight.pdf and .png at 300 DPI.
▸ /cost
Three small rounds, one cost check. That’s the job.
Type /plan, then your prompt. Claude Code reads the relevant files, drafts a numbered step-by-step plan, and waits for your approval before touching anything.
▸ /plan
▸ Analyse this folder and plan how to turn it into an
AER-compliant replication package.
[agent reads files, drafts plan, waits for OK]
You can approve (“looks good, proceed”), steer (“skip step 3, add a robustness check”), or reject outright.
| Agent | Reads |
|---|---|
| Claude Code | CLAUDE.md |
| Aider | CONVENTIONS.md |
| Gemini CLI | GEMINI.md |
| Codex CLI | AGENTS.md |
Same content, different filename. cp CLAUDE.md CONVENTIONS.md literally works.
The file is a briefing, not a config.
Meta-move: draft it with a chatbot on claude.ai, refine in CLAUDE.md.
/init bootstraps the first draft$ cd ~/my_project $ claude ▸ /init
Claude Code scans the repo, opens a sample of files, and writes a CLAUDE.md in the project root. Treat it as a first draft; edit to add your domain rules.
| Command | Use |
|---|---|
/help |
list all built-in commands |
/init |
auto-draft a CLAUDE.md |
/plan |
enter planning mode |
/compact |
compress the conversation to free context |
/clear |
clear history, keep files |
/model |
switch opus / sonnet / haiku |
/cost |
API spend this session (or “uses Max”) |
Asks before
every shell command
Pre-approve patterns
in settings.json
--dangerously-
skip-permissions
Inside Docker, "skip all" is reasonable. The container is your sandbox; the host is untouched.
| Task | Good choice |
|---|---|
| Small edits, tight loops | Haiku (fastest, cheapest) |
| Most everyday refactors | Sonnet (default for today) |
| Deep planning, hard reasoning | Opus for /plan, then switch |
Switch mid-session: /model sonnet / /model haiku / /model opus.
On Max, models are included. On API, check /cost after every few messages.
/clear between topics; hand state off via files.ls.▸ Download homeownership rates by age. Write as download_data.py.
agent: trying FRED... no age-disaggregated series...
agent: switching to Census Bureau...
! Error: 403 Forbidden
agent: bot-blocked, adding User-Agent header...
✓ data downloaded, 1,416 rows saved
A 403 isn’t workshop failure. It’s how the tool looks in real use. The loop absorbs it.
🚀 Launch the tutor inside the Docker container:
$ git clone https://github.com/AlexRieber/Workshops.git ~/W $ cd ~/W/AI_Agents/messy_project $ cp ~/W/Getting_Started_Agents/Tutorial/TUTOR.md . $ claude --dangerously-skip-permissions ▸ Read TUTOR.md and act as my tutor.
📋 Five steps the tutor walks you through:
CLAUDE.md (never touch data).README.md from the R scripts.00_setup.R that loads every package.Rscript 00_setup.R, check /cost.Prefer doing it by hand? Tutorial Part 11 has the manual walk-through. Don't attempt the full package today; that's Day 2.
AI Agents. Day 2:
Same messy project. Full AER-compliant replication package. Claude Code end-to-end, with hooks, custom skills, and the referee-2 pattern.
| Claude Code docs | code.claude.com/docs |
| Anthropic Console | console.anthropic.com |
| claude.ai plans | claude.ai/settings/plans |
| Paul Goldsmith-Pinkham on Claude Code | part 1 · part 2 |
| Tutor pattern | earendil-works/pi-tutorial |
| Day 2 workshop | AER-compliant replication package |
| Workshop repo | AlexRieber/Workshops |
Getting Started. Day 1