How to Write Prompts That Actually Work
A practical framework — not theory
Most bad AI output isn't a model problem. It's a prompt problem. The same model that gives you a generic, hedge-everything answer to a vague prompt can give you something sharp and specific if you structure the request differently. Here's the framework we use inside PromptLab's auto-engineer feature, broken down so you can apply it manually too.
The four parts of a working prompt
Every prompt that reliably produces good output has some version of these four elements, even if they're not labeled:
1. Role
Tell the model what perspective to answer from. Not "you are a helpful assistant" — that's the default anyway. Be specific: "you are a senior backend engineer reviewing this code for production readiness" changes the vocabulary, the assumptions, and the level of detail you get back.
2. Context
Models can't read your mind or your codebase. If the task depends on constraints — a tech stack, an audience, a tone, a prior decision you've already made — state it. Omitted context is the single biggest cause of generic output.
3. Task
Say exactly what you want done, as a verb: "summarize," "rewrite," "critique," "generate three variations," "find the bug." Vague tasks like "help me with this" force the model to guess your intent, and it will guess conservatively.
4. Format
Specify how you want the answer structured — bullet points, a table, JSON, under 200 words, no preamble. Without this, models default to a safe middle ground: some prose, some structure, usually longer than you wanted.
A before-and-after example
Weak prompt:
Strong prompt:
The second version doesn't just get you a better answer — it gets you a predictable answer, which is what actually matters when you're iterating.
Common mistakes
- Stacking too many tasks in one prompt. "Write this, then critique it, then rewrite it" tends to produce a rushed version of all three. Split into separate turns.
- Assuming the model remembers your style. Unless you're in the same conversation, restate tone and constraints each time.
- Not specifying what to exclude. "Don't use corporate jargon" or "no bullet points" is often more useful than describing what you do want.
- Treating the first output as final. Prompt engineering is iterative — refine based on what came back rather than starting over.
Where this fits into PromptLab
PromptLab's auto-engineer feature applies this framework automatically — you give it a rough idea, and it fills in role, context, format, and task structure before sending it to the model. The template library takes this further with pre-built structures for common jobs like code review, marketing copy, and security analysis, so you're not rebuilding the same scaffolding every time.
TRY THE PROMPT ENGINEER →