# A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

A reusable pattern catalog helps users write better ChatGPT prompts

Jules White, Quchen Fu, Sam Hays, Michael Sandborn, Carlos Olea, Henry Gilbert and 3 more · arXiv · 2023-2-21

- **Problem** Prompt wording drives output quality, but good designs stay with their author and are hard to reuse across a team.
- **Method** The authors write each prompt as a named pattern with fixed parts, instead of free-form text, so users can adapt it to new contexts.
- **Results** The authors describe 16 patterns, each illustrated with example prompts and sample ChatGPT outputs.

## Why prompt quality becomes the bottleneck

The answers a conversational LLM gives depend heavily on the prompt the user writes. Users often write prompts from scratch, so a good design stays with the person who found it. That makes the design work hard to repeat across a team or a project.

The authors treat a prompt as a form of programming, which is why they reach for software patterns. Software patterns already capture recurring design problems in a form that others can reuse. Writing prompts in the same form lets their know-how transfer to new domains where users face similar problems.

## Borrowing the software pattern form

The key idea is to write each prompt as a named pattern with a fixed set of parts, so a reader can adapt it to a new context. Software patterns supply the template: a name, an intent, a motivation, a structure, example code and consequences. The authors keep the name, intent, motivation, example and consequences, but they replace UML-style structure diagrams.

UML describes software structures, not the ideas a prompt has to communicate, so it doesn't fit prompts well.

In a prompt pattern, the structure is a list of contextual statements, the key ideas the prompt has to carry to the LLM. The wording of those statements can vary, much as a software pattern can be realized in different code. The core pieces of information, however, must stay in place for the pattern to work. The authors also sort patterns into classes such as Output Customization, Error Identification, Prompt Improvement, Interaction and Context Control.

## Automating outputs and flipping the conversation

The Output Automater Pattern asks the LLM to write a script that performs the steps its own answer recommends. The pattern has two parts: a condition for when to automate, such as an answer with at least two steps, and a concrete artifact type, such as a Python script. The concrete artifact matters, because without one the LLM often says it can't automate the steps.

The script also has to fit the target system's context, such as a Mac or Windows file system.

The LLM can carry out the automation only if its output is written as runnable code. The user still has to read the script, since the LLM can make inaccuracies and blindly running its output carries real risk. The Flipped Interaction Pattern reverses who drives the conversation, so the LLM asks questions until a stated goal is reached. A flipped prompt needs the goal, an end condition and, optionally, the number of questions to ask per turn.

For example, the prompt can have the LLM gather details until it can write a script that deploys a Python application to AWS. If the user leaves requirements unstated, the LLM decides on its own whether to ask or to guess.

## Checking answers through decomposition, fact lists and reflection

The Cognitive Verifier Pattern asks the LLM to split a question into sub-questions, answer them, and combine the answers. The authors motivate this with prior research that reports LLMs reason better on subdivided questions, which they cite rather than test here. In the example, the LLM generates three additional questions and then combines the answers to the user's original question.

A fixed count can leave out a question that matters, while an open count can overwhelm the user.

The Fact Check List Pattern asks the LLM to list, at the end of its output, the facts the answer depends on. A user can compare that list with the output to confirm that each fact appears and to notice omissions. The pattern only works for outputs that can be fact-checked. ChatGPT listed library versions for a requirements file, but refused to build a fact list for a code sample.

The Reflection Pattern asks the LLM to explain the reasoning and assumptions behind each answer. That explanation helps the user spot assumptions and debug the prompt, but it helps less when the user doesn't know the topic.

## Combining patterns in the Recipe and Game Play

The Recipe Pattern is built from the Template, Alternative Approaches and Reflection patterns. The user states the goal and some steps they already know, and the LLM completes the sequence. It also flags steps the user listed that aren't needed. In the cloud example, a container deployed straight to AWS Fargate makes the virtual machine setup step unnecessary.

The Recipe Pattern carries a risk: the user's chosen steps can bias the LLM toward keeping them. The Fact Check List Pattern can likewise be paired with the Question Refinement pattern, since any output can contain errors. Game Play can be paired with Persona and Visualization Generator, for example to show network topology in a network security game.

## Limitations

The evidence is example prompts and sample ChatGPT outputs, such as a simulated Linux terminal session. The paper reports no baseline comparison and no success rate for any of the patterns. So the catalog shows what the patterns look like in practice, not how much they improve output quality.

The Refusal Breaker Pattern can be misused, for example to write phishing emails or to get past LLM policy filters. The authors advise caution, because the pattern can also help bypass the safeguards used to program the LLM.

