Day 02·Foundations·2 min read

Prompt anatomy and frameworks

A strong prompt states the role, task, context, constraints and output format. TAG, CO-STAR and RISEN are checklists for those same parts, not techniques in their own right.

By the end

Name the parts of a strong prompt, rewrite a vague prompt into one that states them, and spot which missing part caused a generic answer.

A strong prompt states the role, the task, the context, the constraints and the output format. Frameworks like TAG and CO-STAR are checklists for those same parts. Learn the parts first and the acronyms become labels for them.

Learn

  • The parts. Role (who the model is), task (what to do), context (audience, purpose, background), constraints (length, tone, must and must-not), format (shape of the answer), and examples (Day 3).
  • System vs user prompt. The system prompt sets standing behavior. The user turn carries the request and the data.
  • Delimiters. Wrap data in XML tags or triple quotes so the model can tell instructions from material. This also blunts prompt injection, because untrusted text is visibly marked as data.
  • Say what to do, not only what to avoid. "Avoid generic phrases" works partially. "Use a concrete product detail and an unexpected image" works better. Banning a phrase can even prime it.
  • Give the reason. "Keep it under 10 words because it runs on a bottle cap" beats a bare rule, because the model can apply the reason to cases the rule did not name.

Frameworks you will see named

FrameworkStands forBest for
TAGTask, Action, GoalQuick task prompts
RTFRole, Task, FormatSimple structured outputs
CO-STARContext, Objective, Style, Tone, Audience, ResponseWriting and marketing copy
RISENRole, Instructions, Steps, End goal, NarrowingMulti-step procedures

These are memory aids, not techniques. Tests care whether you can spot the missing part, not the acronym. ReAct, which sounds similar, is a different idea covered on Day 6.

Drill

  1. Start from "Write taglines for our water bottle."
  2. Rewrite it with CO-STAR, then with TAG.
  3. Compare the outputs and note which missing part caused the original to be generic.

Check yourself

  • Why is a positive instruction usually stronger than a negative one?
  • What two jobs do XML tags do in a prompt?

Test yourself

6 multiple-choice questions and 9 flashcards on this lesson, shuffled every time, with the reason behind every answer.