Most disappointment with AI doesn't start with the model. It starts two seconds earlier, when you're writing the request. The difference between "this is useless" and "this is exactly it" is usually five extra sentences. I'll show you which five and why.
I'll write about Claude Code, because that's what I work in, but the structure works anywhere. It doesn't matter if you're in a terminal or in a chat.
A prompt has four parts
A good prompt isn't longer, it's more complete. It's usually missing one of four things:
- Context. Where you are, what already exists, what's allowed and not allowed in the project.
- Goal. What should be done and how you'll know it is.
- Constraints. What not to touch, which tools to use, what's off limits.
- Output format. Do you want code, a plan, a list, one file, or a diff.
If you leave one of them out, the model fills it in on its own. And it fills it in based on the average of the internet, not based on your project.
Context: say where you're standing
The model doesn't see your disk, doesn't know your habits and doesn't remember what you did last time. Context is what fills in its blind spot.
Bad version:
Add login.Better version:
Project: Next.js 16, App Router, TypeScript, files in src/.
I use Tailwind v4 for styles, components are in src/components/.
I don't have a database yet, users are kept in a simple JSON file.
Add login with email and password.Four extra lines and the model stops guessing. It won't suggest a library that doesn't work with your framework version, and it won't create a folder you don't have in your project.
tip
Don't retype context that repeats in every message. Put it in a CLAUDE.md file in
the root of your project. Claude Code reads it automatically, so your requests stay
short and the rules always apply.
Goal: describe the result, not the steps
This is the most common trap. People describe how the model should do it, instead of describing what should come out. The result is that the model follows the instructions and misses the point.
Bad version:
Create a function that goes through an array, calls the API for each item
and saves the result to another array.Better version:
I want to load order details for a list of IDs I have in an array.
There are usually around fifty orders, and the API can handle five requests at once.
If one request fails, the rest must still finish, and I want to see the error
in the return value, not in the console.The first version gets a loop that fires fifty requests at once and falls over completely at the first error. The second version gets a sensible solution, because the model knows what should happen in edge cases. Describing the edge cases is usually more important than describing the main case.
Constraints: say what it shouldn't touch
The model tends to be helpful beyond what you asked for. It rewrites your config, adds a library, renames a file "to make it nicer". When you're halfway through a project, that's the last thing you want.
Constraints are short and they work:
Don't change anything outside src/components/Formular.tsx.
Don't add new dependencies, make do with what's in package.json.
Don't run the build, just write the code.The last line matters more than it looks. When you know a build is already running somewhere else, or that the tests take fifteen minutes, it saves you a lot of waiting.
Especially useful constraints
- "Tell me the plan first, wait for my ok, and only then write code."
- "If you're not sure, ask, don't guess."
- "Stick to the style that's already in that file."
That second sentence is gold. Without it the model would rather make up an answer than admit it's missing information.
Output format: say what you want back
The last part is the cheapest and the one most often missing. Without it you get an essay when you wanted a list, or three files when you wanted one.
Give me only the contents of that one file, no explanations.Give me a numbered list of steps, one sentence per step. Don't write code yet.Give me a table: a problem column, an impact column, a suggested fix column.Output format is the fastest way to cut an answer in half. The model doesn't write long because it wants to, but because nobody told it how short.
Putting it all together
This is what a request looks like when it has all four parts and still fits on one screen:
Context:
Next.js 16, App Router, TypeScript, Tailwind v4. Components in src/components/.
We have a shared Section component, use it instead of your own wrapper.
Goal:
A /kontakt page with a form (name, email, message). After submitting, a
confirmation shows on the same page, without a redirect. Empty fields
and an invalid email are reported next to the specific field, not at the top.
Constraints:
No new dependencies. For now just log the submission on the server, I'll handle
the backend later. Don't touch globals.css.
Output:
First a plan in five points, wait for my ok. Then the code, one file.It's not a magic formula and you don't have to follow it slavishly. But every time the model gives you back something off, go through those four points and you'll find which one you left out. Nine times out of ten it's the constraints or the format.
What to do when it still doesn't fit
Don't keep fixing a bad answer over and over. Go back a step and write the request again, in different words, but with what you've learned in the meantime. A conversation with five failed attempts in it confuses the model more than it helps.
And when a prompt structure works for you, save it. That's exactly why I have ready-made prompts to download in tools, including the ones I use for images and video. You don't have to reinvent what already worked once.
Kafe a cígo, fajně si sednout a jdeme na to.
Coffee and a smoke, get comfy and let's go.
Vojta Horava
Want to know when the next one is out?
Now and then I write about what's new: a video, a tool, an article. Unsubscribe with one click.