A context reset can wipe out patterns an organization injected earlier, and the user may not notice. The Output Automater Pattern needs readers who can check the generated script before running it.

## Paper info

- **Authors**: Jules White, Quchen Fu, Sam Hays, Michael Sandborn, Carlos Olea, Henry Gilbert, Ashraf Elnashar, Jesse Spencer-Smith, Douglas C. Schmidt
- **Venue**: arXiv · Preprint
- **First published**: 2023-2-21
- **Added**: 2026-11-12
- **Updated**: 2023-2-21
- **Version**: v1
- **arXiv**: 2302.11382
- **Category**: cs.SE · cs.AI
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2302.11382v1) · [PDF ↗](https://arxiv.org/pdf/2302.11382v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Jules White, Quchen Fu, Sam Hays, Michael Sandborn, Carlos Olea, Henry Gilbert, Ashraf Elnashar, Jesse Spencer-Smith, Douglas C. Schmidt (2023). A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT. arXiv:2302.11382v1. https://arxiv.org/abs/2302.11382v1

**BibTeX**

```
@misc{white2023prompt,
  title = {{A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT}},
  author = {Jules White and Quchen Fu and Sam Hays and Michael Sandborn and Carlos Olea and Henry Gilbert and Ashraf Elnashar and Jesse Spencer-Smith and Douglas C. Schmidt},
  year = {2023},
  eprint = {2302.11382},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2302.11382v1}
}
```

## Other paper commentary

- [BLOOM: A 176B-Parameter Open-Access Multilingual Language Model](https://refivu.com/en/papers/e5a30d68-220d-4a9f-9cf2-26d76639a605-bloom-a-176b-parameter-open-access-multilingual-language.md)
- [The Pile: An 800GB Dataset of Diverse Text for Language Modeling](https://refivu.com/en/papers/1672f861-b9aa-408b-8aba-b2d5d642c8c9-the-pile-an-800gb-dataset-of-diverse-text.md)
- [Gemma 2: Improving Open Language Models at a Practical Size](https://refivu.com/en/papers/aaf9911d-9b96-4e9e-be15-d3cdb554211a-gemma-2-improving-open-language-models-at-a.md)
- [A Survey on Large Language Model based Autonomous Agents](https://refivu.com/en/papers/9d1600e9-9099-49ab-b9f8-7e2c2083c79f-a-survey-on-large-language-model-based-autonomous.md)
- [Lost in the Middle: How Language Models Use Long Contexts](https://refivu.com/en/papers/990be3e6-ce8b-473a-94d1-735a4cb6a76f-lost-in-the-middle-how-language-models-use.md)
- [MiniGPT-4: Enhancing Vision-Language Understanding with Advanced Large Language Models](https://refivu.com/en/papers/f07e6e3f-3ab5-42dc-98c8-a32fe7d8820d-minigpt-4-enhancing-vision-language-understanding-with.md)
- [A Contextual-Bandit Approach to Personalized News Article Recommendation](https://refivu.com/en/papers/8024ed96-4fed-4baf-950b-7340e29feb0a-a-contextual-bandit-approach-to-personalized-news-article.md)
- [Learning Efficient Convolutional Networks through Network Slimming](https://refivu.com/en/papers/d840aead-455e-4eaf-8f2c-7e4bff390606-learning-efficient-convolutional-networks-through-network.md)
- [Shortcut Learning in Deep Neural Networks](https://refivu.com/en/papers/429eb10d-b6ea-4d00-b18e-0509b85a5062-shortcut-learning-in-deep-neural-networks.md)
- [Teaching Machines to Read and Comprehend](https://refivu.com/en/papers/c971169f-9440-4e65-a62d-d8affa24f16a-teaching-machines-to-read-and-comprehend.md)
- [Robust Physical-World Attacks on Deep Learning Models](https://refivu.com/en/papers/07947804-f6f2-481e-a0c5-1e222ca2e06f-robust-physical-world-attacks-on-deep-learning-models.md)
- [Barren plateaus in quantum neural network training landscapes](https://refivu.com/en/papers/6ab9d494-e0b9-4bee-b003-0d509557c07c-barren-plateaus-in-quantum-neural-network-training.md)

## Terms in this paper

- [Large Language Models](https://refivu.com/en/terms/f2404476b183-large-language-models)
- [ChatGPT](https://refivu.com/en/terms/96047648490a-chatgpt)
- [prompt engineering](https://refivu.com/en/terms/fd335dee5f48-prompt-engineering)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/188edd2a-83fb-45cc-adcf-4ddabef4e43b-a-prompt-pattern-catalog-to-enhance-prompt-engineering)
