Skip to Main Content

Reference Guide • 14 min read

Prompt Formulas: 12 Proven Patterns for AI Prompting

Quick Answer

Prompt formulas are reusable structural patterns for writing effective AI prompts. The 12 most important formulas are: STCO (structured multi-constraint tasks), Chain-of-Thought (step-by-step reasoning), Few-Shot (example-based learning), Role/Persona (expert identity), Tree-of-Thought (multi-path exploration), Skeleton-of-Thought (outline-first), ReAct (agent reasoning), Reflection (self-critique), Meta-Prompting, Constrained Generation, Iterative Refinement, and Persona Chain.

StructuredReasoningExample-BasedIdentityAgenticQualityAdvanced

The 12 Prompt Formulas

01

STCO Framework

Structured

Situation → Task → Constraints → Output. Our flagship framework for complex, multi-constraint prompts. Provides the model with full context, clear instructions, explicit boundaries, and a defined output format.

Example
Situation: I run a B2B SaaS startup with 200 customers.
Task: Write a churn-prevention email for users inactive 14+ days.
Constraints: Under 150 words, empathetic tone, include one specific feature benefit.
Output: Email with subject line, body, and CTA button text.

Best for: Complex business tasks with multiple requirements, client-facing content, multi-constraint generation.

Read the full guide →
02

Chain-of-Thought

Reasoning

Instructs the model to break down reasoning into explicit sequential steps before reaching a conclusion. Dramatically improves accuracy on math, logic, and multi-step problems.

Example
Solve this step by step:
A store sells notebooks for £3.50 each. If I buy 7 notebooks and pay with a £50 note, how much change do I receive? Think through each step.

Best for: Math problems, logical reasoning, multi-step analysis, debugging, decision-making.

Read the full guide →
03

Few-Shot Prompting

Example-Based

Provides 2-5 input/output examples before the actual task. The model learns the desired format, tone, and pattern from examples rather than explicit instructions.

Example
Classify the sentiment:

Input: "The product arrived on time and works perfectly" → Positive
Input: "Took 3 weeks to ship and the box was damaged" → Negative
Input: "It's okay, nothing special" → Neutral

Input: "Best purchase I've made this year, exceeded all expectations" →

Best for: Classification, formatting, tone matching, data transformation, pattern replication.

Read the full guide →
04

Role / Persona

Identity

Assigns the model a specific expert identity with domain knowledge, communication style, and professional context. Significantly improves domain-specific output quality.

Example
You are a senior DevOps engineer with 15 years of experience in Kubernetes, AWS, and CI/CD pipelines. You give concise, practical advice and always consider security implications.

Question: How should I handle secrets in my GitHub Actions workflows?

Best for: Domain expertise, consistent voice, professional advice, educational content.

05

Tree-of-Thought

Reasoning

Extends Chain-of-Thought by exploring multiple reasoning paths simultaneously, evaluating each branch, and selecting the strongest. Best for problems with multiple valid approaches.

Example
Consider three different approaches to this problem. For each approach:
1. Describe the strategy
2. Work through the solution
3. Identify strengths and weaknesses

Then select the best approach and explain why.

Problem: How should a 50-person startup prioritise between shipping features and paying down tech debt?

Best for: Strategic decisions, complex problem-solving, creative exploration, architectural choices.

06

Skeleton-of-Thought

Structured

The model first generates an outline (skeleton) of the answer, then fills in each section. Produces more coherent long-form content by planning structure before detail.

Example
First, create a brief outline with 5-7 key sections for an article about prompt engineering best practices. Then expand each section into 2-3 detailed paragraphs.

Best for: Long-form content, articles, reports, documentation, comprehensive guides.

07

ReAct

Agentic

Reasoning + Acting. The model alternates between thinking (reasoning about the task) and acting (calling tools, searching, executing code). The foundation of modern AI agent architectures.

Example
You have access to: search(query), calculate(expression), lookup(term).

Thought: I need to find the current population of Tokyo.
Action: search("Tokyo population 2026")
Observation: 13.96 million
Thought: Now I can answer the question.
Answer: Tokyo's population is approximately 13.96 million.

Best for: AI agents, tool-augmented tasks, research workflows, multi-step data gathering.

Read the full guide →
08

Reflection

Quality

The model generates an initial response, then critiques its own output, identifies weaknesses, and produces an improved version. Self-correction without human feedback.

Example
Write a product description for noise-cancelling headphones.

Then review your description critically: Is it specific enough? Does it highlight unique benefits? Is the tone appropriate for a premium brand? Rewrite based on your critique.

Best for: Content refinement, quality improvement, self-editing, catching errors, iterative polish.

09

Meta-Prompting

Advanced

Using an LLM to generate or optimise prompts for another LLM (or itself). The "prompt that writes prompts". Powerful for prompt automation and scaling.

Example
I need a prompt that will make an AI generate high-quality product descriptions for an e-commerce store. The descriptions should be 50-100 words, highlight 3 key features, include a benefit statement, and end with a call to action. Write the optimal prompt.

Best for: Prompt automation, template creation, prompt library building, scaling prompt engineering.

10

Constrained Generation

Structured

Explicitly defines output format constraints — JSON schema, XML structure, specific fields, character limits. Forces the model to produce machine-parseable, structured output.

Example
Extract the following fields from this customer email and return ONLY valid JSON:
{
  "sentiment": "positive|negative|neutral",
  "urgency": "low|medium|high",
  "category": "billing|technical|general",
  "summary": "one sentence"
}

