02Chapter 2: State the task, role, and audienceThis chapter assumes you have called an LLM chat API, can read basic Python and JSON, and know that a system message holds instructions that persist across a conversation. Here you will write the opening section of a system prompt: what the model does, who it acts as, and who reads its output.3 min read
03Chapter 3: Organize the prompt with sections and delimitersThis chapter assumes you have called an LLM chat API, can read basic Python, and know what system and user messages are. It covers how to lay out a prompt so the model can tell instructions from data.3 min read
04Chapter 4: Write constraints that the model can followThis chapter assumes you can call an LLM chat API, read basic Python, and have written a short system prompt with a task and a role. It covers the "Rules" part of a system prompt: how to word constraints so the model follows them and so you can check that it did.3 min read
05Chapter 5: Specify the output formatThis chapter assumes you have called an LLM chat API, can read JSON, and can read basic Python. It also assumes you know what a system prompt is and how to state a task and rules.3 min read
06Chapter 6: Teach by exampleThis chapter covers few-shot examples: when to include them, how to choose them, and how to keep them from hurting your prompt. It assumes you have read the earlier chapters on roles, constraints, and output format. You should be comfortable with a system prompt that already states a task and a JSON3 min read
07Chapter 7: Add dynamic and retrieved contextThis chapter assumes you can call an LLM chat API, read basic Python, and work with JSON. It also assumes you have seen how a system prompt uses sections and delimiters. Here you will learn how to add content that changes on every request, such as retrieved documents, user profile data, or the curre3 min read
08Chapter 8: Handle untrusted input and prompt injectionThis chapter assumes you have called an LLM chat API, can read basic Python, and know the difference between system and user messages. It also assumes you have seen how to wrap content in delimiters.3 min read
09Chapter 9: Instruct the model on tool useThis chapter assumes you have called a chat API with tool (function) definitions before, can read JSON, and can read basic Python. It builds on the earlier chapters about constraints and output format.3 min read
10Chapter 10: Guide reasoning and handle uncertaintyThis chapter assumes you can call a chat API, read basic Python, and have written a system prompt with a task, rules, and an output format. Here you will learn how to tell the model when to reason before answering, and what to do when it does not know.2 min read
11Chapter 11: Test prompts with a small evaluation setThis chapter assumes you can call an LLM chat API, read basic Python, and handle JSON. It also assumes you have a system prompt with a fixed output format, like the Acme Billing prompt from earlier chapters.3 min read
12Chapter 12: Diagnose and fix common failuresThis chapter assumes you can call a chat API, read JSON and Python, and have a system prompt with a small test set like the one from the evaluation chapter. Here you learn to turn a failing test into a targeted prompt change.2 min read
13Chapter 13: Version and maintain prompts over timeA system prompt is part of your application's behavior, so it needs the same care as code. This chapter assumes you can read Python and have built a small test set, as in the evaluation chapter. It covers how to store, change, release, and retire prompts without surprises.3 min read