Claude Code for Research: Preventing Hallucinations
Trust but verify
Anyone who has used Claude Code for more than a few minutes knows that—just like any other AI tool—even this formidable machine shares the same penchant for fabrications. Does this mean serious researchers shouldn’t use Claude Code? Not in my view.
I notice it most with a fresh instance of Claude Code, one without the elaborate guardrails I’ve imposed on the version I use daily. It just…makes stuff up. And the fabrications are so believable that only constant insistence that the model verify itself will surface them.
These convincing fabrications might be fine for casual users—if what the model says is that plausible, it’s probably not far from the consensus. But for research, where made-up results are embarrassing at best and career-ending at worst, they’re unacceptable.
Does this mean serious researchers shouldn’t use Claude Code? Not in my view. It just requires imposing strict rules, workflows, and audits along the way—not so different from the precautions any senior researcher takes with a junior colleague, though the form has to be tailored to the tool.
Here are three of the ways I keep Claude Code on guardrails while researching the housing market for Home Economics.
One: Data Lake
The single best way to stop Claude Code fabricating results is to point it at a specific source it must draw its conclusions from. For me that’s my data lake—nothing more complex than a (very big) folder in the cloud. I use Dropbox for its file-version history: useful for the rare but maddening occasion when the robot overwrites a good file with a new, bad one.
Almost every analysis I run starts with a query to that data lake. There’s a lot in there, so efficiency matters. I store the files as parquet and query them with a tool called DuckDB. To help Claude Code navigate, the data lake keeps a catalog—a single markdown table of contents listing everything inside—and each dataset carries a small JSON ‘sidecar’ noting its source. So when I ask a question, Claude Code can quickly look up what’s available and query the right file.
In the early days of working with Claude Code I spent considerable time building up the data lake’s sources. That need has now mostly faded: most analyses use the same data as a previous one, and it’s already there—and current, since a “cron” (a recurring job in the cloud) refreshes the data overnight.
I don’t have a “slash command” (a “skill”) for this. Because it underpins everything, the instruction to go first—always—to the data lake is encoded in Claude Code’s global memory. I never need to invoke it.
Two: Background research
Most analysis benefits from awareness of what’s come before: what are other smart people saying, and how is my work different?
So before writing up anything I run background research, via a custom slash command I’ve called “/article-research”. It often forces me to raise my game—and occasionally shows that I’m not standing on the shoulders of giants so much as parroting them, in which case I lean hard on original data visualization or drop the topic entirely.
But LLMs, Claude Code included, are world-class fabricators when sent to gather information. The fix is simple: I require an URL for every factual claim, plus a verbatim quote. Those two checks have essentially solved the problem. Across perhaps 80 background briefings over the past year, I’ve yet to find a fabrication that survived this protocol.
Three: Final audit
You know who else makes shit up? Me. The process is probably much like Claude Code’s: I read something somewhere, internalize it, merge it with something else, and arrive at a conclusion that doesn’t match reality. Oops.
So the final stage guards against my hallucinations as much as Claude Code’s, via a custom slash command I’ve named “/fact-check”. It’s especially useful for surfacing the subtler weaknesses—often not that something is wrong, but that a better statistic exists. The fact check report comes back in three sections: facts checked and confirmed (from the data lake or a published source), “better statistic available”, and “outright falsehoods”.
None of this is rocket science. It’s just the result of many, many hours spent tinkering and working with Claude Code in the production of research.
To my surprise, Home Economics is increasingly being asked to help firms do research and communications with Claude Code. Regular readers know I’ve become slightly obsessed with the tool—cautiously evangelical, even. Turning this into a professional practice has been a thrill.
If any of this resonated with you, and you’re interested in a helping hand integrating Claude Code into your own work, get in touch here.

