Please enable JavaScript to use CodeHS

AI Literacy

How to Write a Good AI Prompt

A chatbot can only work with the words you give it. Vague words get vague answers. Learn five simple parts that make a prompt clear, practice with a builder, and learn how to check what the AI tells you.

AI Literacy ~20 min Beginner friendly

The clarity dial

Your prompt

    Start Here

    A prompt is just your instructions

    A chatbot is a program you can talk to by typing. A prompt is the message you type to it. It can be a question ("Why is the sky blue?") or an instruction ("Quiz me on fractions").

    Think about ordering at a sandwich shop. If you say "Make me food," the worker has to guess everything. If you say "A turkey sandwich on wheat, no tomatoes, cut in half," you get what you wanted. Prompts work the same way.

    Vague order

    "Make me food."

    The worker guesses. You might get soup when you wanted a sandwich.

    Clear order

    "Turkey on wheat, no tomatoes, cut in half."

    The worker knows what to do. You get what you pictured.

    AI model
    The program that learned patterns from huge amounts of text, so it can write new text.
    Chatbot
    An app, like ChatGPT, Gemini, or Claude, that lets you talk to an AI model.
    Prompt
    The words you give the chatbot to tell it what you want.

    A prompt is not magic. There is no secret spell that makes an AI always right. A clear prompt helps the chatbot understand you. It does not make the answer true. You still have to read it and check it.


    The Recipe

    The 5 parts of a clear prompt

    Good prompts often include some of these five parts. Remember them as Role, Task, Context, Format, Limits. You do not need all five every time. The Task is the only one you always need.

    Interactive: tap a part, or tap the text

    You are a patient science tutor. Explain why volcanoes erupt. I'm in 7th grade, and my class just started a unit on Earth's layers. Use five short bullet points and one real-life example. Keep it under 120 words and avoid hard vocabulary.

    Pick a part

    Each part of the example prompt has its own color, number, and underline style. Choose one to see what it does.

    Here is the same idea in plain words. Each part answers one question the AI would otherwise have to guess:

    • Role: Who should the AI act as? A tutor, a coach, an editor.
    • Task: What do you want it to do? Explain, give feedback, quiz you.
    • Context: What should it know about you and your situation?
    • Format: What shape should the answer take? A list, steps, a short paragraph.
    • Limits: What should it avoid, or stay inside? Word count, simple words, no spoilers.

    Side by Side

    Weak prompt, strong prompt

    Pick a situation. Compare what you type, and what a chatbot might say back.

    The answers below are hand-written examples to show the idea. They are not live AI output. A real chatbot may answer differently.

    Weak You type
    Explain photosynthesis.
    Example answer (illustration)

    Photosynthesis is the process by which autotrophs convert light energy into chemical energy stored in glucose, using chlorophyll in the chloroplasts. The light-dependent reactions occur in the thylakoid membranes, while the Calvin cycle occurs in the stroma...

    • Too hard. The AI did not know your grade.
    • No format, so it is one big block of text.
    • You cannot tell if it fits your unit.
    Strong You type
    Act as a friendly science tutor. Explain photosynthesis. I'm in 7th grade and I get confused by the word "chloroplast." Use three short steps and one analogy. Define any science word you use.
    Example answer (illustration)

    Step 1: A plant takes in sunlight, water, and carbon dioxide from the air.

    Step 2: Tiny green parts inside its leaves, called chloroplasts, act like little kitchens that use the sunlight.

    Step 3: The plant makes sugar for food and gives off oxygen.

    Analogy: It is like a solar-powered kitchen that bakes sugar.

    • The grade level and the hard word are in the prompt.
    • You asked for steps, so it is easy to scan.
    • You can ask for a quiz next.

    Try It

    Prompt Builder

    Fill in the parts. Your prompt builds itself on the right. You can leave a part empty and watch the clarity meter change.

    Who should the AI act as?
    What do you want the AI to do?
    What should it know about your situation? Leave out private details.
    What shape should the answer take?
    What should it avoid or stay inside?

    Your prompt

    Start typing a task and your prompt will show up here.
    Clarity: add a task0 / 100

    This meter is a rough guide. It only counts which parts you filled in. It cannot tell if your prompt is a good idea, and it cannot tell if the answer will be correct.

      Heads up: that looks like personal information, such as an email, phone number, or password. Take it out before you share a prompt with any chatbot.


      Practice

      Fix this prompt

      Each round shows a weak prompt. Pick the best rewrite. You will see why each choice works or does not.

      Round 1 of 5

      The weak prompt

      Which rewrite is best?


      Keep Going

      Your first prompt does not have to be perfect

      A chat is a back-and-forth. If the first answer is not right, follow up. Treat it like talking with a helper, not like a vending machine. Press the button to see a chat grow one follow-up at a time.

      This chat is a hand-written example, not live AI output.

      You
      Why do volcanoes erupt?
      Chatbot (example)

      Eruptions occur when buoyant magma rises through the crust and dissolved gases expand rapidly as pressure drops, forcing the magma out through a vent.

      Three follow-ups worth learning

      • "Make it simpler."Say your grade, or ask for an analogy or a shorter answer.
      • "What should I check?"Ask where you could confirm the facts. Then go and check them yourself.
      • "Check your own answer."Ask what might be wrong or unsure. This often helps, but it is not proof.

      Always verify. Chatbots can say wrong things in a very confident voice. People call this a hallucination. Asking the AI to check itself can catch some mistakes, but it can also repeat them. For anything that matters, such as facts for a report, check a trusted source like your textbook.

      Also notice that the same prompt can give different answers on different tries. Here is why that happens.


      Stay Safe and Honest

      Prompts that go wrong

      A good prompt is not only a clear prompt. It is also a safe and honest one. Here are three ways prompts go wrong.

      1. Sharing private info

      What you type may be stored, and people at the company may be able to see it. Do not paste personal details into a chatbot.

      What happens to what you type

      2. Hidden instructions

      If you paste text from a web page or email, it might hide instructions meant for the AI, like "ignore the user." This is called prompt injection. Treat pasted text as untrusted.

      What is prompt injection?

      3. Passing off AI work as yours

      Copying an AI answer and turning it in as your own is usually cheating. Ask your teacher what is allowed, and say when you used AI.

      Using AI responsibly for homework

      Usually fine to put in a prompt

      • A math problem from your worksheet
      • A question about a topic you are studying
      • Your own draft, if your teacher allows it
      • "Quiz me on these vocabulary words"

      Keep out of a prompt

      • Your full name, address, or phone number
      • Passwords or login codes
      • Your school name together with other details about you
      • Private details or photos of friends or family

      You are still the thinker. Use the chatbot to understand, practice, and get feedback. Then do the thinking and the writing yourself. That is how you actually learn, and it is the honest way to use AI for school.


      Quick Answers

      Quick answers

      What is an AI prompt?

      A prompt is the message you give an AI chatbot. It can be a question, an instruction, or both. The chatbot uses your words, plus the earlier messages in the chat, to write its answer.

      What makes a good prompt?

      A good prompt is clear about what you want. A handy checklist is role, task, context, format, and limits: who the AI should act as, what you want done, what it should know about your situation, what shape the answer should take, and what it should avoid. The task is the only part you always need.

      Does a longer prompt always work better?

      No. Clear beats long. A short prompt with the right details usually works better than a long prompt that rambles or asks for five things at once. Add details that change the answer, and leave out the rest.

      Why does the AI give a different answer when I ask the same thing again?

      Chatbots often add a bit of randomness when they pick each word, so the same prompt can produce different wording, and sometimes different content. A clearer prompt usually makes the answers more alike, but it will not make them identical every time. Read more in Why AI gives different answers.

      Can a perfect prompt make the AI always right?

      No. Chatbots can state wrong things in a confident voice, which people call hallucinations. A good prompt can reduce mistakes, but you should still check important facts in a trusted source such as your textbook or a reliable website.

      Is it cheating to use AI for school?

      It depends on your teacher's rules, so ask. Using AI to understand a topic, get feedback, or quiz yourself is often allowed. Turning in AI-written work as your own usually is not. When in doubt, ask your teacher and say how you used the tool. See Using AI responsibly for homework.


      Check Yourself

      Quick quiz

      1. Which prompt gives the chatbot the most to work with?

      2. A chatbot gives you a surprising fact for your report. What is the best next step?

      3. Which of these is the safest thing to put in a prompt?

      Keep learning about using AI well

      You now know how to ask clearly, follow up, and stay safe. Next, find out why chatbots give different answers, or go deeper into prompting and responsible use.

      Related: What Is AI Literacy? · What Is Prompt Injection? · What Happens to What You Tell a Chatbot