chapter four

4 Prompt Patterns

 

This chapter covers

  • Applying eight foundational Prompt Patterns that solve common Language Model interaction problems
  • Using Structural Patterns to establish consistent model behavior and output quality
  • Employing Contextual Patterns to identify overlooked risks, gaps, and blind spots in your content
  • Implementing Transformational Patterns that enhance content quality
  • Combining Patterns effectively to handle complex prompting problems

In Chapters 2 and 3, you mastered the building blocks of effective prompts: Structural Elements that organize information and Linguistic Elements that influence communication precision. These foundations enable you to construct well-formed prompts, but they don't address how to interact with Language Models strategically across different types of problems.

This chapter introduces Prompt Patterns, repeatable strategies for solving common prompting problems.

4.1 Understanding Prompt Patterns

Prompt Patterns are proven interaction methods for getting reliable outputs from Language Models. Like Design Patterns in Software Engineering, they provide reusable solutions to recurring problems. Unlike formatting choices, patterns define strategy—how the model should approach the task. They sit above Structural and Linguistic Elements and shape whether the model generates, critiques, or adapts. Their key advantage is transferability: once you learn a pattern like Self-Reflection, you can apply it across domains without changing the core method.

4.2 Role Assignment Pattern

4.2.1 Practical Example: Pull Request Description Generation

4.3 Delimiter Pattern

4.3.1 Practical Example: Multi-Source Bug Analysis

4.4 Template Pattern

4.4.1 Practical Example: Incident Postmortem Summaries

4.5 Repetition Pattern

4.5.1 When to Use the Repetition Pattern

4.5.2 Practical Example: Selecting a Logging Approach

4.6 Self-Reflection Pattern

4.6.1 Practical Example: Technical Onboarding Plan

4.7 Inversion Pattern

4.7.1 Practical Example: Architecture Proposal Review

4.8 Refinement Pattern

4.8.1 Practical Example: API Documentation Improvement

4.9 Comment Driven Generation

4.9.1 Practical Example: Technical RFC Review

4.9.2 Hands-On Practice

4.10 Summary