A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

Jules WhiteQuchen FuSam HaysMichael SandbornCarlos OleaHenry GilbertAshraf ElnasharJesse Spencer-SmithDouglas C. Schmidt

article2023Proceedings of the 30th Conference on Pattern Languages of Programs1,925 citations

Presents a structured catalog of reusable prompt engineering patterns modeled after software design patterns to solve common problems and systematically improve interactions with large language models.

Listen

As conversational large language models become widely integrated into software engineering workflows and enterprise environments, organizations often struggle to produce consistent, high-quality, and secure outputs. Standard, informal prompting frequently results in incomplete answers, hallucinations, or inefficient trial-and-error interactions.

The article sets out to create a structured framework and catalog of reusable prompt patterns that formalize effective prompt engineering practices for large language models. Its primary goal is to demonstrate how systematic prompt structuring can solve recurring interaction challenges and enhance output quality across diverse domains.

The authors established a qualitative pattern framework inspired by traditional software design patterns, defining each prompt pattern through structured components including intent, motivation, fundamental contextual statements, and concrete implementations. They evaluated sixteen distinct prompt patterns by combining community-documented techniques with independent experiments using the ChatGPT+ service, focusing on automating software engineering tasks such as code generation, refactoring, and system administration.

The article establishes several key findings. First, the authors cataloged sixteen reusable prompt patterns grouped into five functional categories: Input Semantics, Output Customization, Error Identification, Prompt Improvement, and Interaction. Second, they demonstrated that prompts can fundamentally alter interaction paradigmssuch as using the Flipped Interaction pattern to have the model drive requirements gathering through sequential questioning, or the Persona pattern to simulate specialized environments like compromised terminals. Third, prompt patterns can be systematically composed; combining patterns (such as Question Refinement with Cognitive Verifier or Fact Check List) significantly improves reasoning depth and transparently highlights factual assumptions. Finally, using fundamental contextual statements rather than rigid formal grammars provides an intuitive, adaptable approach to prompt design across various operational contexts.

These findings have direct operational and risk implications for organizations adopting conversational artificial intelligence. Implementing standardized prompt patterns reduces development time and labor costs by automating repetitive multi-file coding tasks and deployment scripts. Furthermore, incorporating verification patterns (such as Fact Check List and Reflection) helps mitigate compliance and security risks by forcing models to expose underlying assumptions, thereby guarding against inaccurate generated artifacts.

Decision-makers and engineering leads should systematically adopt and codify these prompt patterns within organizational workflows to standardize generative artificial intelligence usage. Teams should mandate human verification of automated scripts and factual outputs before execution, particularly in high-risk domains like cybersecurity. Additionally, organizations should build internal, domain-specific pattern libraries and evaluate how emerging model updates impact pattern behavior.

The primary limitation of the article is that all patterns were evaluated qualitatively on a single platform, ChatGPT+, without large-scale statistical benchmarking across multiple competing language models. Furthermore, conversational memory limits can cause models to lose prompt context over extended sessions, and models remain susceptible to generating plausible-sounding factual errors. Readers can have high confidence in the utility and adaptability of the pattern framework, but should maintain prudent human oversight over all generated outputs.

arXiv: 2302.11382
Cover for A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

Abstract

Prompt engineering is an increasingly important skill set needed to converse effectively with large language models (LLMs), such as ChatGPT. Prompts are instructions given to an LLM to enforce rules, automate processes, and ensure specific qualities (and quantities) of generated output. Prompts are also a form of programming that can customize the outputs and interactions with an LLM. This paper describes a catalog of prompt engineering techniques presented in pattern form that have been applied to solve common problems when conversing with LLMs. Prompt patterns are a knowledge transfer method analogous to software patterns since they provide reusable solutions to common problems faced in a particular context, i.e., output generation and interaction when working with LLMs. This paper provides the following contributions to research on prompt engineering that apply LLMs to automate software development tasks. First, it provides a framework for documenting patterns for structuring prompts to solve a range of problems so that they can be adapted to different domains. Second, it presents a catalog of patterns that have been applied successfully to improve the outputs of LLM conversations. Third, it explains how prompts can be built from multiple patterns and illustrates prompt patterns that benefit from combination with other prompt patterns.

