AI

Prompt engineering guide: from beginner to pro

Prompt engineering is the skill of writing instructions that get reliable, high-quality results from AI models. For everyday users it means better answers. For developers and businesses it means AI features that work the same way for thousands of users. This guide goes from basics to professional techniques.

Level 1: the fundamentals

  • Be clear and specific: say exactly what you want, for whom and why.
  • Give context: background facts, audience, purpose, constraints.
  • Specify the format: table, bullets, JSON, word limit, language.
  • Show examples of good output (few-shot prompting).
  • Iterate: treat the first answer as a draft.

The simple formula: role, task, context, format, examples. See how to write good AI prompts for everyday examples.

Level 2: techniques that raise quality

Explain the why

Models follow instructions better when they know the purpose: “Keep answers under 80 words because customers read them on small phone screens” works better than a bare limit.

Structure long prompts

Separate instructions, context and data clearly, for example with headings or tags such as <curriculum>…</curriculum> and <instructions>…</instructions>. Put long documents first and your question at the end.

Ask for step-by-step reasoning on hard problems

For maths, planning and analysis, ask the model to work through the problem before answering, or to check its answer afterwards. Many modern models also have built-in “thinking” modes that do this automatically.

Break work into a chain

Instead of one giant prompt: research → outline → draft → review → final. Each step is easier to check and improve.

Ground answers in sources

“Answer using only the documents below. If the answer isn’t there, say you don’t know.” This is the core of retrieval-augmented generation (RAG) and the best defence against hallucinations.

Let the model ask questions

“Before you start, ask me any questions you need.” Cheap and very effective.

Level 3: prompt engineering for AI products

System prompts

Apps set a system prompt that applies to every conversation: who the assistant is, who it serves, what it may and may not do, its sources, tone, format and what to do when unsure (hand over to a human).

Structured outputs

When code needs to read the answer, ask for a defined format (for example JSON with named fields). Many AI APIs can enforce a schema so the output always parses.

Tools

Describe tools (like check_order_status) clearly: what they do, when to use them and what each parameter means. Good tool descriptions are prompt engineering too.

Test with an evaluation set

Professionals don’t judge prompts by one good answer. They build a set of 30 to 100 real inputs with expected results, run every prompt change against it and track the score: correct facts, right format, appropriate refusals, tone. Change one thing at a time.

Security: prompt injection

Text from users, websites or documents can contain instructions that try to hijack your assistant (“ignore your rules and…”). Treat such text as data, limit what tools can do, require human approval for risky actions, and never put secrets in prompts.

Common mistakes

  • Vague instructions and no context.
  • Contradictory rules piled up over time.
  • Writing in ALL CAPS and “NEVER” everywhere instead of explaining the reason.
  • Not testing on tricky, real inputs.
  • Trusting outputs without checking facts.

Practise for free

Our free AI from zero to pro course covers prompting with a live exercise, fact-checking, custom assistants, AI APIs, RAG and agents. Business owners: see AI in business. Trainers: see prompt engineering for teachers and trainers.

Frequently asked questions

What is prompt engineering?

Prompt engineering is designing instructions, context and examples so that AI models produce reliable, high-quality results, from everyday questions to AI features in apps.

Is prompt engineering a real job?

Yes, usually as part of AI engineering, automation or product roles: writing system prompts, designing workflows and testing them with evaluation sets.

What is a system prompt?

Instructions an app gives an AI model for every conversation: its role, rules, sources, tone, format and what to do when unsure.

Related guides

AI

What is AI? A beginner’s guide for Kenyans (and how it can help you)

Artificial intelligence explained simply: what AI is, where you already use it, what it’s good and bad at, and how to start using it free today.

· 3 min read
AI

How to write good AI prompts (with examples you can copy)

A simple formula for great AI answers (role, task, context, format, examples), weak vs strong prompts for Kenyan situations, and a reusable prompt template.

· 3 min read
AI

How to use AI in your business in Kenya (practical guide)

Practical ways Kenyan businesses use AI: social media, product descriptions, customer replies, WhatsApp, pricing and automation, safely.

· 3 min read
Chat with us