Kodokon kodokon.com

Advanced prompting techniques: role, constraints, examples, reasoning

Combine an expert role, strong constraints, few-shot examples, step-by-step reasoning, and iteration to get answers that genuinely make you learn.

10 min · 3 questions

Open this lesson in Kodokon

The quality of what the AI teaches you depends directly on the quality of your prompts. A vague prompt - "explain generics to me" - produces a generic answer, calibrated for an average reader who doesn't exist. Four techniques radically change the yield, and they combine: the expert role (setting who's speaking and with what standard), strong constraints (length, prerequisites, prohibitions, format), few-shot examples (showing the expected format instead of describing it), and step-by-step reasoning (demanding the method before the conclusion). The fifth isn't a writing technique but a posture: iteration - the first answer is a draft you refine, never a finished product.

PROMPT
You're a senior instructor in [tech], known for your dense, filler-free explanations.

Explain [precise concept] to me with these constraints:
- Assume I already know [prerequisites]: don't re-explain any basics.
- 200 words maximum, then ONE minimal commented example.
- End with ONE question that tests whether I truly understood - not a recall question, an application question.
- If the concept has a classic gotcha in production, flag it in one sentence.

Wait for my answer to your question before continuing. If my answer is wrong, don't give the correction: point out where my reasoning goes off track and let me try again.
Prompt: expert role + strong constraints, in the service of active learning

Let's break it down. The role isn't there to flatter the model: it shifts the register of the answer - vocabulary, level of abstraction, standard. The constraints do the rest: "200 words maximum" cuts the filler, "don't re-explain any basics" spares you three paragraphs you already know, and the closing question turns passive reading into active recall - the best-established mechanism of memorization. General rule: a vague constraint produces a vague result. "Be concise" constrains nothing; "200 words, one example, one question" constrains everything. On to few-shot: when describing the format gets tedious, show it.

PROMPT
I'm reviewing [topic]. Generate practice questions in the EXACT format of the two examples below.

Example 1:
Situation: a query returns 10,000 rows while the screen shows 20.
Question: which mechanism avoids loading everything, and what's its hidden cost?
Level: intermediate.

Example 2:
Situation: two users modify the same resource one second apart.
Question: which conflict-handling strategy should you choose here, and why?
Level: advanced.

Generate 5 questions on [topic] following this format: a concrete situation drawn from real work, an open-ended question that forces reasoning (never rote recall), a level. Don't give the answers: I'll answer one by one and you'll correct me by pointing out what my reasoning is missing.
Prompt: few-shot - two examples beat a paragraph of specification

Few-shot exploits models' foremost strength: pattern continuation. Two well-chosen examples specify the tone, the granularity, and the structure more precisely than ten lines of instructions - and your examples also set the standard. Last writing technique: step-by-step reasoning. For any non-trivial question, demand the method before the conclusion. An answer that opens with the conclusion deprives you of the essential: the path, which is precisely what you're trying to learn. Bonus: explicit reasoning exposes its own flaws - you catch the false assumption about your context before swallowing a wrong conclusion.

PROMPT
Before answering, reason in visible steps.

My question: [non-trivial technical question].

Required format:
1. Restate my question to confirm you've understood it.
2. List the assumptions you're making about my context (versions, architecture, volume). I'll correct the ones that are wrong.
3. Walk through your reasoning step by step, flagging each point where another path was possible and why you didn't take it.
4. Conclude by separating what's certain from what depends on my answers to point 2.

Write the conclusion only after the reasoning, never before.
Prompt: the method before the conclusion, with explicit assumptions

That leaves iteration, the skill that sets the advanced user apart. Never restart a prompt from scratch when the answer disappoints: diagnose the gap and fix the missing constraint. Too long? Impose a limit. Too generic? Add your context and an example. Off-topic? The restatement in point 1 shows you where the misunderstanding crept in. Three or four targeted iterations produce answers no initial prompt, however careful, could have obtained - and each iteration teaches you something about what you were really looking for.

Knowledge check

Make sure you remember the key points of this lesson.

  1. What is the few-shot technique?
    • Asking several short questions rather than one long one
    • Providing examples of the expected result so the model continues the pattern
    • Limiting the answer to a small number of words
    • Splitting a problem into sub-problems
  2. Why demand the reasoning BEFORE the conclusion in an answer?
    • To slow the AI down and save resources
    • Because the path is what you learn, and explicit reasoning lets you see its flaws
    • Because AI conclusions are always wrong
  3. The AI's answer is correct but too generic. What's the best next move?
    • Ask the exact same question again hoping for better
    • Switch AI tools
    • Iterate: add your precise context and a constraint that targets the observed gap