Lesson 3
Prompting Basics for Technical Work
Learn how role, task, context, constraints, and output format make prompts more reliable.
A good technical prompt tells the AI the role, task, context, constraints, and desired output format. The more checkable your request is, the easier it is to judge whether the answer is useful.
The five-part prompt structure
Use this structure for most technical prompts:
- Role: what perspective should the AI take?
- Task: what should it do?
- Context: what facts, code, data, or requirements matter?
- Constraints: what should it avoid or preserve?
- Output format: how should the answer be shaped?
You do not need all five parts every time, but missing context is the most common reason for weak answers.
Weak prompt vs useful prompt
Weak:
Make this function better.
Useful:
Act as a TypeScript reviewer. Refactor this function for readability without changing behavior. Keep the public API the same. Explain risky assumptions and suggest two test cases.
The second prompt makes the answer easier to evaluate.
Add examples when format matters
If you need JSON, SQL, Markdown, or a specific naming style, include a small example. Examples reduce ambiguity and help the model match your expected shape.
When the output will be parsed by software, ask the model to return only the target format and no commentary.
Ask for assumptions
For technical work, ask the AI to list assumptions before final recommendations. This makes hidden guesses visible and gives you something concrete to check.
Reusable prompt template
Use this template when the task matters:
Act as [role].
Task: [specific task].
Context: [relevant code, data, requirements, or symptoms].
Constraints: [what must stay unchanged, what to avoid, risk level].
Output: [format, length, sections, or schema].
Before the final answer, list assumptions and verification steps.
For code tasks, add the test command or review standard. For writing tasks, add the audience and the source material that should be preserved.
Common prompting mistakes
- Asking for a final answer before the problem is defined.
- Omitting the expected output format.
- Providing too much irrelevant context and hiding the important constraint.
- Asking for confidence instead of evidence.
- Forgetting to say what should not change.
Key takeaways
- Good prompts reduce ambiguity; they do not guarantee correctness.
- Context, constraints, and output format matter more than clever wording.
- Examples are especially useful when you need structured output.
- A reusable prompt template turns prompting from improvisation into a reviewable workflow.
Next lesson
Next, apply these prompting habits to code, debugging, and review workflows.