Loading...
Loading...
Core principles of prompting — role assignment, clarity, specificity, and the anatomy of a great prompt
Prompt engineering is the craft of designing inputs to language models that reliably produce the outputs you want.
[Role] You are a helpful assistant with expertise in [domain].
[Task] Your task is to [specific action].
[Context] Here is the context: [relevant information]
[Format] Please format your response as: [output structure]
[Constraints] Do NOT: [things to avoid]| Wrong | Why | Right |
|---|---|---|
| "Tell me everything about..." | Too broad | Be specific |
| "Fix this code" | Vague | "Fix security vulnerabilities" |
| No format instructions | Random output | Specify structure |
| Contradictory instructions | Model confused | Check consistency |
Improve this vague prompt: "Explain machine learning."
Rewrite using the four elements: Role, Task, Context, Format.