The Anatomy of a Great Prompt

Roles, context, format, and constraints — the four building blocks that separate a mediocre AI interaction from a truly powerful one.

Most people hand the AI a task and wonder why the result feels generic. The reason is almost always the same: the task alone is not enough. A task tells the AI what to do. The four layers tell it how to do it — from whose perspective, with what background, in what form, and within what guardrails.

Think of it like hiring a brilliant freelancer. Saying “write me a blog post” gets you something. Saying “you’re a fintech copywriter, our audience is CFOs who distrust AI, write 800 words in a confident-but-measured tone, no bullet points, open with a counterintuitive claim” — that gets you something publishable.

Layer 1: Role

Who is the AI in this conversation?

The Role is the first thing you set — and the one most beginners skip entirely. Assigning a role is not roleplay. It’s a compression mechanism. When you tell the AI it’s a “senior product manager,” you’re implicitly loading decades of expertise, vocabulary, assumptions, and reasoning patterns into every response that follows.

Without a role, the AI tries to serve everyone — which means it truly serves no one. With a strong role, every word it chooses, every example it reaches for, and every assumption it makes is calibrated to that expertise.

Layer 2: Context

What does the AI need to know to do this well?

Context is the information the AI cannot guess. It’s the background that transforms a generic response into one that’s genuinely useful for your situation. Without context, the AI writes for a theoretical average user. With context, it writes for your exact audience, at your exact moment, in your exact situation.

Context has three dimensions worth thinking through: your audience, your goal, and your constraints of reality (budget, timeline, existing assets, what’s already been tried). You don’t need all three every time, but the more relevant context you provide, the narrower and more useful the response becomes.

Prompt Workbook — Ready to use prompts: 50 ready-to-run prompts, 6 full role playbooks, Connector cheatsheets and Global Instructions Kit

Get Instant Access

Layer 3: Format

What shape should the output take?

Format is the most immediately impactful layer — and the most underused. If you don’t specify format, the AI guesses. Sometimes it guesses right. Often it produces five paragraphs when you needed three bullets, or a wall of text when you needed a table, or a generic structure when your medium demands something entirely different.

Format operates on several levels simultaneously: the macro structure (numbered list vs prose vs table), the section-level organisation (what headers exist, in what order), and the micro-level choices (sentence length, use of bold, whether to include examples inline).

Layer 4: Constraints

What rules must the output follow?

Constraints are the guardrails — the explicit limits that prevent the AI from drifting into territory you don’t want. They’re different from format (which is about shape) because they’re about what not to do as much as what to do.

The underrated power of constraints is that they force you to articulate your preferences. Most people know what they don’t want only after they see it. Constraints make that knowledge explicit upfront, which saves iteration cycles and produces cleaner first drafts.

Putting it all together

The four layers aren’t a rigid checklist you must follow in sequence. They’re a mental model — a set of questions you ask yourself before hitting send. When a prompt underperforms, you can now diagnose exactly why: missing role, thin context, ambiguous format, or absent constraints.

The most experienced prompt engineers internalise this so thoroughly that they do it in seconds. They look at a task and automatically ask: who should the AI be, what does it need to know, how should this look, and what should it avoid? Once that becomes reflex, every output gets dramatically better.

Prompt Workbook — Ready to use prompts: 50 ready-to-run prompts, 6 full role playbooks, Connector cheatsheets and Global Instructions Kit

Get Instant Access


The Anatomy of a Great Prompt was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Liked Liked