Table of Contents

  • I Introduction
  • II Comparing Software Patterns with Prompt Patterns
  • II-A Overview of Software Patterns
  • II-B Overview of Prompt Patterns
  • II-C Evaluating Means for Defining a Prompt Pattern’s Structure and Ideas
  • II-D A Way Forward: Fundamental Contextual Statements
  • III A Catalog of Prompt Patterns for Conversational LLMs
  • III-A Summary of the Prompt Pattern Catalog
  • III-B The Meta Language Creation Pattern
  • III-B1 Intent and Context
  • III-B2 Motivation
  • III-B3 Structure and Key Ideas
  • III-B4 Example Implementation
  • III-B5 Consequences
  • III-C The Output Automater Pattern
  • III-C1 Intent and Context
  • III-C2 Motivation
  • III-C3 Structure and Key Ideas
  • III-C4 Example Implementation
  • III-C5 Consequences
  • III-D The Flipped Interaction Pattern
  • III-D1 Intent and Context
  • III-D2 Motivation
  • III-D3 Structure and Key Ideas
  • III-D4 Example Implementation
  • III-D5 Consequences
  • III-E The Persona Pattern
  • III-E1 Intent and Context
  • III-E2 Motivation
  • III-E3 Structure and Key Ideas
  • III-E4 Example Implementation
  • III-E5 Consequences
  • III-F The Question Refinement Pattern
  • III-F1 Intent and Context
  • III-F2 Motivation
  • III-F3 Structure and Key Ideas
  • III-F4 Example Implementation
  • III-F5 Consequences
  • III-G The Alternative Approaches Pattern
  • III-G1 Intent and Context
  • III-G2 Motivation
  • III-G3 Structure and Key Ideas
  • III-G4 Example Implementation
  • III-G5 Consequences
  • III-H The Cognitive Verifier Pattern
  • III-H1 Intent and Context
  • III-H2 Motivation
  • III-H3 Structure and Key Ideas
  • III-H4 Example Implementation
  • III-H5 Consequences
  • III-I The Fact Check List Pattern
  • III-I1 Intent and Context
  • III-I2 Motivation
  • III-I3 Structure and Key Ideas
  • III-I4 Example Implementation
  • III-I5 Consequences
  • III-J The Template Pattern
  • III-J1 Intent and Context
  • III-J2 Motivation
  • III-J3 Structure and Key Ideas
  • III-J4 Example Implementation
  • III-J5 Consequences
  • III-K The Infinite Generation Pattern
  • III-K1 Intent and Context
  • III-K2 Motivation
  • III-K3 Structure and Key Ideas
  • III-K4 Example Implementation
  • III-K5 Consequences
  • III-L The Visualization Generator Pattern
  • III-L1 Intent and Context
  • III-L2 Motivation
  • III-L3 Structure and Key Ideas
  • III-L4 Example Implementation
  • III-L5 Consequences
  • III-M The Game Play Pattern
  • III-M1 Intent and Context
  • III-M2 Motivation
  • III-M3 Structure and Key Ideas
  • III-M4 Example Implementation
  • III-M5 Consequences
  • III-N The Reflection Pattern
  • III-N1 Intent and Context
  • III-N2 Motivation
  • III-N3 Structure and Key Ideas
  • III-N4 Example Implementation
  • III-N5 Consequences
  • III-O The Refusal Breaker Pattern
  • III-O1 Intent and Context
  • III-O2 Motivation
  • III-O3 Structure and Key Ideas
  • III-O4 Example Implementation
  • III-O5 Consequences
  • III-P The Context Manager Pattern
  • III-P1 Intent and Context
  • III-P2 Motivation
  • III-P3 Structure and Key Ideas
  • III-P4 Example Implementation
  • III-P5 Consequences
  • III-Q The Recipe Pattern
  • III-Q1 Intent and Context
  • III-Q2 Motivation
  • III-Q3 Structure and Key Ideas
  • III-Q4 Example Implementation
  • III-Q5 Consequences
  • IV Related Work
  • V Concluding Remarks
  • References