Best for: API responses, data extraction, structured outputs, pipeline integration, JSON/XML generation.

11

Iterative Refinement

Quality

Multi-turn approach where each prompt builds on the previous output, progressively refining towards the desired result. Mimics human editing workflow.

Example
Turn 1: Write a rough draft of an executive summary for our Q1 results.
Turn 2: Make the tone more confident and add specific revenue figures.
Turn 3: Shorten to 150 words and add a forward-looking closing statement.

Best for: Complex content creation, progressive detail addition, collaborative writing, document drafting.

12

Persona Chain

Advanced

Multiple personas review the same output sequentially — e.g., a writer drafts, an editor refines, a fact-checker validates. Simulates a multi-person workflow in a single prompt.

Example
Step 1 (Writer): Draft a blog post introduction about AI in healthcare.
Step 2 (Editor): Review for clarity, remove jargon, improve flow.
Step 3 (Fact-Checker): Flag any claims that need citations or could be inaccurate.
Step 4 (SEO Specialist): Optimise for the keyword "AI healthcare applications".

Best for: Content production pipelines, quality assurance, multi-perspective review, complex editorial workflows.

Decision Guide: Which Formula Should I Use?

  • Need accurate reasoning? → Chain-of-Thought or Tree-of-Thought
  • Need consistent formatting? → Few-Shot or Constrained Generation
  • Need domain expertise? → Role/Persona
  • Complex multi-constraint task? → STCO Framework
  • Building an agent? → ReAct
  • Writing long-form content? → Skeleton-of-Thought
  • Need higher quality? → Reflection or Iterative Refinement
  • Scaling prompt creation? → Meta-Prompting
  • Multi-perspective review? → Persona Chain

📌 Key Takeaways

  • 12 formulas cover the full spectrum of prompt engineering — from simple classification to complex agentic workflows.
  • Start with the simplest formula that works — Chain-of-Thought, Few-Shot, and Role cover 80% of use cases.
  • Formulas work across models — the pattern stays the same, only syntax details adapt.
  • See Prompt Engineering Examples for annotated real-world usage and Tools for Prompt Engineering for tooling that supports these patterns.

Frequently Asked Questions

What is a prompt formula?

A prompt formula is a reusable structural pattern for writing effective AI prompts. Like design patterns in software engineering, prompt formulas provide proven templates that consistently produce high-quality outputs. Examples include STCO (Situation → Task → Constraints → Output), Chain-of-Thought (step-by-step reasoning), and Few-Shot (example-based learning). Each formula is optimised for different use cases.

What are the most common prompt patterns?

The five most commonly used prompt patterns are: (1) Few-Shot — providing examples to guide output format. (2) Chain-of-Thought — requesting step-by-step reasoning. (3) Role/Persona — assigning the model a specific expert identity. (4) STCO — our structured Situation-Task-Constraints-Output framework. (5) ReAct — combining reasoning with tool use for agents. These five cover roughly 80% of production prompt engineering needs.

How do I choose the right prompt formula?

Match the formula to your task type: use Chain-of-Thought for reasoning and math, Few-Shot for formatting and classification, Role/Persona for domain expertise, STCO for complex multi-constraint tasks, ReAct for agentic workflows, and Constrained Generation for structured outputs (JSON, code). Start with the simplest formula that works — complexity should be added only when simpler patterns fail.

Do prompt formulas work across different AI models?

Yes — the core patterns (Chain-of-Thought, Few-Shot, Role/Persona) work across ChatGPT, Claude, Gemini, and other major models. However, each model responds differently to formatting details. Claude prefers XML tags, GPT-4 responds well to markdown structure, and Gemini handles multi-turn context effectively. The formula stays the same; the syntax adapts.

Apply These Formulas Automatically

AI Prompt Architect builds prompts using these proven formulas — STCO, Chain-of-Thought, Few-Shot, and more — with one click.

Build Better Prompts →

Prompt Formulas: The Evidence

Every claim below is sourced from peer-reviewed research and industry reports.Browse all 141 citations →

Few-shot extraction minimizes context window usage vs zero-shot verbose.

3 well-crafted few-shot examples (150 tokens) outperform a 600-token verbose instruction block, saving 75% on input costs per request.

Without concise few-shot examples, developers write lengthy prose instructions that consume 4x more tokens for equivalent or inferior output quality.

Brown et al., 'Language Models are Few-Shot Learners', NeurIPS 2020

JSON Schema enforcement eliminates parse errors.

OpenAI structured outputs with JSON Schema achieve 99.9% schema adherence vs <70% with unconstrained generation — a 30x reduction in parse failures.

Without schema enforcement, every 1M requests generate 300K+ malformed responses requiring retries, error handling, and downstream data corruption.

OpenAI, 'Structured Outputs: JSON Schema' documentation, 2024

Chain-of-thought prompting improves complex reasoning accuracy.

Adding 'Let's think step by step' improves accuracy on GSM8K math benchmarks from 17.7% to 78.7% — a 4.4x improvement on multi-step reasoning tasks.

Without chain-of-thought, models attempt to produce answers in a single leap, failing on problems requiring intermediate steps.

Wei et al., 'Chain-of-Thought Prompting Elicits Reasoning in Large Language Models', Google Research, 2022

Information placed in the middle of a 10K-token context is recalled 20% less accurately than information at the start or.Liu et al., 'Lost in the Middle: How Language Mode…