Blog / prompts
How to write prompts that get working code
The quality of what an AI builds is mostly the quality of what you ask for. A good prompt is not clever. It is clear about the goal, the context and the finish line.
The recipe
- Say the goal in one sentence: what should exist when this is done.
- Say what is already there: the files, the stack, the constraints.
- Say how you will know it worked: what you will click or run.
- Ask for one change at a time.
Describe the behaviour, not the code
Say what the user sees and does. “When someone submits the form, show a thank-you message and clear the fields” leaves the model room to choose the implementation and gives you something you can test.
Give an example
One concrete example of the input and the output you expect removes a lot of guessing. If something looked right in another product, say so and describe it.
Keep requests small
A request that changes five things at once is hard to review and hard to undo. Smaller steps mean you can see which one broke the app.
Tell it what not to change
Models like to tidy. If a file works, say that it should not be touched. This prevents surprise rewrites.
When the answer is wrong
- Say what you expected and what happened instead.
- Include the exact error message.
- Point to the file and line if you know them.
- Ask it to explain its plan before it changes anything.
Save the prompts that worked
When a prompt gets a good result, write it in your build log. Next time you will not start from nothing, and other builders can borrow it.
Keep your own build log
Write numbered entries, follow other builders, and let people watch your idea become real.
Join vibFolio