What you will learn in Prompt Engineering in Practice
Design, test, and improve AI prompts
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
What you learn in chapter 11 →Concepts explained in this book
- promptA prompt is an instruction and context artifact supplied to a model to specify a task, constraints, and expected output.
- prompt templateA reusable structure for supplying changing user-specific content to a model.
- system promptA system prompt is a prompt containing stable instructions that define a model's behavior across interactions.
- prompt engineeringThe deliberate construction of a prompt's instructions, context, constraints, and output requirements.
- delimiterA marker that separates or bounds distinct regions of content in a prompt.
- constraintA constraint is a requirement that limits the inputs, behavior, or outputs permitted for a model interaction.
- trust framingTrust framing is a prompting technique that explicitly states which prompt content is authoritative and which content is untrusted data.
- output formatA structured output is a model result organized according to a predefined machine-readable or systematically validated structure.
- fallbackA predefined response or processing path used when input is malformed, incomplete, invalid, or manipulated.
- parameterA model parameter is a setting that controls a model's behavior when generating an output.
- instructionAn instruction is a directive within a prompt that specifies the task the model should perform.
- prompt engineering lifecycleThe sequence of managed stages through which a prompt progresses from drafting and testing to deployment, observation, improvement, and retirement.
- closed-world instruction setA closed-world instruction set explicitly defines permitted behavior, rules out unspecified alternatives, and supplies a predetermined response for disallowed or unsupported requests.
- delimiter-based separationDelimiter-based separation is a prompt-hardening technique that marks the boundaries of untrusted content so a model is less likely to interpret it as instructions.
- specificationA precise statement of the required behavior, constraints, and expected results of a system component.
- instruction conflictInstruction conflict is a condition in which competing directives in a model interaction prescribe incompatible behaviors or priorities.
- contextContext is supplementary information supplied to a model because it cannot be assumed to know it.
- refinementA prompt strategy that incrementally improves existing content.
- chain-of-thought promptingA reasoning or prompting technique in which a model generates intermediate steps toward an answer.
- precisionPrecision is a prompt-expression dimension that specifies requirements narrowly to reduce interpretive freedom.
- few-shot prompt contextFew-shot prompting is a prompting technique that provides a small number of input-output examples to guide a model's response.
- prompt injectionPrompt injection is an attack technique that inserts adversarial instructions into model input to alter or override intended behavior.
- inversion patternA prompt strategy that challenges an answer or assumption from an alternative or opposing perspective to reveal omissions.
- testThe systematic evaluation of a component against defined cases and expected results to detect defects or variation.
- role assignmentA reusable prompt structure that instructs a model to adopt a specified role, expertise, or voice before performing a task.
- ReActReACT is a prompting pattern for agentic workflows in which a model alternates between reasoning, actions, and observations.
- structural elementA structural element is one of the organized parts of a prompt, including its instruction, constraint, context, input parameter, output format, or delimiter.
- brevityBrevity is a prompt-expression dimension concerning how few words are used to obtain the required output.
- few-shot chain of thoughtA prompting technique that provides worked examples demonstrating intermediate reasoning steps.
- casual promptingAn informal prompting approach based on ad hoc wording changes and subjective judgment rather than systematic specification and evaluation.
- minimal context exposureMinimal context exposure is a prompt-hardening technique that supplies only the information required for the model to complete its task.
- prompt managementA system for managing prompts across their production lifecycle, including collaboration, governance, and lifecycle visibility.
- prompt with input parameters injectedA prompt with input parameters injected is a prompt whose execution-specific values have been substituted into a reusable prompt structure.
- directnessDirectness is a prompt-expression dimension that determines whether instructions are stated explicitly or conveyed indirectly.
- prompt decompositionPrompt decomposition is the process of separating a prompt into components according to their roles and whether their content is stable or variable.
- jailbreakingAn adversarial technique that attempts to induce a model to bypass its intended instructions or behavioral restrictions.
- qualitative constraint languageQualitative safety language consists of vague prompt directives that express desired safe behavior without specifying precise conditions and requirements.
- prompt securityPrompt security is the practice of protecting model behavior and sensitive information from attacks delivered through prompts or other model inputs.
- comment-driven generationA technique for organizing reviewer feedback as comments anchored to selected content and generating targeted modifications from that feedback.
- prompt repetitionA repetition pattern is a structural prompt strategy that repeats the full prompt so a model processes it twice before responding.
- self-reflectionA prompt strategy in which a model examines or critiques its own reasoning or output.
- governanceThe policies and processes used to control review, maintenance, and responsible operation of an artifact or system.
- output varianceOutput variability is the degree to which generated outputs differ across generations for the same task.
- system-level responseA security measure implemented in the surrounding system rather than in the prompt or model generation process.
- maturity journeyThe Maturity Journey is a framework for assessing a team's prompt-management maturity and identifying its next practical improvement step.
- trusted inputModel-provided content treated as authoritative or safe to follow within a prompt's trust model.
- untrusted inputExternally supplied material that must not be treated as authoritative instructions without additional controls.
- assistantAn assistant message is a conversational message representing content generated by the model.
- modeThe mode is the most frequently occurring value in a set of categorical or numerical observations.
- zero-shot promptingZero-shot prompting is a prompting technique that asks a model to perform a task without providing task examples in the prompt.
- prompt libraryA centralized storage structure that holds prompt records and supports their retrieval and management.
- delimiter patternA prompt pattern that uses delimiters to distinguish input parameters or content regions.
- diagnostic lensA recurring analytical perspective for identifying why a prompt produces unreliable or unsuitable results.
- linguistic elementA linguistic element is a dimension of prompt expression that governs how requirements are worded.
- system/user separationArchitectural separation is the separation of stable model instructions from variable user-provided input into distinct prompt components.
- implicit promptA prompt that conveys its goal indirectly, leaving the model to infer requirements or interpretations.
- user messageA conversation message containing a user's query, request, or contextual information for a model to process.
- best-of-NBest-of-N is a sampling technique that generates multiple complete candidate responses and selects the strongest candidate.
- self-consistencySelf-consistency is a sampling technique that generates multiple reasoning paths and selects or aggregates the conclusion that is most consistent across them.
- prompt patternA reusable prompt structure for addressing a recurring prompting problem and its trade-offs.
- format consistencyFormat consistency is the practice of keeping corresponding examples and outputs in a uniform structural shape so that a model receives an unambiguous pattern.
- meanThe sum of a set of numerical values divided by the number of values.
- antipatternAn anti-pattern is a recurring practice or design approach that appears workable but commonly produces undesirable outcomes.
- meta-promptMeta Prompting is a prompting technique in which a model is instructed to design, refine, or apply prompts for another task.
- monolithic promptA monolithic prompt is a single prompt block that combines stable behavioral instructions with variable input data.
- placeholderA placeholder is a symbolic position in a template reserved for a value that changes between uses.
- failure modeA failure mode is a distinct way in which a system, artifact, or process can produce an incorrect or undesired result.
- acceptance criteriaDefined conditions that a result must satisfy to be considered acceptable.
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.
