Using Claude Code for Economic Research
AI tooling is a rapidly evolving field. The information in this blog post may become outdated within days. Always check the official documentation for the latest updates.
In the past weeks, I've started showing friends and colleagues how to best use Claude Code for economic research projects. I've created a few slides covering the basics, but wanted to go into more depth here.
A bit of background on AI coding agents
Most people (in academia) have only interacted with large language models (LLMs) through chatbot interfaces (ChatGPT, Claude, Gemini, etc.), and usually on the free tier. But two things have completely changed the game since late 2025. First, paid models have gotten dramatically more capable (more specifically, Claude Opus 4.5/4.6 and GPT-5.3/5.4 saw huge jumps in capability). Second, a new class of tools called AI coding agents has emerged that connects these models directly to your local project environment. Examples include Claude Code, Codex, and open-source alternatives like pi or opencode. The results can be really quite remarkable.
What makes AI coding agents so powerful is context. Rather than only seeing what you type or upload, an agent like Claude Code can read (and write!) your project files, git history, documentation, and even data, producing far more tailored output.
This post focuses on Claude Code with the Opus model, but other combinations (such as Codex with GPT) offer a similar experience. More specifically, I focus on the Claude Code extension for VSCode. Most of my friends and colleagues are familiar with VSCode but not the CLI, and the extension is a friendlier starting point for people who aren't primarily programmers (most economists included). Switching to the Claude Code CLI later is always an option.
The Economics of AI coding agents
Before diving in, it helps to understand the economics of AI coding agents, which boil down to two concepts: tokens and context.
Large Language Models (LLMs) use text input to generate text output, and tokens are the measurement units for input and output (one token is ~¾ word or one punctuation mark). Costs scale with token count, and bigger models (e.g., Opus) cost more per token. Subscriptions typically cap token usage per session (~5 hours) and per week. There is a tradeoff here: a lighter model may need more conversation to match a larger model's output, so choosing the right model for the task at hand matters (at least until inference costs go down significantly).
More context (project files, documentation, etc.) generally means better output. Tokens accumulate with each message and each file you load, together making up the context window, which is limited in size (more on this later).
Using Claude Code within VSCode
Installation
To install Claude Code within VSCode, follow these steps:
- Create a Claude/Anthropic account and subscribe to a paid tier. The lowest (~21€/month) is enough to start. If you hit usage limits, consider supplementing with OpenAI's cheapest tier rather than upgrading.
- Install VSCode and the Claude Code extension.
- Open a project folder in VSCode. Claude Code automatically gets access to all files in that folder.
- Click the Claude Code icon on the top right to connect the extension to your Anthropic account.
Your prompts and referenced files are sent to Anthropic's servers, so avoid pointing Claude at sensitive data. Also, use version control (
git) so you can easily revert if Claude makes a mistake.
Basic Usage
You can add context to your prompt in several ways: mention files directly in your message (e.g., take a look at the README...), attach them through the + symbol in the prompt box, select lines of code in VSCode (which are automatically passed to Claude), reference a specific file with @file.py, or drag files into the prompt box with Shift.
Claude Code has different operating modes, selectable on the bottom right of the prompt box. Always try to start with Plan mode: describe your goal, iterate on the initial plan, approve it, then let Claude execute (think of it like briefing a research assistant). When starting out, use the safer Ask before edits instead of Edit automatically. There is also a (forthcoming) new auto mode that automates permission decisions, so you don't have to approve every action manually.
Typing / in the prompt box opens various options. Switch model... lets you toggle between models: Sonnet handles most everyday tasks well, while Opus excels at complex tasks but costs considerably more (avoid Haiku for anything beyond trivial queries). You can also set Effort to medium (higher if you need more compute), enable Thinking, and check your current session usage with Account & usage....
The context indicator shows how much of the context window you have used. Claude automatically compacts the context window after a certain threshold (use /compact to do this manually). It's best to start fresh conversations for new tasks rather than continuing indefinitely. Be aware that recall quality worsens with larger context, though this has improved significantly (Opus/Sonnet now handle up to 1M tokens well, up from 256k).
Use
Shift+Enterto create a new line without sending.
Persistent Context
Without persistent context, every new Claude Code session starts from zero. All relevant information must be provided again with each prompt. Three mechanisms fix this, and they differ mainly in scope:
| CLAUDE.md (global) | CLAUDE.md (project) | Skills | |
|---|---|---|---|
| Scope | All sessions | Each project | One task |
| Loaded | Automatically | Automatically | On demand (/) |
| Purpose | Who you are | Project specifics | How to do X |
| Location | Home directory | Project folder | Global or project |
You don't need any of this when starting out, but once you find yourself repeating the same instructions across sessions, it's worth setting up.
CLAUDE.md (global)
The global CLAUDE.md file lives at ~/.claude/CLAUDE.md and is loaded in every session. Its purpose is to tell Claude who you are: your role in 1-2 sentences, the tools and software you use, your skill levels (be honest!), communication preferences, and writing style (see this guide on teaching Claude your voice).
The difference between a vague and a useful global CLAUDE.md is specificity. Compare:
"I'm a researcher. I do data analysis."
with:
"Predoctoral RA at a policy school, working on field experiments studying education interventions in East Africa. Cleaning survey data in Stata; analyzing in R and Python."
The second version gives Claude enough background to calibrate its responses to your level and domain.
CLAUDE.md (project)
A project-level CLAUDE.md lives in the project root and is loaded whenever you open that folder. Use /init to auto-generate one from your existing files.
Include things like project goals and current status, data sources and variable definitions, coding conventions, file structure, build commands, and your theoretical framework or empirical strategy. Here is an abbreviated example:
# Project: Regional Labor Markets
Panel data analysis of local labor market
dynamics across European NUTS-2 regions.
## Build & run
pip install -e .
pytask
## Project structure
src/labor_markets/
data/ <- raw input data
data_management/ <- cleaning + merging
analysis/ <- regressions & figures
bld/ <- generated outputsA good example of coding conventions is OpenSourceEconomics/ai-instructions.
Skills: reusable task instructions
Skills are loaded on demand via / and can live either globally (~/.claude/skills/) or locally in your project (.claude/skills/). Each skill needs a SKILL.md file with a name, description, and instructions. A simple skill is a single file:
---
name: explain-code
description: Explains code with visual
diagrams and analogies.
---
When explaining code, always include:
1. Start with an analogy
2. Draw a diagram (ASCII art)
3. Walk through step-by-step
4. Highlight a common gotchaSkills can also span multiple files (templates, example outputs, scripts, reference docs). Just reference them from SKILL.md so Claude knows when to load them:
~/.claude/skills/revise/
├── SKILL.md # Main instructions
├── template.md # Template to fill in
├── examples/
│ └── sample.md # Expected format
└── scripts/
└── validate.sh # Executable scriptSee the Claude documentation and Building Skills (Claude Blattman) for more information.
You can also import skills built by others. I maintain a list of useful skills that you can browse for inspiration. That said, skills are not always necessary (modern models are quite capable by themselves!) and can pose a security risk when imported from untrusted sources, so review third-party skills thoroughly before using them.
What it's great at and where it falls short
What it's great at
Translation (which is really what coding is). AI coding agents excel at converting between formats and languages: words to code, one programming language to another, rough notes to polished text. If you can describe what you want, Claude can usually produce a working first draft.
Prototyping. You can quickly try out different approaches, explore complex datasets, and prototype dashboards or annotation interfaces. This extends beyond research tasks: AI coding agents are making it possible to build hyper-personalized tools that serve only you, without needing to rely on off-the-shelf software.
Brainstorming. Ask Claude for multiple options based on your project specifics. Use planning mode extensively for this!
Editing, refereeing, and replicating. Models are getting better than dedicated solutions like Refine, and skills have been emerging specifically for this purpose (OpenAI Review, AI Research Feedback, MixtapeTools).
Where it falls short
Jagged intelligence. LLMs are excellent on one prompt and confidently wrong on a near-identical one (A Model of Artificial Jagged Intelligence, Gans 2026). This unpredictability makes it hard to build reliable intuitions about what they can and cannot do.
Typical LLM weaknesses. Citations, literature reviews (models have no access to paid journals, though you can add Zotero to Claude via MCP), math (improving!), and factual accuracy remain weak spots.
Addictiveness. Using AI coding agents doesn't always feel like working, making it hard to disengage.
PDFs and images. These are still limited and expensive token-wise, though there are workarounds.
The verification problem
In the beginning, you verify every line, but at some point you stop looking altogether. This becomes a dangerous slippery slope when you are unfamiliar with the coding language and can't verify, when you can't easily verify outputs (e.g., by writing tests), or when you are working on a high-stakes project (outside of prototyping). Some models (specifically, Opus/Sonnet) are better than others at challenging nonsensical prompts, though not necessarily at returning correct output.
One mitigation is cross-language replication: run key analyses in R, Python, and Stata without referencing existing code. If results across languages agree, confidence increases. But ultimately, the binding constraint is not intelligence but human verification bandwidth (Some Simple Economics of AGI, Catalina et al. 2026).
The solution is to work as incrementally as possible. Keep changes small, verify each step before moving on, and resist the temptation to let the agent run ahead of your understanding.
Further Resources
I have only covered the basics here. If you want to go more in depth, I can particularly recommend the series Claude Code for Economists by Paul Goldsmith-Pinkham and Claude Blattman by Chris Blattman. If you need help with something, you can consult the Claude Code in VSCode Documentation or simply ask Claude itself!
Some other resources and essays on using AI coding agents, in no particular order:
- My Claude Code Setup by Pedro H. C. Sant’Anna
- Claude Code for Everything by Hannah Stulberg
- Research in the Time of AI by Paul Goldsmith-Pinkham
- AI as a Research Collaborator, Not a Paper Mill by Morten Nyboe Tabor