Kodokon kodokon.com

Anatomy of a good prompt

Structure your requests with the 4 ingredients - context, task, constraints, format - to get genuinely useful answers.

8 min · 3 questions

Open this lesson in Kodokon

A prompt is simply the message you send to the AI: your question, your request, your instructions. It is the only lever you have, and it is decisive: the same AI can produce a mediocre or an excellent answer depending on the quality of the prompt. The rule is the same as with a human: a vague request gets a vague answer. Let's compare.

PROMPT
Explain loops to me.
BEFORE: a vague prompt. The AI has to guess everything.

Faced with this prompt, the AI has to guess: loops in which language? For what level? In one line or in ten pages? With or without examples? It will pick average answers to all these questions, and you will get a generic explanation, neither tailored nor memorable. Now let's add the missing information.

PROMPT
CONTEXT: I'm a complete beginner in programming. I know variables and if/else conditions in JavaScript, nothing else. Loops are a totally new concept for me.

TASK: explain what a loop is and what it's for, with an everyday-life analogy, then a single ultra-simple example in JavaScript, commented line by line.

CONSTRAINTS:
- Simple vocabulary, every technical term defined at its first appearance.
- Maximum 15 lines of explanation.
- Show only one type of loop for now.

FORMAT: 1) the analogy, 2) the commented example, 3) a question to test my understanding.
AFTER: the same topic, but a structured prompt.

This second prompt contains the 4 ingredients of a good request. The context: who you are, what you already know, what you don't know yet - this is what allows for an answer at YOUR level. The task: what you expect, with a precise verb (explain, compare, correct, quiz…). The constraints: the limits of the answer (length, vocabulary, what NOT to do). The format: the expected shape (list, numbered steps, table, closing question…).

PROMPT
CONTEXT: I'm a beginner in [topic]. Here's what I already know: [what you know]. Here's what's blocking me: [your difficulty].

TASK: [explain / compare / correct / ask me questions about] [the precise concept].

CONSTRAINTS:
- Adapt to my level, define every technical term.
- Don't give me the full solution: guide me step by step.
- [maximum length, language, other limits]

FORMAT: [numbered list / explanation + example / question-and-answer], and end with a question that checks my understanding.
A fill-in-the-blank CTCF template: copy it and fill in the brackets.

One last essential point: a prompt is not an exam you have to pass on the first try. A conversation with an AI is iterative: if the answer is too complicated, reply "rephrase it more simply"; too long, "sum it up in 5 lines"; off topic, add the missing context. Each follow-up refines the result. The best AI users are not those who write a perfect prompt, but those who hold a dialogue.

Knowledge check

Make sure you remember the key points of this lesson.

  1. What are the 4 ingredients of a good prompt seen in this lesson?
    • Politeness, length, vocabulary, signature
    • Context, task, constraints, format
    • Question, answer, example, conclusion
    • Title, introduction, body, conclusion
  2. Why does the prompt "Explain loops to me" produce a mediocre answer?
    • Because the AI doesn't know about loops
    • Because it is rude to give an order to an AI
    • Because the AI has to guess the language, your level, and the format, and picks generic answers
  3. The AI's answer is correct but far too complicated for you. What do you do?
    • You give up: this concept is too hard
    • You continue the conversation by asking for a simpler rephrasing, adapted to your level
    • You copy the answer hoping to understand it later