NEWFree courses in AI, data, cloud and cybersecurity — start learning today
Artificial Intelligence

Prompt Engineering: 10 Techniques That Get Better Results From AI

10 practical prompt engineering techniques, with copy-ready examples, to get more accurate and useful answers from ChatGPT, Claude, Gemini and other AI tools.

Prompt Engineering — illustration
Table of contents
  1. What is prompt engineering?
  2. 1. Be specific about the task
  3. 2. Assign a role
  4. 3. Provide context
  5. 4. Specify the output format
  6. 5. Use examples (few-shot prompting)
  7. 6. Ask for step-by-step reasoning
  8. 7. Set constraints and boundaries
  9. 8. Ground the model in source material
  10. 9. Break big tasks into a chain
  11. 10. Iterate and ask for critique
  12. A reusable prompt template
  13. Common prompting mistakes
  14. Conclusion
  15. Frequently asked questions

Key takeaways

  • Most bad AI answers come from vague prompts — specificity is the single biggest improvement you can make.
  • Give the model a role, context, task and output format.
  • Examples and step-by-step instructions dramatically improve accuracy on complex tasks.
  • Always verify important facts — AI models can sound confident and still be wrong.

Generative AI tools can draft emails, summarise reports, write code and brainstorm ideas in seconds. Yet many people try them, get a generic or inaccurate answer and conclude that AI "isn't that useful". In most cases, the problem is not the model — it is the prompt.

Prompt engineering is the skill of writing instructions that get AI models to produce exactly what you need. Below are ten practical techniques, each with a copy-ready example, that work with modern chatbots such as ChatGPT, Claude and Gemini.

What is prompt engineering?

Prompt engineering is the practice of designing and refining the input you give an AI model so that its output is accurate, relevant and in the right format. A large language model predicts the most likely helpful response based on your words — so the clearer and richer your instructions, the better the result.

1. Be specific about the task

Vague requests get vague answers. Specify the topic, audience, length, tone and purpose.

Weak:   Write about cloud computing.
Strong: Write a 150-word introduction to cloud computing for small
        business owners with no technical background. Use a friendly
        tone and end with one practical next step.

2. Assign a role

Telling the model who to be helps it choose the right vocabulary, depth and perspective.

You are an experienced cybersecurity trainer. Explain phishing to
new employees at a 20-person accounting firm.

3. Provide context

The model does not know your situation unless you tell it. Share relevant background: your goal, constraints, what you have already tried and who will read the result.

4. Specify the output format

Ask for exactly the structure you need — a table, bullet list, JSON, email or step-by-step checklist. This saves editing time and makes output easier to reuse.

Compare Python, JavaScript and Go for a beginner. Return a table
with columns: Language, Best for, Learning curve, Example projects.

5. Use examples (few-shot prompting)

Showing one to three examples of what you want is often more effective than describing it. This is called few-shot prompting.

Turn feature descriptions into short benefit statements.

Feature: 256-bit encryption
Benefit: Your files stay private, even if your laptop is stolen.

Feature: Automatic daily backups
Benefit:

6. Ask for step-by-step reasoning

For maths, logic, analysis or planning tasks, ask the model to work through the problem step by step before giving a final answer. Breaking problems down tends to reduce errors on multi-step tasks.

A course costs $40 per month with a 20% annual discount if paid
yearly. Work through the calculation step by step, then give the
total yearly cost.
Recommended free coursePrompt Engineering & Generative AI for ProfessionalsBeginner · 3 weeks · 3–5 hours/week View course

7. Set constraints and boundaries

Tell the model what to avoid as well as what to do: word limits, reading level, topics to exclude, or "only use the information provided below".

8. Ground the model in source material

To reduce made-up facts (often called hallucinations), paste the relevant document and ask the model to answer only from it — and to say when the answer is not in the text.

Using only the report below, list the three biggest risks it
mentions. If the report doesn't mention risks, say so.

[paste report here]

Protect sensitive data. Before pasting documents into any AI tool, check your organisation's policy and remove confidential or personal information you are not permitted to share.

9. Break big tasks into a chain

Instead of asking for a complete 3,000-word report in one go, split the work: first an outline, then each section, then a review. This prompt chaining gives you control at every stage and produces more coherent results.

10. Iterate and ask for critique

Treat the first response as a draft. Ask follow-up questions, request changes, or ask the model to critique its own answer against your criteria:

Review your answer above. Is anything inaccurate, unclear or
missing for a beginner audience? Then provide an improved version.

A reusable prompt template

Combine the techniques above into a simple template you can adapt for almost any task:

ROLE:     You are a [role/expertise].
CONTEXT:  [Background, audience, goal, constraints]
TASK:     [Exactly what you want done]
FORMAT:   [Structure, length, tone]
EXAMPLES: [Optional: 1–3 examples of good output]
CHECK:    If anything is unclear or missing, ask me before answering.

Common prompting mistakes

  • Asking for too much at once — split complex work into steps.
  • Accepting the first answer — the best results usually come after one or two refinements.
  • Not verifying facts — always check statistics, quotes, citations and code before using them.
  • Forgetting the audience — the same topic needs very different answers for experts and beginners.

Want to understand why these techniques work? Our beginner's guide to what machine learning is explains how models learn from data.

Conclusion

Prompt engineering is less about secret tricks and more about clear communication. Be specific, provide context, show examples, define the format, break down complex tasks and always verify the result. Master these ten techniques and you will get dramatically better value from every AI tool you use.

Frequently asked questions

What is prompt engineering?

Prompt engineering is the practice of writing and refining instructions for AI models so that they produce accurate, relevant and well-formatted output for a specific task.

Do these techniques work with every AI chatbot?

Yes. Techniques such as giving context, providing examples and specifying an output format work across modern large language models, although results vary between models.

How do I stop AI from making things up?

Give the model the source material to work from, ask it to say when it does not know, request citations to the provided text and always verify important facts yourself.

Is prompt engineering a real job?

Some companies hire dedicated prompt engineers, but more commonly prompting is a core skill for developers, marketers, analysts and other professionals who use AI daily.

ST
SmartTechWorld Editorial Team

Our editorial team writes practical, beginner-friendly guides to help people learn technology skills and build careers in tech. Last updated November 6, 2026.