Why patterns?
Prompt engineering concepts only get you so far. Patterns are the reusable templates you reach for in real work — copy, adapt, deploy. Each one solves a recurring problem category.
Pattern 1 — Instruction + Context + Constraints + Format (ICTF)
The universal template for single-turn tasks. Cover all four parts and you've eliminated most of the ambiguity that causes bad outputs.
[INSTRUCTION]
Summarise the following customer feedback.
[CONTEXT]
The customer had a billing issue that was resolved after
three support emails over five days.
Feedback: "{feedback_text}"
[CONSTRAINTS]
- Maximum 3 bullet points
- Each bullet max 15 words
- Neutral tone — no sentiment judgement
[FORMAT]
• [bullet 1]
• [bullet 2]
• [bullet 3]
| Part | What it does |
|---|---|
| Instruction | The verb — what action to perform |
| Context | The input data and relevant background |
| Constraints | Rules the output must follow |
| Format | The exact output structure — show it, don't describe it |
Pattern 2 — ReAct (Reason + Act)
For agentic tasks where the model must decide which tool to call, then observe the result, then decide again. Used in most agent frameworks under the hood.
You have access to these tools:
- search(query): searches the web and returns a summary
- calculator(expr): evaluates a math expression
Answer the user's question by following this loop:
Thought: [reason about what to do next]
Action: [tool_name(arguments)]
Observation: [result from the tool]
... repeat as needed ...
Final Answer: [your answer to the user]
Question: What is 15% of the current Bitcoin price in USD?
The key is the explicit Thought/Action/Observation structure — it forces the model to reason before acting and to incorporate tool results before deciding what to do next.
Pattern 3 — Critic-Refine loop
Generate a first draft, then critique it, then refine. This two-pass approach produces significantly better output than asking for perfection in one shot.
Pass 1 — Generate
Write a product description for a noise-cancelling headphone
aimed at remote workers.
Pass 2 — Critique
Here is the draft:
[draft from pass 1]
Critique this description. Identify:
1. What is weak or generic?
2. What benefit is missing?
3. What word choice could be stronger?
Pass 3 — Refine
Using the critique above, rewrite the product description.
Address every weakness identified. Keep it under 80 words.
You can combine all three passes into a single prompt, or run them as separate API calls. The three-call version is slightly better because each pass has full attention on its task.
Pattern 4 — Planner → Executor
Separate planning from execution. One call produces a step-by-step plan; subsequent calls execute each step. This prevents the model from rushing to a conclusion before thinking through the approach.
Planner call
Task: Write a technical blog post about FAISS vector search.
Before writing, produce a numbered plan:
- List each section heading
- One sentence on what each section will cover
- Identify any code examples needed
Output ONLY the plan. Do not write the post yet.
Executor call (per section)
Plan: [plan from previous call]
Write section 2: "How FAISS indexing works"
Follow the plan exactly. 150–200 words.
Planner→Executor is especially powerful for long-form content, complex code tasks, and multi-step analysis where structure matters.
Pattern 5 — Role + Task + Format combo
The everyday workhorse for production system prompts. Three lines that cover identity, the job, and the output shape.
ROLE: You are a senior data analyst specialising in e-commerce metrics.
TASK: Analyse the sales data below and identify the top 3 underperforming
product categories with reasons.
FORMAT: Return a JSON array of objects with fields: category, revenue_drop_pct,
reason (1 sentence), recommendation (1 sentence).
The explicit labels (ROLE / TASK / FORMAT) help the model parse the structure of your instruction — especially useful when the prompt is long or complex.
Choosing the right pattern
| Task type | Pattern |
|---|---|
| Data extraction, summarisation, classification | ICTF |
| Agent with tools, web search, APIs | ReAct |
| Writing, content quality improvement | Critic-Refine |
| Long-form content, complex code, analysis | Planner→Executor |
| System prompt for a product feature | Role+Task+Format |
Notes
ICTF overhead is not always justified
For simple one-shot tasks (classify this sentence as positive or negative), the full ICTF template adds unnecessary tokens without improving quality. Match your prompt structure to task complexity — ICTF is most valuable when the task has multiple input sources, complex constraints, or a non-obvious output format.
ReAct loops need a maximum iteration guard
Without an explicit iteration limit, a ReAct agent can loop indefinitely if tool results never satisfy the model's expectations — for example, a search that never returns the answer it is looking for. Always implement max_iterations with a fallback response to prevent infinite loops and unbounded API cost.
Critic-Refine quality drops when all three passes are combined
Combining generate, critique, and refine into a single prompt makes the critique shallow — the model is lenient about its own output in the same context. Separate API calls for each pass produce noticeably better results because each step gets full attention without competing with the prior output.
Planner-Executor dramatically increases total token usage
Each executor call includes the full plan in context. A 10-section plan with 200 tokens per executor call adds 2,000 tokens of overhead per execution step. For large plans, pass only the current step and a brief plan summary rather than the full plan text to control cost at scale.
Prompt Patterns FAQ
What is the ICTF prompt pattern?
ICTF stands for Instruction + Context + Constraints + Format. It is the universal template for single-turn tasks: tell the model what to do (Instruction), provide relevant background (Context), define rules the output must follow (Constraints), and show the exact output structure (Format).
What is the ReAct prompting pattern?
ReAct (Reason + Act) is a prompting pattern for agentic tasks where the model must decide which tool to call, observe the result, then decide again. It uses an explicit Thought / Action / Observation loop — the same structure used by most agent frameworks under the hood.
What is the Critic-Refine loop?
The Critic-Refine loop is a two-pass prompting approach: first generate a draft, then critique it, then rewrite using the critique. This produces significantly better output than asking for perfection in one shot, and works especially well for writing and content improvement tasks.
When should I use the Planner-Executor pattern?
Use Planner-Executor for long-form content, complex code tasks, and multi-step analysis where structure matters. The first call produces a numbered plan; subsequent calls execute each step individually. This prevents the model from rushing to a conclusion before thinking through the approach.
Can I combine multiple prompt patterns together?
Yes. Patterns compose well. For example, a ReAct agent can use the Role+Task+Format combo in its system prompt, and the Planner-Executor can use ICTF for each executor call. Start with the pattern that best matches your task type, then layer others as needed.
Quick summary
- ICTF — universal template: Instruction + Context + Constraints + Format
- ReAct — Thought/Action/Observation loop for agents with tools
- Critic-Refine — generate → critique → rewrite for higher output quality
- Planner→Executor — plan first, execute in steps, prevents rushing to conclusions
- Role+Task+Format — concise 3-line system prompt for production features