liveBook · Manning

What you will learn in Prompt Engineering in Practice

Design, test, and improve AI prompts

by Richard Davies, Rafael Fischer

Chapter by chapter

Chapter 1: Prompt engineering: The blueprint

The introduction argues that prompts used in software products should be treated as engineered interfaces rather than adjusted by intuition.

1.1 The prompt engineering mental model · 1.2 From casual prompting to prompt engineering · 1.3 Why prompt engineering matters for software engineers · 1.4 Prompts as designed artifacts · 1.5 The prompt engineering lifecycle · 1.6 Three diagnostic lenses · 1.6.1 Prompts as specifications · 1.6.2 Prompts must be self-contained · 1.6.3 Inspecting the prompt first when output varies · 1.7 Summary

What you learn in chapter 1 →

Chapter 2: Prompt design: Structural elements

The introduction explains how separating a prompt into structural elements clarifies each part’s role and makes prompts easier to reuse and diagnose.

2.1 Overview of structural elements · 2.2 Instructions · 2.2.1 Practical example 1: Explaining HTTP 429 errors · 2.2.2 Practical example 2: Generating code review feedback · 2.3 Constraints · 2.3.1 Practical example: Writing secure logging guidelines · 2.4 Context · 2.4.1 Practical example 1: Generating an architecture decision record summary · 2.4.2 Practical example 2: Generating an incident handoff conversation · 2.5 Input parameters · 2.5.1 Practical example 1: Analyzing error logs · 2.5.2 Practical example 2: Generating release notes · 2.6 Output format · 2.6.1 Practical example 1: Generating a deployment checklist · 2.6.2 Practical example 2: Generating an API endpoint summary · 2.7 Delimiters · 2.7.1 Practical example 1: Summarizing an incident report · 2.7.2 Practical example 2: Answering questions from a runbook · 2.7.3 Defensive prompting tip · 2.8 Combining structural elements · 2.8.1 Practical example 1: Generating incident status updates · 2.8.2 Practical example 2: Generating a deployment GO/NO-GO brief · 2.8.3 Hands-on practice · 2.9 Summary

What you learn in chapter 2 →

Chapter 3: Prompt design: Linguistic elements

The introduction shows how precision, directness, and brevity can explain prompt-output problems even when the task, context, and output format are already specified.

3.1 Precision · 3.1.1 Practical example 1: API migration notice · 3.1.2 Practical example 2: Sequence diagram generation · 3.2 Directness · 3.2.1 Practical example 1: Backend API change review · 3.2.2 Practical example 2: Flaky CI test strategy · 3.3 Brevity · 3.3.1 Practical example 1: Incident summary analysis · 3.3.2 Practical example 2: Technical diagram generation · 3.4 Additional linguistic considerations · 3.4.1 Question vs. statement formatting · 3.4.2 Hands-on practice · 3.5 Summary

What you learn in chapter 3 →

Chapter 4: Patterns

The introduction positions prompt patterns as repeatable strategies that extend prompt structure and wording to address common interaction problems.

4.1 Understanding prompt patterns · 4.2 Role assignment pattern · 4.2.1 Practical example: Pull request description generation · 4.3 Delimiter pattern · 4.3.1 Practical example: Multisource 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 Request for Comments review · 4.9.2 Hands-on practice · 4.10 Summary

What you learn in chapter 4 →

Chapter 5: Templates

This introduction defines reusable prompt templates, explains how changing inputs fit into a stable framework, and emphasizes evaluation before use.

5.1 Prompt templates as reusable frameworks · 5.2 Practical example 1: Feature implementation plan generator · 5.2.1 Prompt template components · 5.2.2 Prompt template · 5.2.3 Prompt with input parameters injected · 5.3 Practical example 2: Legacy module refactor plan generator · 5.3.1 Prompt template components · 5.3.2 Prompt template · 5.3.3 Prompt with input parameters injected · 5.3.4 Hands-on practice · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Prompt types

The introduction explains why a prompt that combines enduring instructions with changing data can be split into system and user prompts.

6.1 Chat model architecture · 6.1.1 Three message types · 6.1.2 What you design: System and user prompts · 6.2 System prompts · 6.2.1 Purpose and principles · 6.2.2 Quick reference: Mapping chapter 2 elements to chat prompts · 6.2.3 Practical example: Linear issue assistant · 6.3 User prompts · 6.3.1 Types and templates · 6.3.2 Practical example: Harvest daily report assistant · 6.4 Prompt decomposition framework · 6.4.1 The core question · 6.4.2 Worked example: Decomposing step by step · 6.4.3 Quick decisions · 6.4.4 When to use architectural separation · 6.4.5 Common mistakes · 6.4.6 Hands-on practice · 6.5 Summary

What you learn in chapter 6 →

Chapter 7: Contextual prompting