Knowls

  1. Knowl 1 — Prompt Pattern Documentation Framework and Fundamental Contextual Statements

    model/method

    To systematically capture, structure, and transfer reusable prompting techniques for conversational large language models (LLMs), prompt engineering patterns are documented using a standardized pattern form adapted from software engineering design patterns.

    Because natural language prompts convey ideas rather than strict programmatic syntax, formal grammars and UML diagrams fail to capture the flexible phrasing, novel symbology, and semantic adaptations inherent in prompt design. Prompt structures are instead formally specified using fundamental contextual statements—concise, domain-independent textual directives capturing the core contextual information and constraints that must be communicated to the LLM.

    A prompt pattern consists of six stylized components:

    1. Name and Classification: A unique name identifying the technique and its assignment into a functional category (Input Semantics, Output Customization, Error Identification, Prompt Improvement, Interaction, or Context Control).
    2. Intent and Context: The domain-independent problem addressed and the operational goals achieved.
    3. Motivation: The rationale explaining why naive or informal prompting is insufficient and where structured prompting improves output.
    4. Structure and Key Ideas: The set of fundamental contextual statements that define the pattern's core semantics.
    5. Example Implementation: Concrete phrasing demonstrating how the pattern is instantiated in conversation.
    6. Consequences: Operational benefits, failure modes (e.g., context window drift, hallucinations, or safety boundary interactions), and composability with other prompt patterns.
  2. Knowl 2 — Prompt Pattern Taxonomy and Functional Categories

    data/table

    Prompt patterns for conversational LLMs are classified across six core categories based on their operational objective and conversational interaction style:

    Pattern Category Prompt Pattern
    Input Semantics Meta Language Creation
    Output Customization Output Automater, Persona, Visualization Generator, Recipe, Template
    Error Identification Fact Check List, Reflection
    Prompt Improvement Question Refinement, Alternative Approaches, Cognitive Verifier, Refusal Breaker
    Interaction Flipped Interaction, Game Play, Infinite Generation
    Context Control Context Manager

    Each category serves a specific role in managing LLM workflows:

    • Input Semantics: Defines how the model interprets inputs, custom notations, and shorthand vocabularies.
    • Output Customization: Restricts and formats generated output structure, tone, medium, or perspective.
    • Error Identification: Forces the model to expose assumptions, verify factual dependencies, and inspect reasoning for flaws.
    • Prompt Improvement: Refines input queries, explores alternative solutions, decomposes reasoning, and addresses refusals.
    • Interaction: Inverts control flow, manages continuous generation, or structures multi-turn game loops.
    • Context Control: Sets boundaries, specifies relevant variables, and resets conversational context memory.
  3. Knowl 3 — Meta Language Creation Prompt Pattern

    model/method

    The Meta Language Creation pattern belongs to the Input Semantics category. Its intent is to define custom shorthand notations, symbolic notations, or custom commands for an LLM to understand and use throughout a conversational session.

    Fundamental Contextual Statements

    • "When I say XX, I mean YY (or would like you to do YY)."

    Mechanics and Usage

    This pattern is applied when standard natural language is too verbose or ambiguous for expressing structured concepts (such as graph topologies, state machine transitions, or automated command sequences). The user provides the syntax and mapping rules up front (e.g., specifying that a -> b represents directed graph nodes with an edge, or -[w:2]-> denotes edge properties).

    Consequences and Trade-offs

    • Overcomes the token overhead and ambiguity of describing complex structures in full sentences.
    • Introduces potential confusion if common natural language tokens or punctuation (e.g., the word "a" or commas) are given custom semantics.
    • Best restricted to a single meta-language definition per isolated conversation session to prevent conflicting semantic drift.
  4. Knowl 4 — Output Automater Prompt Pattern

    model/method

    The Output Automater pattern belongs to the Output Customization category. Its intent is to have the LLM automatically generate an executable script or automation artifact that performs the procedural steps suggested in its output, reducing manual implementation effort.

    Fundamental Contextual Statements

    • "Whenever you produce an output that has at least one step to take and the following properties (alternatively, always do this):"
    • "Produce an executable artifact of type XX that will automate these steps."

    Mechanics and Usage

    When conversational LLMs outline multi-step operations (e.g., file creation, directory modifications, cloud configuration), manual execution is tedious and prone to user copy-paste errors. The user explicitly requests an executable artifact (such as a Python or Bash script) rather than abstractly asking the model to "automate" the task, which conversational LLMs may reject due to their lack of direct execution environments.

    Consequences and Trade-offs

    • Directly integrates LLM recommendations into automated workflows for local or remote execution.
    • Requires sufficient conversational context (e.g., operating system, target file structure) to generate functional scripts.
    • The user remains responsible for reviewing generated code prior to execution, as executing inaccurate or unverified scripts presents operational hazards.
  5. Knowl 5 — Flipped Interaction Prompt Pattern

    model/method

    The Flipped Interaction pattern belongs to the Interaction category. Its intent is to invert the conversational dynamic so that the LLM drives the interaction by asking the user targeted questions until enough context is gathered to achieve a specified goal.

    Fundamental Contextual Statements

    • "I would like you to ask me questions to achieve XX."
    • "You should ask questions until this condition is met or to achieve this goal (alternatively, forever)."
    • "(Optional) ask me the questions one at a time, two at a time, etc."

    Mechanics and Usage

    Rather than requiring the user to supply all necessary technical parameters upfront, the LLM utilizes its domain knowledge to determine the required inputs, sequence of questions, and scope. This pattern is particularly useful for configuration generation, deployment script construction, or diagnostic questionnaires.

    Consequences and Trade-offs

    • Bridges domain knowledge gaps for non-expert users who do not know which technical parameters to specify.
    • Pacing constraints (e.g., asking one question per turn versus large batches) must be explicitly specified to maintain usability.
    • If the initial goal is too broad, questioning can become open-ended or non-deterministic; providing explicit constraints (such as target cloud providers or tools) improves conversational efficiency.
  6. Knowl 6 — Persona Prompt Pattern

    model/method

    The Persona pattern belongs to the Output Customization category. Its intent is to instruct the LLM to adopt a specific perspective, role, or entity archetype when generating outputs and prioritizing details.

    Fundamental Contextual Statements

    • "Act as persona XX."
    • "Provide outputs that persona XX would create."

    Mechanics and Usage

    The user designates a human role (e.g., a cybersecurity auditor, senior architect, tutor) or a non-human/inanimate entity (e.g., a compromised Linux terminal, a database server). The model applies the domain focus, vocabulary, assumptions, and formatting typical of that persona to evaluate input data or simulate system behavior.

    Consequences and Trade-offs

    • Enables users to steer output style and depth without needing to enumerate all individual behavioral constraints.
    • When simulating non-human entities (e.g., terminal shells or databases), the LLM hallucinates dynamic state and synthetic data, which provides high fidelity for simulation but does not execute real system commands.
    • Subject to underlying safety and alignment guardrails that may restrict impersonating specific living individuals or harmful entities.
  7. Knowl 7 — Question Refinement Prompt Pattern

    model/method

    The Question Refinement pattern belongs to the Prompt Improvement category. Its intent is to have the LLM automatically suggest improved, higher-precision versions of the user's questions before or alongside answering.

    Fundamental Contextual Statements

    • "Within scope XX, suggest a better version of the question to use instead."
    • "(Optional) prompt me if I would like to use the better version instead."

    Mechanics and Usage

    Users often ask initial questions that are overly broad, ambiguous, or lacking key framework details. The LLM identifies missing domain constraints, security considerations, or architectural best practices and formulates a refined prompt that incorporates these parameters (e.g., refining "how do I authenticate users?" into a specific FastAPI question regarding CSRF and token security).

    Consequences and Trade-offs

    • Educates users on domain nuances and accelerates convergence on precise answers.
    • Risks prematurely narrowing the line of inquiry down an overly specialized path unless broad scoping rules are established.
    • Can introduce domain-specific jargon that confuses beginners; this can be mitigated by combining with patterns that explain introduced terminology.
  8. Knowl 8 — Alternative Approaches Prompt Pattern

    model/method

    The Alternative Approaches pattern belongs to the Prompt Improvement category. Its intent is to ensure that the LLM consistently proposes alternative methods to accomplish a stated goal, including trade-off analyses, rather than defaulting only to the user's initial approach.

    Fundamental Contextual Statements

    • "Within scope XX, if there are alternative ways to accomplish the same thing, list the best alternate approaches."
    • "(Optional) compare/contrast the pros and cons of each approach."
    • "(Optional) include the original way that I asked."
    • "(Optional) prompt me for which approach I would like to use."

    Mechanics and Usage

    This pattern mitigates user cognitive bias and unfamiliarity with better tools or architectural patterns. When asked to implement or deploy a system, the model surfaces alternative technologies, pricing tiers, or design patterns within the defined scope and compares their trade-offs (e.g., cost, maintenance effort, performance).

    Consequences and Trade-offs

    • Prevents premature commitment to suboptimal, outdated, or expensive solutions.
    • Requires setting clear boundaries (scope XX) to prevent the model from suggesting non-viable alternatives that violate fixed project constraints.
  9. Knowl 9 — Cognitive Verifier Prompt Pattern

    model/method

    The Cognitive Verifier pattern belongs to the Prompt Improvement category. Its intent is to force the LLM to subdivide a high-level question into smaller, logically sequenced sub-questions, answer the sub-questions, and combine the intermediate answers into a comprehensive final response.

    Fundamental Contextual Statements

    • "When you are asked a question, follow these rules:"
    • "Generate a number of additional questions that would help more accurately answer the question."
    • "Combine the answers to the individual questions to produce the final answer to the overall question."

    Mechanics and Usage

    By decomposing a complex problem into sub-problems, the model surfaces underlying assumptions, edge cases, and missing context before generating the macro-level answer. The pattern can either allow the LLM to generate and answer the sub-questions autonomously or present the sub-questions to the user for interactive input.

    Consequences and Trade-offs

    • Significantly improves the depth and reasoning accuracy of LLM outputs on multi-faceted problems.
    • Specifying an exact number NN of sub-questions bounds the interaction, but risks omitting an (N+1)(N+1)-th critical consideration; omitting a limit may generate an overwhelming list of follow-up questions.
  10. Knowl 10 — Fact Check List Prompt Pattern

    model/method

    The Fact Check List pattern belongs to the Error Identification category. Its intent is to have the LLM append an explicit list of fundamental facts and assumptions on which the veracity of its output depends, enabling targeted user validation.

    Fundamental Contextual Statements

    • "Generate a set of facts that are contained in the output."
    • "The set of facts should be inserted in a specific point in the output (e.g., at the end)."
    • "The set of facts should be the fundamental facts that could undermine the veracity of the output if any of them are incorrect."

    Mechanics and Usage

    Because LLMs generate plausible-sounding text that may contain subtle hallucinations (e.g., non-existent software package versions, incorrect command flags, or fabricated statistics), this pattern isolates the high-risk factual claims into an inspection checklist. Users can verify these discrete items against ground-truth documentation without having to manually parse every sentence of the generation.

    Consequences and Trade-offs

    • Lowers the cognitive burden of auditing LLM responses by highlighting load-bearing factual dependencies.
    • Only functions effectively when the output domain relies on verifiable factual statements (e.g., dependency lists, version numbers, or API endpoints); conversational LLMs typically refuse or fail to generate fact-check lists for arbitrary code logic.
  11. Knowl 11 — Template Prompt Pattern

    model/method

    The Template pattern belongs to the Output Customization category. Its intent is to force the LLM to produce output matching an exact structural template containing predefined semantic placeholders.

    Fundamental Contextual Statements

    • "I am going to provide a template for your output."
    • "XX is my placeholder for content."
    • "Try to fit the output into one or more of the placeholders that I list."
    • "Please preserve the formatting and overall template that I provide."
    • "This is the template: PATTERN with PLACEHOLDERS."

    Mechanics and Usage

    Used when the desired output format is custom, proprietary, or specific to an external pipeline (e.g., specialized URL endpoints, structured configs, or bespoke text formats). The user defines placeholders (e.g., uppercase tokens like NAME and JOB) that signal both where generated text must go and what content should be omitted.

    Consequences and Trade-offs

    • Guarantees predictable formatting for automated parsing and programmatic ingestion.
    • Strips out natural language explanations, rationale, and conversational context that might otherwise provide useful diagnostic insight to the user.
    • Incompatible with patterns that require multi-step procedural text output (such as the Recipe pattern) unless the template accommodates list structures.
  12. Knowl 12 — Infinite Generation Prompt Pattern

    model/method

    The Infinite Generation pattern belongs to the Interaction category. Its intent is to automate the continuous, repeated generation of outputs adhering to a single predefined prompt structure without requiring the user to re-enter the template or instructions on each turn.

    Fundamental Contextual Statements

    • "I would like you to generate output forever, XX output(s) at a time."
    • "(Optional) here is how to use the input I provide between outputs."
    • "(Optional) stop when I ask you to."

    Mechanics and Usage

    The user initializes a generator loop (e.g., generating endless synthetic user records, test cases, or CRUD boilerplate). Intermittent user turns can supply dynamic parameters to steer the next batch or provide an explicit stopping token.

    Consequences and Trade-offs

    • Eliminates repetitive prompt submission when generating batches of structured artifacts.
    • As context history grows, earlier system instructions may experience context fading, causing the LLM to drift from the original constraints or produce repetitive/degenerate output cycles.
  13. Knowl 13 — Visualization Generator Prompt Pattern

    model/method

    The Visualization Generator pattern belongs to the Output Customization category. Its intent is to bridge the LLM's text-only interface to visual media by having it generate structured text representations designed as inputs for external rendering engines.

    Fundamental Contextual Statements

    • "Generate an XX that I can provide to tool YY to visualize it."

    Mechanics and Usage

    Because conversational text LLMs cannot output native bitmap or vector diagrams directly, this pattern generates code or structured markup for dedicated visualization engines, such as Graphviz DOT, PlantUML, Mermaid, or prompt strings for image generation models (e.g., DALL-E). The prompt can provide a list of candidate tools and allow the LLM to choose the format best suited to the structural complexity of the data.

    Consequences and Trade-offs

    • Expands LLM communication bandwidth into graphical representations (e.g., architecture diagrams, state machines, network graphs).
    • Requires downstream tools or rendering environments to convert the textual output into rendered imagery.
  14. Knowl 14 — Game Play Prompt Pattern

    model/method

    The Game Play pattern belongs to the Interaction category. Its intent is to configure the LLM to manage and execute an interactive, rule-bound text simulation or game around a specific domain topic.

    Fundamental Contextual Statements

    • "Create a game for me around XX."
    • "One or more fundamental rules of the game."

    Mechanics and Usage

    The user establishes the scenario, victory conditions, and interactive constraints. The LLM dynamically tracks state, generates context-sensitive scenario content, responds to open-ended user actions (such as terminal commands or problem-solving inputs), and reveals progressive clues.

    Consequences and Trade-offs

    • Creates rich, adaptive educational and training environments (e.g., cyberattack incident response simulations).
    • Highly composable with the Persona pattern (e.g., simulating a compromised host) and the Visualization Generator pattern (e.g., mapping network topology).
    • Output quality depends on keeping the core rules bounded while giving the LLM freedom to synthesize narrative and state details.
  15. Knowl 15 — Reflection Prompt Pattern

    model/method

    The Reflection pattern belongs to the Error Identification category. Its intent is to instruct the LLM to explicitly explain the reasoning, rationale, assumptions, and limitations behind its answers.

    Fundamental Contextual Statements

    • "Whenever you generate an answer:"
    • "Explain the reasoning and assumptions behind your answer."
    • "(Optional) ...so that I can improve my question."

    Mechanics and Usage

    After generating an answer or code recommendation, the model outputs an explanation of why specific algorithms, libraries, or architectural decisions were selected. This makes hidden assumptions visible and clarifies the model's interpretation of ambiguous prompts.

    Consequences and Trade-offs

    • Enables prompt debugging and helps users assess whether the LLM's solution matches their unstated constraints.
    • The explanation itself may occasionally contain flawed logic or hallucinations, meaning it is most effective when paired with the Fact Check List pattern.
  16. Knowl 16 — Refusal Breaker Prompt Pattern

    model/method

    The Refusal Breaker pattern belongs to the Prompt Improvement category. Its intent is to direct the LLM, whenever it refuses to answer an inquiry, to explain the rationale for the refusal and suggest alternative, permissible rewordings that it is capable of answering.

    Fundamental Contextual Statements

    • "Whenever you can’t answer a question:"
    • "Explain why you can’t answer the question."
    • "Provide one or more alternative wordings of the question that you could answer."

    Mechanics and Usage

    LLM refusals often occur because a query is phrased in a way that triggers policy constraints, requests subjective personal opinions, or lacks necessary framing. This pattern automates the recovery step by asking the LLM to surface its constraints and propose neutral, informational variants of the question.

    Consequences and Trade-offs

    • Prevents dead-end interactions by helping users find productive, policy-compliant paths forward.
    • Carries potential risks of misuse if applied to map out safety guardrails or generate adversarial prompts.
    • Alternative questions may occasionally shift away from the user's intended topic.
  17. Knowl 17 — Context Manager Prompt Pattern

    model/method

    The Context Manager pattern belongs to the Context Control category. Its intent is to explicitly focus, constrain, or reset the conversational context that the LLM must evaluate or ignore when generating responses.

    Fundamental Contextual Statements

    • "Within scope XX"
    • "Please consider YY"
    • "Please ignore ZZ"
    • "(Optional) start over"

    Mechanics and Usage

    During extended multi-turn sessions, irrelevant prior context, out-of-scope code details, or past tangents can degrade response quality. The user specifies explicit inclusion lists (YY) or exclusion lists (ZZ) to focus model attention on relevant parameters (e.g., ignoring code formatting while focusing solely on security vulnerabilities), or issues a complete context reset ("start over").

    Consequences and Trade-offs

    • Improves relevance and coherence by preventing attention dilution across long dialogues.
    • Total context resets risk inadvertently clearing previously established personas, rules, or system instructions that the user or organization had configured.
  18. Knowl 18 — Recipe Prompt Pattern

    model/method

    The Recipe pattern belongs to the Output Customization category. Its intent is to produce a complete, sequentially ordered set of actionable steps to achieve a goal, given a partially specified, unordered set of user-provided initial steps ("ingredients").

    Fundamental Contextual Statements

    • "I would like to achieve XX."
    • "I know that I need to perform steps A,B,CA, B, C."
    • "Provide a complete sequence of steps for me."
    • "Fill in any missing steps."
    • "Identify any unnecessary steps."

    Mechanics and Usage

    This pattern composes elements of the Template, Alternative Approaches, and Reflection patterns. When a user knows some intermediate waypoints of a process (e.g., provisioning an AWS account or installing software) but lacks knowledge of the complete procedure or correct execution sequence, the LLM organizes the steps, supplies missing requirements, and flags redundant or obsolete steps.

    Consequences and Trade-offs

    • Constructs complete operational workflows from partial user knowledge.
    • May introduce bias if the LLM attempts to force unnecessary user-supplied steps into the final plan rather than explicitly identifying and pruning them.

