Phase 04 · Prompt engineering Core

Role, context & constraints

The workhorse prompt structure: who the model is (role), what it needs to know (context), and the exact boundaries of an acceptable answer (constraints).

In plain terms

Compare 'write about our product' with: 'You're a copywriter for busy nurses (role). Our app auto-fills medical forms; users hate typing (context). Write 3 subject lines under 40 characters, no exclamation marks, no word free (constraints).' The second is answerable; the first is a coin flip.

Why it matters

Models fill every gap you leave with the most generic choice - average tone, average length, average audience. Prompts fail far more often from missing information than from missing magic words. Role/context/constraints is a checklist that systematically closes the gaps.

How it works

Role shifts vocabulary, priorities and depth ('senior security auditor' != 'friendly tutor'). Context is the situation: audience, purpose, background facts, what's been tried. Constraints define done: length, format, tone, what to include, what to never do, and how to behave when unsure. For long prompts, separate sections with XML-ish tags (<context>...</context>) - models parse structure well.

When you use it

Every prompt beyond a throwaway question. This is the template your system prompts grow from.

Common mistakes

  • Prompt-blaming the model before checking: 'could a smart human answer well with only what I wrote?' Usually no.
  • Vague quality words ('make it engaging', 'keep it short') instead of measurable ones ('under 100 words, one concrete example').
  • Contradictory constraints buried in a wall of text ('be comprehensive' + 'be brief').

Best practices

  • Read your prompt as a stranger; every ambiguity you find, the model will find too.
  • Put the most important instruction first AND restate it last in long prompts.
  • Say what to do instead of only what not to do.

Try it yourself

Take the worst prompt you've written this week. Rewrite it with explicit role, context, and 3+ measurable constraints. Run both. The gap is your before/after portfolio piece.

Resources