home/writing/anatomy-of-an-effective-prompt

Anatomy of an Effective Prompt

GPTClaudeGemini··558 copies·updated 2026-07-14
anatomy-of-an-effective-prompt.prompt
# Anatomy of an Effective Prompt

## Why this matters

There is no single "best prompt." There is, however, a small set of building blocks that good prompts share, and an order that tends to work. If you know the blocks, you can put them together for a new task quickly and tear an existing prompt apart when it misbehaves. Without that vocabulary you will rewrite the same prompt three times and not know which change mattered.

## The six building blocks

Most useful task prompts are some subset of:

1. **Role / persona** — who the model is supposed to be ("You are a senior contracts lawyer.").
2. **Task instruction** — what it should do ("Summarize the agreement in five bullets.").
3. **Context** — what it should do it *to* and *with* (the document, the user's question, retrieved snippets, prior conversation).
4. **Constraints** — bounds on the answer (length, scope, what *not* to do, tone, language).
5. **Format** — the exact shape of the output (JSON object, Markdown table, numbered list, plain prose).
6. **Examples (few-shot)** — one or more worked examples of the task; covered in chapter 3.

You do not need all six every time. Reach for whichever block plugs the failure mode in front of you.

## A skeleton you can adapt

A reliable starting layout, expressed as a system prompt + user message split:

when to use it

Community prompt sourced from the open-source GitHub repo ai-engineering-curriculum/agentic-ai-developer-learning (MIT). A "Anatomy of an Effective Prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

writingcommunitygeneral

source

ai-engineering-curriculum/agentic-ai-developer-learning · MIT