Avoiding Common AI Pitfalls
Claude is incredibly smart, but it's not a human. It's a predictive text engine that is very, very good at guessing what word should come next. Because of this, it is susceptible to specific pitfalls that can trip up beginners.
If you understand how it fails, you can write prompts that prevent it from failing.
The Hallucination Problem
The most famous AI flaw is the "hallucination." A hallucination happens when Claude confidently states something as fact, or writes a piece of code, that is entirely made up.
For example, if you ask Claude to use a very obscure, brand-new NPM library, it might generate code calling functions that simply do not exist in that library. It’s guessing what the functions should be called based on similar libraries.
How to avoid it: Provide the documentation! If you are using a new or niche tool, upload the library's README.md file using the attachment button. If Claude has the docs in its context window, it won't need to guess.
The "Lazy" Code Output
Sometimes you ask Claude to modify a massive, 500-line React component. Instead of giving you back the whole 500 lines with the fix, it will give you this:
// ... existing code above ...
function doTheThing() {
// your fixed code is here
}
// ... rest of the code remains the same ...
This is intentionally designed to save processing time and tokens. But if you're a beginner, figuring out exactly where to paste that snippet can be incredibly frustrating.
How to avoid it: Explicitly demand full output.
"Fix the bug in the
doTheThingfunction. Return the entire, complete file. Do not use placeholders or comments like 'existing code here'."
Context Contamination
If you've been talking to Claude in the same chat window for 3 hours about a React frontend issue, and then you suddenly ask it to write a Python script for your backend, things will get weird.
Claude reads the entire history of the chat every time you send a message. If the chat is full of JavaScript context, that context will "contaminate" your new Python request. Claude might try to use JavaScript logic in the Python script.
How to avoid it: Start new chats! Treat a chat window like a single ticket in Jira. When the task is done, close the window. If you switch to a new task, open a fresh chat. This keeps the context window clean and laser-focused on the problem at hand.