Found something good?

Save it before you doomscroll past it.

How to Make Claude Code Stop Making Stuff Up When It Doesn't Know (Exact Setup Inside)

How to Make Claude Code Stop Making Stuff Up When It Doesn't Know (Exact Setup Inside)

Claude Code lies to your face every day. Made-up functions, fake imports, "tests pass" when nothing ran. The fix is a 4-layer setup that makes lying expensive.

Claude tells you the bug is fixed. Two hours later you find out the function it called never existed.

Most devs learn to double-check everything and blame the model. The real fix catches every lie before it leaves your machine.

Here's the full honesty setup πŸ‘‡

Why Claude makes stuff up in the first place

Claude is a text predictor. When it doesn't know something, it predicts text that looks right. Made-up function names look like real ones. Confidently delivered nonsense reads the same as confidently delivered truth.

You can't tell the difference until your code breaks two hours later in a way that takes another hour to debug.

The fix isn't a smarter model. It's making Claude's output checkable in real time and making "I don't know" cheaper than guessing.

4 layers below. Together they cut fabrication to roughly zero.

Layer 1: The CLAUDE.md honesty rules

The first layer is a set of rules in CLAUDE.md that tell Claude exactly when to admit uncertainty and exactly how. Drop this in your project root:

These rules look obvious.

They aren't, because by default Claude is optimized to look helpful, and "I don't know" feels unhelpful unless you give it explicit permission.

The last line is the most important one. It's the "I don't know" license, and most people never grant it.

Layer 2: The verification-before-write pattern

The second layer forces Claude to verify before it writes. Add this to CLAUDE.md under the honesty rules:

This costs Claude a few extra tool calls per session. It saves you the hours you would've spent debugging fake function calls.

Layer 3: The hooks that catch lies in real time

The third layer is hooks in settings.json that run a type checker or linter every time Claude writes a file. If Claude invented an import, the checker fails instantly, and Claude has to fix it before claiming the task is done.

Hook output goes back to Claude as context. If tsc says "Cannot find module 'foo'", Claude sees it immediately and fixes the fabricated import. No invented code survives a PostToolUse check.

For tasks involving tests, add a Stop hook that runs the suite before Claude can declare the session done:

Now Claude can't say "done, tests pass" without actually running them. The hook runs them.

The result goes back to Claude. If they fail, Claude has to fix them or admit they don't pass.

Layer 4: The fact-checker subagent

The fourth layer is a subagent whose only job is to review Claude's claims before they ship.

Drop this in .claude/agents/fact-checker.md:

Invoke this agent before commits or before sharing results with your team. It catches the lies the other 3 layers missed.

The "I don't know" license

Claude was trained to be helpful, and admitting ignorance feels unhelpful. So it guesses, and the guess looks right.

The fix is granting permission to not know. CLAUDE.md is half of it. Your reaction is the other half. Reward "I haven't verified this" with patience and you get honest Claude every session. Punish it with frustration and Claude goes back to guessing.

Not a config, a habit. The most underrated fix in the stack.

How to tell it's actually working

Three signs in your daily sessions.

Claude asks before adding dependencies. "Should I add X or use the stdlib?" instead of silent npm install.

Claude references file:line when it talks about existing code. "validateToken in src/auth/middleware.ts:47 does Y" instead of "the validateToken function does Y."

tsc and your linter stop screaming. Hooks catch the rare fabrications instantly and Claude self-corrects, so by the time you look, the lies are gone.

Not seeing these after a day or two? One layer isn't loaded. Usually CLAUDE.md, wrong location or wrong name.

Common mistakes that keep Claude lying

CLAUDE.md is too long. Claude reads the first part and skims the rest. Honesty rules in the first 50 lines.

Hooks log silently. If output doesn't reach stdout, Claude doesn't know it lied. Make sure hook output goes back to the session.

You skip plan mode. That's where Claude exposes wrong assumptions before writing. Skip it and you skip the cheapest moment to catch lies.

You don't call the fact-checker. A subagent only works if you actually invoke it. Make @fact-checker part of your commit flow.

You react badly to "I don't know." Punish honesty once and Claude goes back to guessing. The other 3 layers don't stick without this one.

The 5-minute honesty audit

1 minute: copy the CLAUDE.md honesty rules and verification protocol into your project root.

1 minute: copy the hooks block into ~/.claude/settings.json or .claude/settings.json.

2 minutes: create .claude/agents/fact-checker.md with the template above.

1 minute: run a task you'd normally double-check. Watch for tsc output coming back to Claude. Confirm Claude says "verified" or "I haven't verified this" explicitly.

Done. Fabrication drops from "every other session" to "rare and caught immediately." The model didn't get smarter. Your setup did.

Thanks for reading!

X Article
831260354.7K
Reading tools
Keep it forever

Create a free account to save everything you preview β€” private to you.

Preview another link

Works with X, Instagram, TikTok & YouTube.

One place for everything
Tweets, TikToks, Reels, Shorts & articles in one searchable home.
Media at your fingertips
Full-screen viewer for photos and video β€” save any post to your collection.
Actually find it later
Full-text search across everything you save.