The best production prompts are the output of a program
Berryman and Ziegler's Prompt Engineering for LLMs earns its place by teaching how to gather, filter and order context for each request.

In brief
- Berryman and Ziegler divide prompt content into static and dynamic; the dynamic part is reassembled for every request.
- The closer information sits to the end of a prompt, the more influence it has; the middle is called the "Valley of Meh".
- Choosing context is a loop: take the best element given token length and dependencies, and repeat until no elements remain.
John Berryman, one of the first engineers on GitHub Copilot according to the bookseller Helion, has co-written a book that treats a prompt as something a system assembles. In production, a prompt is seldom a paragraph written once and left alone.
With each new request, the system builds the prompt from scratch, picking a few pieces of context from a much larger store. Prompt Engineering for LLMs, by Berryman and Albert Ziegler, teaches that skill, which also separates a demo from a system that works on a customer’s real data.
The book is published by O’Reilly Media under the full subtitle The Art and Science of Building Large Language Model–Based Applications. Helion’s store dates the ebook November 4, 2024 and cautions that the print date may differ; another bookseller’s page gives 2025.
It covers few-shot prompting, chain-of-thought and RAG, but according to its product page the core task is gathering, classifying and presenting pieces of context to build an effective prompt.
For an FDE, the most rewarding way to read it is to treat a prompt as the output of a program, with inputs, constraints and an order of execution. The authors do not use that phrase, but the way the book breaks a prompt into parts that are gathered, filtered and assembled leads straight to it.
The search background shows
Helion describes Berryman as a specialist in language models and information retrieval systems. The site of his company, Arcturus Labs, also mentions his contribution to Copilot’s early days and his work on search and recommendation systems with millions of daily users.
That background helps explain why the book handles prompts like a ranking problem: many candidates, limited space, a choice to make. The mindset is useful whenever you have to find the right contract, the right ticket and the right passage, then put them in front of the model in a deliberate order.
Arcturus Labs now sells a service that places an AI expert directly inside a client’s team. The site does not use the term FDE, but the working model is very close to the job.
First idea: separate static from dynamic
According to Strick van Linschoten’s notes on chapter 5, the book divides prompt content into two kinds: static and dynamic. The dynamic part changes with each request.
Take a hypothetical assistant that answers complaints for an insurance client. Tone of voice and the rule “answer only from the policy terms” are static. The terms of the contract under dispute and the sender’s ticket history are dynamic.
Separating the two from the start lets you test them independently: static content is managed as versioned configuration, dynamic content as query results. The table of contents on Helion also places RAG, along with lexical and neural retrieval, in chapter 5 on prompt content, which makes retrieval one way of obtaining the dynamic part.
Second idea: position carries weight
Gigazine’s summary of chapter 6 says that the closer information is to the end of the prompt, the more strongly it influences the model. The middle is called the “Valley of Meh”, where the model struggles to process information.
Return to the insurance assistant. An easy mistake in a first version is to state the rules only at the top of the prompt, then pour in five passages of policy terms and the ticket history after them.
The whole block of context then pushes the most important instruction away from the point where the model starts writing. It follows from the finding above that the cheapest fix is to restate the task and its constraints at the close, right before the answer.
Besides position, you have to choose a format. Gigazine’s summary also says that structured documents such as JSON, XML or YAML are very effective, especially when the model has been trained to expect that kind of structure.
On a real project, extracting data fields from invoices suits a structured format. If you choose prose, you will probably end up writing extra code just to patch malformed outputs.
Third idea: context assembly is an algorithm with a budget
Here the book reads most like a programming text. Strick van Linschoten’s notes on chapter 6 say it teaches how to structure a prompt, assemble the elements and choose which pieces of context go in.
According to Gigazine’s summary, the process has several steps, one of which is to choose the best element given its token length and dependencies, repeating until no elements remain.
The mistake this loop prevents is dumping every retrieved chunk into the prompt. The prompt swells, cost and latency rise, and the pieces that really matter tend to land in the middle, where the model performs worst.
In the insurance example, the contract terms have the highest value. The most recent ticket has high value but depends on customer information already being present. The general FAQ has low value. If the client wants fast responses, you will want to lower the token budget, and the FAQ is the first thing cut.
Below is a sketch of that loop, short enough to copy into a project and adapt:
def assemble_prompt(task, elements, token_budget):
# elements: [{"id", "text", "value", "tokens", "depends_on", "order"}]
remaining = sorted(elements, key=lambda e: e["value"], reverse=True)
chosen, chosen_ids, used = [], set(), 0
while remaining: # stop when no elements remain
e = remaining.pop(0) # highest-value element left
if used + e["tokens"] > token_budget:
continue # skip if it does not fit the budget
if not set(e["depends_on"]) <= chosen_ids:
continue # skip if a dependency is missing
chosen.append(e)
chosen_ids.add(e["id"])
used += e["tokens"]
chosen.sort(key=lambda e: e["order"]) # order, then assemble
context = "\n\n".join(e["text"] for e in chosen)
return f"{task}\n\n{context}\n\nTask reminder: {task}"
The sketch is deliberately simple: an element skipped for a missing dependency is never reconsidered. But it moves the decision about what to cut out of the prompt author’s memory and into code, where you can test it, tune token_budget to the latency requirement and explain it to the client.
What order should you read it in?
This suggestion rests only on the chapter titles on Helion and one reader’s notes on chapters 5 and 6. The full table of contents and text were not consulted.
If you have called an LLM API but have yet to put a system into production, read chapter 5 on prompt content first, to learn the static-dynamic split and the types of retrieval. Then move on to chapter 6, Assembling the Prompt.
If you already run RAG for clients, you can go straight to chapter 6. It turns a pile of retrieved context into a prompt with a clear order and specific limits.
For your career, put this skill on your résumé in engineering terms. A line such as “designed a prompt assembler that selects context by token budget and latency requirements” is far more convincing than “proficient in prompt engineering”.
When reading job descriptions, look for roles that mention context, retrieval or latency alongside LLMs. Interviewers there will want to hear what information you decided to cut, and why.
Prompt tricks go stale with each model generation. The discipline of choosing what to include and where to place it remains useful, and it is the part of this book to keep.
Was this article useful?
Thanks for the feedback!
6 sources
- Prompt Engineering for LLMs - John Berryman, Albert Ziegler (Helion) · 2024-11-04
- Prompt Engineering for LLMs: The Art and Science of Building Large Language Model–Based Applications 1st Edition
- Arcturus Labs – John Berryman
- Prompt Content: Notes on 'Prompt Engineering for LLMs' ch 5 · 2025-01-11
- Assembling the Prompt: Notes on ‘Prompt Engineering for LLMs’ ch 6 · 2025-01-12
- Prompt Engineering for LLMs (Gigazine) · 2025-08-19