Bad prompts waste more time than bad code.
You spend 30 minutes debugging. You finally turn to AI and type:
Fix this bug.
You get a generic, surface-level answer. Useless. You go back to debugging alone.
Sound familiar?
The problem is not the AI. The problem is the prompt. And the fix is simpler than you think.
The Mental Model: AI is a New Team Member on Day One
Here is the one idea that changes everything:
AI is like a brilliant developer who just joined your team today.
They are sharp. They are fast. They have read every textbook and documentation ever written. But they know absolutely nothing about:
- Your codebase
- Your tech stack
- Your team's conventions
- The constraints you are working under
- What "done" actually looks like for this task
Would you walk up to a new team member and say "fix the bug" and walk away?
No. You would give them a proper briefing.
That is exactly what a good prompt is — a briefing document for a capable person who just arrived.
The 5-Part Briefing Formula
Every solid prompt answers these 5 questions. You do not need all 5 every time, but the more you include, the better your answer.
1. ROLE — Who should the AI be?
Set the expertise level and perspective you need. This shapes the tone, depth, and technical accuracy of the response.
# Weak
Review my code.
# Strong
You are a senior backend developer specialising in Node.js performance.
Review this code for memory leaks and inefficient async patterns.
A security expert looks for different things than a performance engineer. Telling AI who to be is the fastest way to get the right lens on your problem.
2. TASK — What exactly do you need?
Be specific. Vague tasks get vague answers. Every word of ambiguity in your task is a coin flip the AI has to make on your behalf.
# Weak
Fix this bug.
# Strong
Find why this function throws a NullPointerException when the
input list is empty, and suggest a minimal fix without
refactoring the surrounding logic.
The more precisely you describe the job, the more accurately AI can do it.
3. CONTEXT — What is your situation?
This is the step most developers skip, and it is the one that matters most. Without context, AI gives you the answer for the average situation — which is probably not yours.
# Weak
Why is my API returning errors?
# Strong
Stack: Node.js 20, Express 5, deployed on AWS Lambda.
The POST endpoint /api/checkout returns a 502 error only when
the request body exceeds 1MB. Smaller payloads work fine.
The error appears in CloudWatch as "Task timed out after 3s."
Tell AI your stack, your environment, what you have already tried, and what "correct" looks like. The more specific the context, the more targeted the answer.
4. FORMAT — How should it respond?
Tell AI the shape of the output you need. Do you want a code snippet? A list of options? A one-line explanation? A full refactor?
# Weak
(nothing — let AI decide)
# Strong
Give me:
1. The root cause in one sentence
2. The minimal code fix (no full rewrites)
3. One sentence explaining why this fix works
Without a format instruction, AI guesses. Sometimes it writes an essay when you needed three lines. Tell it upfront.
5. AVOID — What should it not do?
This is the most underused part of any prompt. Negative instructions are guardrails. They stop AI from going down paths that waste your time.
# Weak
(nothing — hope for the best)
# Strong
Do not suggest migrating to a different framework.
Do not refactor unrelated functions.
Do not add new dependencies.
If you know what you do not want, say it. It saves two or three follow-up rounds of "no, not that."
A Full Example: Before and After
Let's put it all together with a real debugging scenario.
❌ Before — a wish
My React component is re-rendering too many times. How do I fix it?
✅ After — a briefing
ROLE: You are a senior React developer focused on performance optimisation.
TASK: Find why this component re-renders on every parent state change
even though its own props have not changed.
CONTEXT: React 18, functional components, using Context API for global state.
The component is a data table with 200+ rows. Re-renders are causing visible
lag on low-end devices. I have already tried wrapping it in React.memo
but it did not help.
FORMAT: Give me the most likely cause first, then the fix as a
code snippet, then a one-line explanation of why it works.
AVOID: Do not suggest rewriting the component in a class-based style.
Do not suggest switching to Redux or Zustand.
Same problem. Second prompt gets a targeted, actionable answer. First prompt gets a textbook definition of React.memo.
The 30-Second Checklist
Before you hit send on any non-trivial prompt, run through this:
| ✅ | Check | Question |
|---|---|---|
| ☐ | ROLE | Have I told it who to be? |
| ☐ | TASK | Is the task specific and unambiguous? |
| ☐ | CONTEXT | Have I shared my stack, constraints, and what I've tried? |
| ☐ | FORMAT | Do I know what the output should look like? |
| ☐ | AVOID | Are there paths I want to close off upfront? |
You do not need all five every time. A quick "what does X do" needs none of this. But for anything complex — debugging, architecture decisions, code reviews, refactoring — running this checklist takes 20 seconds and saves you 20 minutes.
One More Thing: Iterate, Don't Restart
When the first answer is not quite right, most developers throw the whole prompt away and start over.
Do not do that.
AI remembers the full conversation. Build on it:
Make the explanation shorter.
Now show me how this would look with TypeScript types added.
What edge cases does this fix not cover?
Think of it as pair programming, not a vending machine. Each follow-up sharpens the answer without repeating all the context.
Summary
The formula is simple:
ROLE → TASK → CONTEXT → FORMAT → AVOID
AI is not magic. It is a capable colleague with no context about your situation. Give it the briefing it needs and the results will surprise you.
Developers who prompt well ship faster. Developers who prompt poorly keep re-asking.
What's Next?
If this was useful, I also wrote about the deeper engineering mental models behind prompt design — things like prompt chaining, constraint calibration, and few-shot patterns for production pipelines.
Drop a comment with the most frustrating AI interaction you have had. Chances are one of these five parts was missing.
Found this useful? Drop a ❤️ and share it with a teammate who keeps complaining that AI is useless.
Top comments (0)