liveBook · Manning

Prompt engineering

As explained in Grokking AI Applications

Prompt engineering is the systematic design and refinement of prompts to influence a generative model's outputs.

Prompt engineering systematically designs and refines prompts to guide generative model outputs. An LLM cannot read your mind, so the prompt must communicate the intended result clearly. section 3.0 section 3.1

Treat it as both science and art: use theories and proven frameworks, then experiment, test, and adjust because natural language allows multiple effective approaches. section 3.0

A practical prompt-design process:

  • Define the desired task and provide enough relevant context for a useful response. section 3.1
  • Remove irrelevant detail as well as vagueness; extremely short prompts invite tangents, while overloaded prompts can obscure the command. section 3.1
  • Account for the finite context window, since excessively long prompts can degrade response quality. section 3.1
  • Experiment with prompt structures and templates, then evaluate outputs rather than assuming the first response is exceptional. section 3.0 section 3.1

A standard prompt template

A thoughtful-daughter scenario demonstrates how a structured prompt can turn a vague request into a more directed interaction. Role, task, features, and examples provide useful organizing elements. section 3.1

Figure 3.2 The standard prompt template in action—for a thoughtful daughter

Use the visual template example to see how a prompt moves beyond a generic request toward a specified task. section 3.1

How Grokking AI Applications covers it

How deep it goes
Explains prompt structure, length, context, hallucinations, templates, and experimentation without descending into model internals.
Examples
Uses a thoughtful-daughter template and visual examples organized around roles, tasks, features, and examples.
What it assumes
Assumes basic familiarity with GenAI and LLMs while teaching prompt theory, structure, and refinement as foundational skills.
What you can do after
Apply iterative prompt design to produce clearer, more useful, and better-aligned LLM responses.
How it connects
Connects prompt design with LLMs, hallucinations, context windows, external tools, retrieval, and agentic structures.

Also explained in

Compare how 38 books explain prompt engineering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.