High-Value Prompting Strategies
The best prompt pattern depends on the job. Below are the main strategies that matter most in real engineering usage.
Role prompting
Use this when expertise matters. It helps set the right perspective, vocabulary, and level of analysis.
Few-shot prompting
Give one or two examples when you want consistency. This is useful for code review formats, naming conventions, JSON structure, and data extraction tasks.
Constraint prompting
Use explicit limits like framework version, security rules, budget, response length, or forbidden approaches. Constraints reduce creative drift.
Planning then execution
Best for multi-step tasks. Ask for a plan first, then implementation. This improves control and helps you catch bad assumptions early.
Self-check prompting
Ask the model to review its own output for missing assumptions, edge cases, and contradictions. This is useful, but do not blindly trust the self-check.
When to use which strategy
| Situation | Best strategy | Why |
|---|---|---|
| Code review | Role + structured output | Produces review comments in a predictable format. |
| Transforming data | Few-shot + constraints | Examples strongly improve consistency. |
| Large feature design | Plan then execute | Lets you validate direction before implementation. |
| Production incident analysis | Role + self-check | Encourages root-cause thinking and caution. |