The chapter introduces contextual prompting as using information inside a prompt to guide a model’s behavior for a specific request.

7.1 In-context learning · 7.2 Zero-shot prompting · 7.3 Few-shot prompting · 7.3.1 Practical example 1: CI pipeline failure handoff generation · 7.3.2 Format consistency · 7.3.3 Example selection · 7.3.4 Advanced variations · 7.3.5 Hands-on practice · 7.4 Summary

What you learn in chapter 7 →

Chapter 8: Prompt sampling

The introduction explains why a strong prompt may still produce different answers across calls and why sampling multiple responses can make decisions more reliable.

8.1 Sampling fundamentals · 8.1.1 Temperature and diversity · 8.1.2 Sample size · 8.1.3 Sampling in practice · 8.2 Mean · 8.2.1 Practical example: Runbook quality scoring · 8.3 Mode · 8.3.1 Practical example: Alert severity routing · 8.4 Self-consistency · 8.4.1 Practical example: Incident root-cause draft · 8.4.2 Checking self-consistency · 8.5 Best-of-N · 8.5.1 Practical example: Deployment status update for executives · 8.6 When to use sampling · 8.6.1 Hands-on practice · 8.7 Summary

What you learn in chapter 8 →

Chapter 9: Advanced prompt patterns

The introduction distinguishes three advanced prompt patterns by how each structures reasoning or prompt generation, and connects them to techniques from earlier chapters.

9.1 Chain of thought · 9.1.1 Practical example: Deployment risk reasoning · 9.2 Meta prompting · 9.2.1 The meta prompt template · 9.2.2 Practical example: Generating a pull request risk classification template · 9.3 ReAct · 9.3.1 Practical example: Data pipeline staleness investigation · 9.3.2 Hands-on practice · 9.4 Summary

What you learn in chapter 9 →

Chapter 10: Security

This introduction shows how a user message can cause a tested chatbot to expose customer data and frames prompt design as a security concern.

10.1 Why prompts are attackable · 10.1.1 Practical example 1: The unguarded prompt · 10.2 Prompt injection · 10.2.1 Practical example 1: The support chatbot · 10.2.2 Practical example 2: The injected document · 10.3 Jailbreaking and instruction conflict · 10.3.1 Practical example 1: The code review assistant · 10.3.2 Practical example 2: The policy chatbot · 10.4 Prompt-hardening techniques · 10.4.1 Practical example 1: Hardening a deployment notification bot · 10.4.2 Practical example 2: Hardening a ticket triage prompt · 10.5 The limits of prompt-only security · 10.5.1 Practical example 1: When the prompt fails · 10.5.2 Hands-on practice · 10.6 Summary

What you learn in chapter 10 →

Chapter 11: Managing prompts in production

The introduction explains why production prompts need ongoing management and defines that management as a prompt engineering discipline rather than an infrastructure concern.

11.1 Why prompt management matters · 11.1.1 The six pillars of prompt management · 11.1.2 Build vs. buy · 11.1.3 Practical example 1: The support bot audit · 11.2 The maturity journey · 11.2.1 Stage 1: Inline prompts · 11.2.2 Practical example: The weekend hack that shipped · 11.2.3 Stage 2: Config files and version control · 11.2.4 Practical example: The product manager problem · 11.2.5 Stage 3: Prompt store · 11.2.6 Practical example: The stale prompt discovery · 11.2.7 Stage 4: Dedicated prompt management system · 11.2.8 Practical example: The promotion without an approval record · 11.3 The prompt lifecycle · 11.3.1 Draft · 11.3.2 Practical example: The underspecified draft · 11.3.3 Test · 11.3.4 Practical example: The invisible regression · 11.3.5 Approve · 11.3.6 Deploy · 11.3.7 Observe · 11.3.8 Improve · 11.3.9 Retire · 11.4 Governance and collaboration · 11.4.1 Role-based access control patterns · 11.4.2 Approval flow patterns · 11.4.3 Practical example: The tone drift incident · 11.4.4 Audit trail and rollback · 11.4.5 Inline collaboration · 11.5 Using management signals to guide improvement · 11.5.1 The management signal inventory · 11.5.2 The improvement loop · 11.5.3 Practical example 1: The quarterly prompt review · 11.5.4 Practical example 2: The test set that stopped growing · 11.6 Common pitfalls and anti-patterns · 11.6.1 Prompt sprawl · 11.6.2 Blind updates · 11.6.3 Metadata black hole · 11.6.4 Ship equals redeploy · 11.6.5 Git hotfix rollback · 11.6.6 Shadow edits · 11.6.7 Manual playground testing · 11.6.8 Observability as an afterthought · 11.6.9 Overoptimizing early · 11.6.10 One prompt to rule them all · 11.6.11 Hands-on practice · 11.7 What you can do now · 11.8 Summary

What you learn in chapter 11 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.