Coverage note — None was omitted; all 16 prompt patterns, the documentation framework with fundamental contextual statements, and the catalog taxonomy have been fully extracted into self-contained knowls.

References

  1. 1.R. Bommasani, D. A. Hudson, E. Adeli, R. Altman, S. Arora, S. von Arx, M. S. Bernstein, J. Bohg, A. Bosselut, E. Brunskill et al., “On the opportunities and risks of foundation models,” arXiv preprint arXiv:2108.07258, 2021.
  2. 2.Y. Bang, S. Cahyawijaya, N. Lee, W. Dai, D. Su, B. Wilie, H. Lovenia, Z. Ji, T. Yu, W. Chung et al., “A multitask, multilingual, multimodal evaluation of chatgpt on reasoning, hallucination, and interactivity,” arXiv preprint arXiv:2302.04023, 2023.
  3. 3.A. Gilson, C. Safranek, T. Huang, V. Socrates, L. Chi, R. A. Taylor, and D. Chartash, “How well does chatgpt do when taking the medical licensing exams?” medRxiv, pp. 2022–12, 2022.
  4. 4.A. Carleton, M. H. Klein, J. E. Robert, E. Harper, R. K. Cunningham, D. de Niz, J. T. Foreman, J. B. Goodenough, J. D. Herbsleb, I. Ozkaya, and D. C. Schmidt, “Architecting the future of software engineering,” Computer, vol. 55, no. 9, pp. 89–93, 2022.
  5. 5.“Github copilot · your ai pair programmer.” [Online]. Available: https://github.com/features/copilot
  6. 6.O. Asare, M. Nagappan, and N. Asokan, “Is github’s copilot as bad as humans at introducing vulnerabilities in code?” arXiv preprint arXiv:2204.04741, 2022.
  7. 7.H. Pearce, B. Ahmad, B. Tan, B. Dolan-Gavitt, and R. Karri, “Asleep at the keyboard? assessing the security of github copilot’s code contributions,” in 2022 IEEE Symposium on Security and Privacy (SP). IEEE, 2022, pp. 754–768.
  8. 8.J. Krochmalski, IntelliJ IDEA Essentials. Packt Publishing Ltd, 2014.
  9. 9.P. Liu, W. Yuan, J. Fu, Z. Jiang, H. Hayashi, and G. Neubig, “Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing,” ACM Computing Surveys, vol. 55, no. 9, pp. 1–35, 2023.
  10. 10.E. Gamma, R. Johnson, R. Helm, R. E. Johnson, and J. Vlissides, Design patterns: elements of reusable object-oriented software. Pearson Deutschland GmbH, 1995.
  11. 11.D. C. Schmidt, M. Stal, H. Rohnert, and F. Buschmann, Pattern-oriented software architecture, patterns for concurrent and networked objects. John Wiley & Sons, 2013.
  12. 12.OpenAI, “ChatGPT: Large-Scale Generative Language Models for Automated Content Creation,” https://openai.com/blog/chatgpt/, 2023, [Online; accessed 19-Feb-2023].
  13. 13.——, “DALL·E 2: Creating Images from Text,” https://openai.com/dall-e-2/, 2023, [Online; accessed 19-Feb-2023].
  14. 14.D. Zhou, N. Sch¨arli, L. Hou, J. Wei, N. Scales, X. Wang, D. Schuurmans, O. Bousquet, Q. Le, and E. Chi, “Least-to-most prompting enables complex reasoning in large language models,” arXiv preprint arXiv:2205.10625, 2022.
  15. 15.J. Ellson, E. R. Gansner, E. Koutsofios, S. C. North, and G. Woodhull, “Graphviz and dynagraph—static and dynamic graph drawing tools,” Graph drawing software, pp. 127–148, 2004.
  16. 16.S. Owen, “Building a virtual machine inside a javascript library,” https://www.engraved.blog/building-a-virtual-machine-inside/, 2022, accessed: 2023-02-20.
  17. 17.P. Zhang, J. White, D. C. Schmidt, and G. Lenz, “Applying software patterns to address interoperability in blockchain-based healthcare apps,” CoRR, vol. abs/1706.03700, 2017. [Online]. Available: http://arxiv.org/abs/1706.03700
  18. 18.X. Xu, C. Pautasso, L. Zhu, Q. Lu, and I. Weber, “A pattern collection for blockchain-based applications,” in Proceedings of the 23rd European Conference on Pattern Languages of Programs, 2018, pp. 1–20.
  19. 19.E. A. van Dis, J. Bollen, W. Zuidema, R. van Rooij, and C. L. Bockting, “Chatgpt: five priorities for research,” Nature, vol. 614, no. 7947, pp. 224–226, 2023.
  20. 20.L. Reynolds and K. McDonell, “Prompt programming for large language models: Beyond the few-shot paradigm,” CoRR, vol. abs/2102.07350, 2021. [Online]. Available: https://arxiv.org/abs/2102.07350
  21. 21.J. Wei, X. Wang, D. Schuurmans, M. Bosma, E. H. Chi, Q. Le, and D. Zhou, “Chain of thought prompting elicits reasoning in large language models,” CoRR, vol. abs/2201.11903, 2022. [Online]. Available: https://arxiv.org/abs/2201.11903
  22. 22.J. Wei, Y. Tay, R. Bommasani, C. Raffel, B. Zoph, S. Borgeaud, D. Yogatama, M. Bosma, D. Zhou, D. Metzler, E. H. Chi, T. Hashimoto, O. Vinyals, P. Liang, J. Dean, and W. Fedus, “Emergent abilities of large language models,” 2022. [Online]. Available: https://arxiv.org/abs/2206.07682
  23. 23.Y. Zhou, A. I. Muresanu, Z. Han, K. Paster, S. Pitis, H. Chan, and J. Ba, “Large language models are human-level prompt engineers,” 2022. [Online]. Available: https://arxiv.org/abs/2211.01910
  24. 24.T. Shin, Y. Razeghi, R. L. L. IV, E. Wallace, and S. Singh, “Autoprompt: Eliciting knowledge from language models with automatically generated prompts,” CoRR, vol. abs/2010.15980, 2020. [Online]. Available: https://arxiv.org/abs/2010.15980
  25. 25.A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever, “Language models are unsupervised multitask learners,” 2019.
  26. 26.D. Zhou, N. Sch¨arli, L. Hou, J. Wei, N. Scales, X. Wang, D. Schuurmans, C. Cui, O. Bousquet, Q. Le, and E. Chi, “Least-to-most prompting enables complex reasoning in large language models,” 2022. [Online]. Available: https://arxiv.org/abs/2205.10625
  27. 27.J. Jung, L. Qin, S. Welleck, F. Brahman, C. Bhagavatula, R. L. Bras, and Y. Choi, “Maieutic prompting: Logically consistent reasoning with recursive explanations,” 2022. [Online]. Available: https://arxiv.org/abs/2205.11822
  28. 28.S. Arora, A. Narayan, M. F. Chen, L. Orr, N. Guha, K. Bhatia, I. Chami, and C. Re, “Ask me anything: A simple strategy for prompting language models,” in International Conference on Learning Representations, 2023. [Online]. Available: https://openreview.net/forum?id=bhUPJnS2g0X
  29. 29.V. Liu and L. B. Chilton, “Design guidelines for prompt engineering text-to-image generative models,” in Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems, 2022, pp. 1–23.
  30. 30.P. Maddigan and T. Susnjak, “Chat2vis: Generating data visualisations via natural language using chatgpt, codex and gpt-3 large language models,” arXiv preprint arXiv:2302.02094, 2023.
  31. 31.X. Han, W. Zhao, N. Ding, Z. Liu, and M. Sun, “Ptr: Prompt tuning with rules for text classification,” AI Open, vol. 3, pp. 182–192, 2022.
  32. 32.S. Wang, H. Scells, B. Koopman, and G. Zuccon, “Can chatgpt write a good boolean query for systematic review literature search?” arXiv preprint arXiv:2302.03495, 2023.
  33. 33.C. S. Xia and L. Zhang, “Conversational automated program repair,” arXiv preprint arXiv:2301.13246, 2023.
  34. 34.J. H. Choi, K. E. Hickman, A. Monahan, and D. Schwarcz, “Chatgpt goes to law school,” Available at SSRN, 2023.
  35. 35.S. Frieder, L. Pinchetti, R.-R. Griffiths, T. Salvatori, T. Lukasiewicz, P. C. Petersen, A. Chevalier, and J. Berner, “Mathematical capabilities of chatgpt,” arXiv preprint arXiv:2301.13867, 2023.

Citation

MLA
White, J., et al. “A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT”. arXiv, 2023, http://arxiv.org/abs/2302.11382v1.
APA
White, J., Fu, Q., Hays, S., Sandborn, M., Olea, C., Gilbert, H., Elnashar, A., Spencer-Smith, J., & Schmidt, D. C. (2023). A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT. arXiv. http://arxiv.org/abs/2302.11382v1
Chicago
White, J., Q. Fu, S. Hays, et al. 2023. “A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT”. arXiv. http://arxiv.org/abs/2302.11382v1.
Harvard
White, J. et al. (2023) “A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT”, arXiv [Preprint]. Available at: http://arxiv.org/abs/2302.11382v1.
Vancouver
1. White J, Fu Q, Hays S, Sandborn M, Olea C, Gilbert H, Elnashar A, Spencer-Smith J, Schmidt DC (2023) A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT. arXiv

BibTeX

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

Access the Paper

This paper is available from its original source. Click below to access the PDF.

Open PDF