AI

Prompt Engineering Guide: How to Get Better Results From AI

A practical prompt engineering guide: the structure of a good prompt, examples, giving context, asking for formats, avoiding hallucinations and prompts for coding and business.

On this page 8 sections
  1. 01The five parts of a strong prompt
  2. 02Before and after
  3. 0310 prompt techniques that work
  4. 04Prompts for developers
  5. 05Prompts for business
  6. 06How to reduce AI hallucinations
  7. 07Prompting for AI agents
  8. 08Frequently asked questions

Short answer: A good prompt tells the AI who it is helping, what the task is, the context it needs, the format you want, and examples of good output. Be specific, give real material to work with, ask for one task at a time, and review the result. Clear instructions beat clever tricks.

Most bad AI output comes from vague input. Here is the simple structure I use for coding, writing and client work.

The five parts of a strong prompt

  1. Goal: what you want done
  2. Context: background, audience, constraints
  3. Material: the actual text, data, code or notes
  4. Format: length, structure, tone, file type
  5. Examples: what good looks like (optional but powerful)

Before and after

Weak: “Write a description for my website.”

Strong: “Write a 150-character meta description for the services page of a dental clinic in Karachi. Audience: families looking for a trusted dentist. Mention same-day appointments and the clinic name, Golden Smile. Friendly, not salesy. Give me three options.”

The second prompt has goal, context, constraints and format. The result is usable on the first try.

10 prompt techniques that work

  1. Be specific about the output. “A table with three columns” or “bullet points under 15 words”.
  2. Give the AI the source material. Paste the article, error message or data instead of describing it.
  3. Say who the audience is. A beginner and an expert need different answers.
  4. Show an example of the style you want.
  5. Break big tasks into steps. Outline first, then each section.
  6. Ask it to ask you questions when the task is unclear.
  7. Set constraints. Word limits, things to avoid, tone.
  8. Ask for reasoning on hard problems. “Think through the options, then recommend one.”
  9. Iterate. Treat the first reply as a draft and give feedback.
  10. Ask it to check its own work against your requirements.

Prompts for developers

  • “Here is my function and the error. Explain the cause and give the minimal fix.”
  • “Write unit tests for this function covering edge cases. Don’t change the function.”
  • “Review this code for security issues, especially input validation and SQL injection.”

See more in AI tools for developers.

Prompts for business

  • “Turn these meeting notes into a client email with next steps and deadlines.”
  • “Summarise these 20 customer reviews into the top five complaints and top five compliments.”
  • “Draft five FAQ answers for my website based on this service description.”

How to reduce AI hallucinations

  • Provide the facts yourself instead of asking the AI to recall them
  • Ask it to say “I don’t know” when unsure
  • Ask for sources and then check them
  • Verify numbers, names, dates and legal or medical claims

Prompting for AI agents

When an AI agent works on its own, instructions matter even more: state the goal, the tools it may use, what it must never do, and when to stop and ask a human.

Frequently asked questions

Is prompt engineering a real job?

Some companies hire for it, but it is more often a skill inside other jobs: developers, marketers, writers and analysts who use AI well.

Do prompts work the same in ChatGPT, Claude and Gemini?

The same principles work in all of them. Each model has small differences, so test important prompts in the one you use.

How long should a prompt be?

As long as it needs to be clear. Short prompts are fine for simple tasks; complex tasks benefit from detailed context and examples.

Can AI write content for my website?

It can draft, but you should add real experience, check facts and edit for your voice. Search engines and readers reward original, helpful content.

→keep reading

You might also like