Skip to main content
AI and Developer Tools 5 min read · 1,013 words

How to Write Better AI Prompts: A Practical Framework with Examples

Get clearer, more useful answers from AI assistants. Learn a simple prompt framework, see before-and-after examples and avoid common prompting mistakes.

N

By Naeem

Published

AI and Developer Tools

Two people can ask the same AI assistant about the same subject and get completely different quality of answers. The difference is almost always the prompt. A prompt is simply the instruction you give, but small changes in how you write it can turn a vague, generic answer into something you can actually use. You do not need technical knowledge or special tricks. You need clarity. This guide explains a simple framework and shows how to apply it.

Why Prompts Matter

A language model predicts useful text based on the information you provide. It cannot read your mind, and it does not know your audience, your goals or your preferences unless you say so. When a prompt is vague, the model fills the gaps with the most average assumptions. That is why a request like "write a blog post about coffee" produces something bland: you did not tell it who the reader is, what angle to take or how long it should be.

The Five-Part Framework

A strong prompt usually contains these elements. You do not always need all five, but the more complex your task, the more of them you should include.

  1. Role: who the assistant should act as, for example "an experienced personal finance writer".
  2. Task: what exactly you want done, using a clear action verb such as summarize, compare, rewrite, list or explain.
  3. Context: the background the model needs, such as the audience, purpose, situation or source material.
  4. Constraints: limits on length, tone, format, vocabulary or things to avoid.
  5. Output format: how the answer should be structured, such as a table, numbered steps or three short paragraphs.

A Before-and-After Example

Weak prompt: "Tell me about budgeting."

Better prompt: "You are a friendly personal finance coach. Explain the basics of budgeting to a college student who has a part-time job and no savings. Use plain language, avoid jargon, and give five practical steps they can start this week. Keep it under 300 words."

The second version names the audience, the tone, the number of steps and the length. The answer will be far more focused, and you will spend less time asking follow-up questions.

Techniques That Improve Results

Be specific about the goal

Say what the output is for. "Draft an email asking my landlord to repair the heater, polite but firm, under 120 words" is much better than "write an email to my landlord".

Provide examples

If you want a particular style or format, show one or two examples of what you consider good. Models are very good at imitating patterns. This is often called few-shot prompting.

Ask for step-by-step reasoning on complex problems

For math, logic and planning tasks, asking the model to work through the problem step by step usually reduces errors, and it lets you check the reasoning.

Break large tasks into stages

Instead of asking for a complete business plan in one prompt, ask for the outline first, review it, then expand each section. You keep control and can correct direction early.

Set the audience

"Explain this to a ten-year-old" and "explain this to a software engineer" will give completely different answers. Name the reader.

Specify the format

If you need a table, ask for a table. If you need JSON, describe the exact fields. Clear format instructions make the output easier to paste into other tools.

Give permission to say "I do not know"

You can reduce made-up answers by adding: "If you are not sure, say so instead of guessing." Language models can sound confident even when they are wrong.

Iterate Instead of Starting Over

Your first prompt is a draft. Treat the first answer as feedback on your prompt. If it is too long, say "shorter". If it is too formal, say "more conversational". Specific feedback such as "keep the second paragraph but replace the examples with ones from small businesses" works better than "try again".

Common Prompting Mistakes

  • Being too vague. Words like "good", "nice" or "professional" mean different things to different people.
  • Stacking many unrelated requests in one prompt, which splits the model's attention.
  • Giving contradictory instructions, such as "be very detailed" and "keep it under 50 words".
  • Forgetting to provide the source text. The model cannot summarize an article it has not seen.
  • Pasting sensitive personal or company data into tools without checking the privacy policy.
  • Trusting the output without verification. Facts, figures, legal details and medical information should always be checked against reliable sources.

Reusable Prompt Templates

Here are patterns you can adapt:

  • Summary: "Summarize the following text in five bullet points for a busy manager. Highlight any deadlines. Text: [paste text]"
  • Rewrite: "Rewrite this paragraph to be clearer and more concise while keeping the original meaning. Keep a friendly tone. Paragraph: [paste text]"
  • Study helper: "Explain [topic] as if I am a beginner, then give me three practice questions with answers hidden at the end."
  • Comparison: "Compare [option A] and [option B] in a table covering cost, ease of use and best-fit scenarios."
  • Critique: "Act as a strict editor. List the five biggest weaknesses in this draft and suggest a fix for each."

Think About Length and Cost

Longer prompts use more tokens, which matters if you pay per use or if you are working near a model's input limit. Include what is necessary, and remove repetition. If you are building something on an AI API, you can check the size of your prompt with our free AI Token Counter and API Cost Estimator before you send it.

Final Thoughts

Good prompting is simply good communication. Tell the assistant who it is helping, what you need, what it should know, how long the answer should be and how it should look. Then review the result critically and refine it. With a little practice, you will get better answers in fewer attempts.

Try It Free · 100% In-Browser

AI Token Counter & API Cost Estimator

Count prompt tokens instantly and compare LLM API pricing across GPT, Claude, Gemini, and Llama with an editable cost table.

Launch Tool →
N

Written by

Naeem

Naeem writes practical, no-fluff guides on developer workflows, web performance, privacy-first utilities, digital finance math, and focused productivity.

Keep exploring practical tutorials by Naeem.

All Guides →