Back to the blog
AI · Prompting

Prompt Engineering Fundamentals: Getting Better Answers from AI

Nine concrete techniques that consistently improve LLM output.

Most people talk to AI models the way they'd type into a search box — a few keywords and a hope. But large language models respond to instructions, and the quality of your instructions largely determines the quality of what you get back. Prompt engineering is simply the skill of writing those instructions well. Here are nine techniques that make an immediate, repeatable difference — no coding required.

1. Give it context and a role

A model has no idea who you are or why you're asking unless you tell it. Front-load the context: who you are, what you're trying to achieve, and who the output is for. Assigning a role focuses the model's "voice" and expertise.

Weak: "Write about compound interest."
Strong: "You are a patient financial educator. Explain compound interest to a 16-year-old who has never invested, using one concrete real-world example. Keep it under 200 words."

2. Be specific about the output you want

Vague prompts produce vague answers. Specify length, tone, audience, and purpose. "Make it shorter" is weaker than "Cut this to three bullet points a busy manager could skim in ten seconds." The model can only hit a target it can see.

3. Show examples (few-shot prompting)

One of the most powerful techniques is simply demonstrating what you want. Give the model two or three examples of an input and the ideal output, then ask it to continue the pattern. This "few-shot" approach dramatically improves consistency for formatting, tone, and structured tasks.

Turn product features into benefits.

Feature: 10-hour battery life
Benefit: Work all day without hunting for a charger.

Feature: End-to-end encryption
Benefit: Your messages stay yours — no one else can read them.

Feature: 2-minute setup
Benefit:

4. Ask it to think step by step

For anything involving reasoning — maths, logic, planning, debugging — asking the model to "work through this step by step before giving the final answer" measurably improves accuracy. It gives the model room to reason instead of blurting a guess. This is often called chain-of-thought prompting, and it's one of the highest-value habits you can build.

5. Set constraints and format

Tell the model exactly what shape you want the answer in: a table, JSON, a numbered list, a tweet, a formal email. Constraints reduce rambling and make outputs easier to use. "Respond only with a valid JSON object using the keys title, summary, and tags" will get you something you can drop straight into code.

6. Iterate instead of restarting

Your first prompt rarely produces the perfect answer, and that's fine — treat it as a conversation. Instead of scrapping everything and rewriting, refine: "Good, but make the tone warmer," or "Keep the structure, but replace the second example with something from healthcare." Steering an existing answer is faster and usually better than starting over.

7. Tell it what not to do

Negative constraints are surprisingly effective. "Don't use jargon," "Avoid marketing language," or "Do not invent statistics — if you're unsure, say so" all sharpen the output. Models are eager to please and will often pad or embellish; a clear "don't" keeps them honest.

8. Use delimiters for messy input

When you paste in a block of text for the model to work on, wrap it in clear delimiters so it knows where your instructions end and the material begins. Triple quotes, XML-style tags, or a simple label all work:

Summarise the review below in one sentence.

Review:
"""
The battery is great but the app crashes every time
I try to change settings, which is really frustrating.
"""

This prevents the model from confusing the content with the command — a common cause of weird results.

9. Ask it to check its own work

After a complex answer, a follow-up like "Review your response for errors or unsupported claims and correct them" often catches mistakes. You can also ask it to rate its own confidence, or to list any assumptions it made. This won't make a model infallible, but it reliably raises the floor on quality.

Putting it together

A strong prompt usually combines several of these: a role, clear context, a specific ask, a format, and maybe an example. You don't need to use all nine every time — start with context and specificity, then add techniques as the task demands. The more precise your instructions, the less the model has to guess, and the better your results.

Prompting is a skill, which means it rewards practice. Keep a notes file of prompts that worked well; you'll build a personal toolkit faster than you'd expect. And if you want to understand why these techniques work, it helps to know what's happening inside the model — which is exactly what our next article covers.


These are the habits that stuck for me. If you have found a trick I did not mention, send it my way and I will add it.

— yydev