9.1 — Writing a prompt for Claude Code: agent versus chatbot
A chatbot only sees what you paste into the conversation. So you give it the code, the files and the architecture. Claude Code is an agent. It reads your files, searches your codebase, runs commands and looks at the git history. This difference changes what you write in a prompt.
What Claude finds on its own and what it can't see
Claude starts every task by reading your code. It finds the folder layout, the conventions and the test framework there. It also sees how existing components are written. You don't need to copy any of that for it.
What it lacks is whatever was never written in the repository.
- The symptom your users notice.
- The result you expect.
- A decision made in a meeting.
- Your preference between two reasonable approaches.
A good prompt brings this information. The Claude Code docs suggest a two-question test before you write anything down. Could Claude find it by reading the code? Would it actually go and look? If both answers are yes, leave that information out.
Three things to give
For a specific fix or change, the docs advise giving three things.
1. The symptom. What happens today, as the user sees it.
2. The place. The file or folder involved, when you know it.
3. The expected result. What must be true once the work is done.
# Chatbot style: you dictate the change
In src/utils/sort.ts, line 42, replace a.date - b.date with b.date - a.date
# Too short: Claude has to guess what is wrong
Fix the order sorting
# Agent style: symptom, place, expected result
The order list shows the oldest orders first.
I want the most recent first. Sorting happens in src/utils/sort.ts.
Write a test that fails with the current code, then fix it.
The first prompt works, but you already did the whole analysis yourself. If your diagnosis is wrong, Claude may apply your change without looking further. The third one lets Claude confirm the cause. The test then shows that the fix works.
Hand over what you already have
When you already have the information, hand it over instead of describing it. Type @ followed by the path to attach a file. Paste the screenshot of the error or the mockup. Send a log from your shell with cat error.log | claude -p "explain this error". Section 2.7 covers these options.
A vague request has its place too
When you're exploring, an open question works very well. "What would you improve in this file?" is a good example. You'll correct a bit more along the way. Keep specific prompts for tasks where you know what you want.
Key takeaways
• Claude Code reads your code on its own. Your prompt is there to tell it what the code doesn't say.
• A specific prompt gives the symptom, the place and the expected result.
• A file, a screenshot or a log goes in directly with @, a paste or a pipe.
• An open question is enough when you're exploring.
