Prompt Engineering
From a one-line request to the context an agent works in, prompt engineering as told through the free samples of the Leanpub books about instructing language models.
Created from the free samples of 22 Leanpub books and the descriptions and tables of contents of 9 more, with every source cited.
Prompt engineering is the practice of writing the input to a language model so that the output is reliable and useful for a stated purpose. A prompt is whatever text the model is given: a question, an instruction, a document to work on, examples of the result wanted. One of the sources defines the practice as the systematic design of those inputs, and insists on the second word: it involves understanding how the system behaves, designing for that behaviour, testing and revising.[1] The same source lists what it is not, which is a set of magic phrases, a substitute for knowing one's own subject, or a skill only programmers need.[1]
The field is young and its vocabulary is still moving. The advice of 2023 was about wording; by 2025 the term context engineering was in use for the wider work of deciding everything a model sees on a call, including retrieved documents, conversation history and tool definitions,[5] and the books about coding agents now speak of specifications, instruction files and harnesses. Several sources present these as successive names for one job,[22] and one of them says plainly that the boundaries blur in practice.[4] All of the books used here were published in 2026, and most were revised within weeks of this article.
This article covers how a model reads a prompt, the parts of a good one, guides written for a single model, prompt collections, the move from prompts to context, specifications and standing instructions, prompt injection, and testing. Its sources are the free samples of 22 Leanpub books and the public descriptions and tables of contents of 9 more. Where a sample says something, it is cited; where a book has no sample, it is cited only for what its description and contents list say, and the note in the Sources list says so. Retrieval-augmented generation has its own article.
Where to start
A reader who uses an assistant in a browser and writes no code can begin with Claude for Beginners, which asks only for ordinary computer skills and spends its first three chapters on turning a vague wish into a small task with an input, an output and a check.[2] The Professional Handbook for Working with AI is for professionals without a technical background and is about habits of work more than prompt wording,[13] and AI Employee OS: The Playbook gives a small-business owner one page of business context and one system prompt to start from.[12]
The general treatment is The Prompting Playbook, which favours no single provider and offers three reading paths, for the newcomer, the regular user and the builder of production systems.[1] Developers who are new to the subject have PROMPT ENGINEERING BASICS FOR DEVELOPERS, whose description treats a prompt as a task specification,[24] and those shipping to production have Prompt Engineering 2026, described as twelve chapters for engineers and product builders.[23]
Some sources come second. The model-specific guides, The Claude Opus 5 Prompt Guide, Claude Fable 5: The Definitive Guide to Prompt Engineering and Harness Design and Kimi K3 Prompting Guide, are for developers already calling the model through its API.[7][6][8] Context Engineering for AI Agents is addressed to engineers who have already shipped a prompt and watched it behave unlike the demonstration,[26] Context Engineering expects programming experience and some machine-learning vocabulary,[5] and Context Driven Development assumes a working knowledge of repositories, tests and delivery pipelines.[4]
History
For most of the history of computing, people adapted to machines: exact commands in a terminal, then menus and forms. Programs that conversed existed from 1966, when ELIZA imitated a therapist by matching patterns, but they worked only inside narrow scripts.[1] The transformer architecture of 2017 made it possible to train models on very large bodies of text, and the model released as GPT-3 in 2020 showed that a few examples placed in the input were enough to make it perform a task it had not been trained for, with no further training.[1] That finding, in-context learning, is the origin of the prompt as a way of programming.
The chat interface of late 2022 put the same ability in front of the public, and it soon became clear that people using the same model got very different results depending on how they asked.[1] Early context windows held about two thousand tokens, so a prompt had to be self-contained; as windows grew, practitioners found that explicit instructions, examples and step-by-step reasoning improved results, and by 2023 prompt engineering was a recognised skill.[5] Prompts that worked alone proved fragile inside larger systems, which led to retrieval, tool calling, memory and agents, and to a single call that might carry tens of thousands of tokens assembled from many places. The name context engineering spread in mid-2025 for the design of that whole package.[5]
How a model reads a prompt
The techniques follow from a few facts about the machine, and several sources begin there. A language model predicts the next token from the patterns of its training and the text it has been given; it does not understand a request as a person would.[7] Token, which has no sample, is described as following that process from encoded text through tokens, embeddings, attention and decoding, for general readers.[28]
Only the input exists
Context Engineering - EN puts the first fact most plainly: the context is everything the model receives on one call, concatenated into a single block, and what is not in that block does not exist for the model.[3] The complaint that an assistant ought to know a project's conventions credits it with knowledge that never came through the only door there is. The author proposes replacing the question of why the model got something wrong with the question of what in the input would have justified the right answer.[3]
The second fact is that a model keeps no state between calls. A chat appears to remember because the interface resends the whole conversation with every message.[3] The book's picture is a call centre where each call is answered by a different, superbly informed agent with no record of the caller: faced with a vague request, that agent gives the answer most likely in general, which is rarely the caller's.[3]
Attention and position
Within a call, the model weighs every part of the input against every other. A long log pasted in to illustrate an error goes on competing with the instructions for as long as it stays in the conversation, and instructions can lose.[3] Position matters as well: material at the beginning and end of a long context is used more reliably than material in the middle, so adding more does not improve results in proportion and past some point adds noise.[5] The guides for models with windows of a million tokens say the same of their own subjects. One notes that accuracy can degrade over very long contexts,[7] another recommends placing long documents first and the question last,[6] and the guide to a model that compresses earlier tokens as it reads advises repeating key constraints and placing critical information deliberately.[8]
The parts of a prompt
The sources agree closely on what a good prompt contains, though each has its own list. The playbook's contents name four pillars, role, task, context and format;[1] a beginner's guide uses outcome, inputs, boundaries, format and checks;[2] a developer's primer lists goal, constraints, context, expected output and acceptance criteria.[24]
Clarity and the brief
The common ground is that plain, explicit instructions beat clever ones.[7] Claude Fable 5: The Definitive Guide to Prompt Engineering and Harness Design suggests treating the model as a capable new employee who has been given no background, and offers a test: if a competent colleague could not carry out the task from the prompt text alone, the prompt needs work.[6] The Prompting Playbook opens with two people given the same task and the same model. One asks for a comparison of three features; the other names the audience, the criteria for a table and the assumptions to be flagged, and spends five minutes reviewing where the first spent twenty rewriting.[1]
Claude for Beginners adds a distinction that the technical books leave implicit, between the material supplied, the instruction, and what the material does not establish. A date missing from the notes is still missing after the notes become a polished announcement, so its prompts tell the model to use only what was supplied and to list what must be confirmed.[2] It also asks for a definition of done that can be observed, such as three bullets and no new dates, in place of a request for excellence.[2]
Roles
Assigning a role is the most familiar technique and the one the sources disagree on. One guide reports that a specific professional role in the system prompt yields more detailed and better-structured output than a generic one, and that a senior engineer with a stated speciality works better than a bare job title.[6] The beginner's guide grants that a job title sets a viewpoint but points out that it supplies no evidence and says nothing about the audience, the budget or the criteria for success.[2] Context Driven Development, taking a long prompt apart line by line, files its opening role sentence under usually unnecessary.[4]
Examples and structure
Examples of the wanted input and output, known as few-shot prompting, are described in one guide as often doing more for accuracy and consistency than pages of abstract instruction, with three to five well-chosen cases as the usual number.[7] A second adds that the examples should be varied and set apart from the instructions.[6] For that separation the guides to one family of models recommend descriptive tags around instructions, context, documents and examples, so that the model can tell which part is which,[6][7] and they advise stating the format wanted in positive terms, saying what to produce instead of what to avoid.[6]
Reasoning and effort
Asking a model to reason step by step before answering was one of the first techniques to be named, and the playbook's contents list its descendants: self-consistency, tree of thoughts, step-back prompting and others.[1] The newest models have absorbed part of it. Three of the guides describe models that reason by default, where the control is a setting for how much effort to spend and thinking cannot be switched off, or not at the highest settings.[7][6][8] The prompt's work then moves, as one of them says, from coaxing the model to show its reasoning to giving it the right information in the right order.[8]
Guides to a single model
A general book states principles that carry between models; a model-specific guide records what one model does differently. The Claude Opus 5 Prompt Guide limits itself to behaviour the vendor has documented and is most useful on what changed: a model that follows instructions more literally than its predecessors and no longer generalises an instruction from one item to the next, default answers that run long unless brevity is requested, and earlier techniques, among them prefilling the start of the reply and setting sampling parameters, that now return an error.[7] Claude Fable 5: The Definitive Guide to Prompt Engineering and Harness Design covers a sibling model in the same manner and classifies prompt failures into five kinds: an unclear task, missing context, the wrong problem, missing constraints and an overloaded request.[6]
Kimi K3 Prompting Guide argues from architecture, explaining an open model's attention mechanism and expert routing before any technique, and it is frank about limits: a reported hallucination rate of 51 per cent, a tendency to do too much when acting as an agent, and details inferred because the technical report was unpublished at the time of writing.[8] Prompt Engineering 2026, which has no sample, is described as taking the opposite line, concentrating on which approaches transfer across model families.[23]
Prompting a model that generates video is a different craft. Mastering LTX 2.5 Prompting treats the prompt as screenplay and shot list in one: the model reads it literally, fills any gap from its training, responds to the vocabulary of cinematography, and gives better camera moves when told where the camera ends up.[9] The sample puts the practical limit of an effective prompt at under 200 words and warns that text on screen cannot be relied on.[9]
Prompt collections and templates
A second kind of book supplies prompts ready to adapt. 100 Secret Claude Prompts for Solving High-Value Business Use Cases arranges a hundred by business function and gives each the same thirteen-part entry, from the objective and the prompt itself through the principles behind it to follow-up prompts; its introduction names the seven techniques the collection draws on, including role assignment, examples, placing documents before the question, and chaining prompts so that each output feeds the next.[10] The sample withholds the prompts themselves. 1,000 Practical Prompts for Claude, which has no sample, is described as twenty domains of fifty templates, each with a role, a context field, a task, format guidance and checks, and its description says they are starting points and not guaranteed results.[25]
For coding agents, Claude Code & AI Coding Agents Practical Workbook prints a master template of role, goal, context, process and output, and fifty one-page workflows that each end in success criteria.[11] AI Employee OS: The Playbook frames the same material as management: each of seven assistant roles has a job title and a system prompt, the owner approves everything that leaves the business, and the sample's context page marks which prices the assistant may quote and which decisions it must hand back.[12] The opposing view is in the playbook, whose thesis is that the people who do well will be those who understand the mechanics, not those who memorise templates.[1]
From prompts to context
The argument that runs through the 2026 books is that wording is no longer where most failures come from. Context Engineering opens with a support assistant whose retrieval worked and whose answers were still wrong, because what reached the model was too much in some cases, too little in others and never designed as a whole; it defines context engineering as the design of that information and divides it into task, domain and system layers, each maintained differently.[5] Context Engineering for AI Agents makes the same case in its description, that an agent in production almost never fails over a badly chosen adjective, and teaches by building a small context engine in Python under a token budget.[26] Reliable Generative AI Context Engineering, also without a sample, addresses knowledge workers instead of developers and is described as a seven-phase lifecycle that includes source precedence and the separation of trusted instructions from untrusted input.[27]
Specifications and instruction files
In software the move is from the prompt to written artefacts that outlast a session. Spec-Driven Development: From Requirements to Working Software with AI gives four reasons why prompting alone fails on larger systems: the context window cannot hold a whole system, natural language is ambiguous, the same prompt can yield different designs on different days, and a model produces code that looks correct more readily than code that meets a requirement.[14] Software Development in the AI Era, which has no sample, is described as the conceptual case for the same shift, from prompts to specifications.[29]
Context Driven Development shows the mechanics. It distinguishes prompt engineering, how a request is expressed, from context engineering, what information is made available, and takes a long prompt for a webhook service apart: some lines are requirements, some architecture decisions, some policy, some the task in hand and some a plan for verification, and each is moved to a file of its own.[4] The prompt that remains is short, and the point is that it has stopped being the only source of truth.[4] AI-Assisted Development rests its method on git, tests, context files and a sandbox, with a reviewed diff as the gate between the human's design and the agent's execution,[15] and Agentic Coding Harnesses, Compared & Explained locates the intelligence in the model and the agency in the harness, the program that runs the model's requests and feeds back the results, with a chapter on writing project instruction files.[16] The two visual guides by one author place the prompt as one of four parts, beside context, harness and loop.[21][20]
Standing instructions
Instructions that persist are a subject of their own. Mastering the AI Coworker, one developer's account of a year with a coding agent, says what he wanted was not a folder of prompt tips but an environment in which a correction made once still holds months later, and describes four layers: doctrine, a knowledge store, memory and enforcement.[17] Its argument is that pasting the doctrine into a larger prompt reproduces the words without the properties, and that a rule which exists only as prose is a suggestion until some check enforces it.[17] The Claude Skills Handbook treats one format for packaged instructions, a folder with an instruction file loaded on demand, as software to be designed, tested and versioned; a vague description means the instructions are never loaded, and an overlong file spends context on every use.[18]
Prompt injection
A model takes instructions and data through the same channel, and that is the root of the field's main security problem. Prompt Engineering & Security dates the problem to September 2022, when users of a social network redirected a company's automated account by replying with a sentence that told it to ignore its earlier instructions.[19] Its timeline runs from there through the extraction of hidden system prompts, instructions planted in documents that a retrieval system later hands to the model, instructions stored in an assistant's long-term memory, and an email that needed no action from its recipient, and it argues that prompt design and security can no longer be handled apart, since every piece of text entering an application is potentially an instruction.[19]
Two books without samples carry the argument to agents. AI Agent Security is described as resting on one principle, that a model may propose an action but must not grant itself the authority to take it,[30] and Beyond "Prompt and Pray" is a tutorial on surrounding the model with typed actions, gates and independent verification, for settings where a prompt and a second model's opinion are not enough.[31]
Testing and iteration
Every source treats a prompt as something revised against evidence. The beginner's guide teaches a loop of brief, clarification, draft, check and revision, changing one bounded thing at a time so that unwanted changes are easy to see, and it warns that a model's own checklist of what it preserved does not replace comparing the draft with the notes.[2] The developer's version is to read the output, name the exact flaw, assign it to a category of failure and make a single targeted change.[6]
At scale the vocabulary becomes that of software. The playbook's contents cover metrics, human and automated scoring, A/B tests, the use of one model to judge another, prompt libraries and version control,[1] and its introduction observes that organisations getting results treat prompts as production assets that are versioned and tested.[1] Reliable Generative AI Context Engineering is described as adding rubrics, baselines, regression tests and monitoring for drift.[27] The Professional Handbook for Working with AI states the limit that applies at every level: an assistant can draft, summarise and organise, but it cannot take responsibility for a decision.[13]
Questions about Prompt Engineering
Which prompt engineering book should I start with?
The Prompting Playbook is the general treatment, favouring no single provider and offering reading paths for the newcomer, the regular user and the production builder.[1] A reader who writes no code can begin with Claude for Beginners, which asks only for ordinary computer skills.[2]
What is the difference between prompt engineering and context engineering?
Prompt engineering concerns how a request is expressed, and context engineering concerns what information and instructions are made available to the model.[4] Context engineering treats everything a call carries, including retrieved documents, conversation history and tool definitions, as the thing to be designed.[5]
What should a good prompt contain?
Does giving the model a role improve its answers?
Why does a chatbot forget what I told it in an earlier conversation?
What is prompt injection?
It is an attack in which text supplied to a model is followed as an instruction, first widely seen in 2022 when users redirected an automated account by telling it to ignore its earlier instructions.[19] It is possible because every piece of text entering a model application is potentially an instruction, including documents the system retrieves for itself.[19]
Sources
Every source is a Leanpub book or course. The note after each says which part of it was read; where no sample was available, only the public description and table of contents were used.
- 1.The Prompting Playbook, Steve Publications: A Definitive Guide to Mastering Human–AI Communication with Large Language Models Free sample: the contents list, the introduction and most of chapter 1 (what prompt engineering is and is not, its economics and a short history). 2026. Free sample: PDF · EPUB
- 2.Claude for Beginners, Gianluca Raponi: A Visual, Hands-On Guide to Chat, Projects, Artifacts and Everyday Work Free sample: chapters 1 to 3 (choosing a task that can be checked, one conversation from brief to revision, the five-part brief). 2026. Free sample: PDF · EPUB
- 3.Context Engineering - EN, J.C.Ködel: Engineering Information for IA Systems Free sample: the front matter and the first two chapters (how a model uses context; the opening of tokens and context windows). 2026. Free sample: PDF
- 4.Context Driven Development, Luca Sepe: Beyond Prompt Engineering: A Systematic Approach to Building Software with AI Agents Free sample: selected excerpts (the preface, the method in one page, the case study and a long prompt taken apart). 2026. Free sample: PDF
- 5.Context Engineering, Steve Publications: Designing Intelligent Systems with Large Language Models Free sample: the introduction and chapter 1 (a history from prompts to systems, the definition of context engineering, its three layers, why naive prompting fails). 2026. Free sample: PDF · EPUB
- 6.Claude Fable 5: The Definitive Guide to Prompt Engineering and Harness Design, Steve Publications: Building Production-Grade AI Applications at Scale Free sample: the introduction, chapter 1 on the model and its settings, and chapter 2 on the foundations of prompting it. 2026. Free sample: PDF · EPUB
- 7.The Claude Opus 5 Prompt Guide, Steve Publications: The Definitive Reference for Mastering Anthropic's Most Capable Model Free sample: the preface, the introduction and the opening of chapter 1 (how the model reads prompts and what changed from its predecessors). 2026. Free sample: PDF · EPUB
- 8.Kimi K3 Prompting Guide, Steve Publications: Master Prompt Engineering for Moonshot AI's 2.8T-Parameter Frontier Model Free sample: the introduction and the opening of chapter 1, on the model's architecture. 2026. Free sample: PDF · EPUB
- 9.Mastering LTX 2.5 Prompting, Steve Publications: From First Frame to Cinematic Mastery: A Complete Guide to Video Generation with LTX 2.5 Free sample: the introduction and chapter 1 (what the video model is, its strengths, limits and terms); the chapters of prompts are not in it. 2026. Free sample: PDF · EPUB
- 10.100 Secret Claude Prompts for Solving High-Value Business Use Cases, Steve Publications: The Definitive Playbook for Executives, Entrepreneurs, and Operators Who Want AI That Actually Works Free sample: the introduction (the techniques used, the format of an entry, an ethics framework) and the opening of chapter 1; no prompt is in it. 2026. Free sample: PDF · EPUB
- 11.Claude Code & AI Coding Agents Practical Workbook, Dr. Mapesho Chibata: 50 Real-World Workflows, Command Cheatsheets, Prompt Templates, Debugging Checklists & Hands-On Exercises for Developers Free sample: how to use the workbook, the cheatsheets, the master prompt template and the first ten workflows. 2026. Free sample: PDF
- 12.AI Employee OS: The Playbook, AIEmployeeOS: Run your business with a team of seven AI employees (Edition 1) Free sample: a starter kit, not a chapter (the business context worksheet with a filled example, one role's system prompt, a daily brief, the approval rules). 2026. Free sample: PDF
- 13.The Professional Handbook for Working with AI, Thomas Reynolds, The Agile Mindset Ltd: How to Save Time, Think Better, and Get More Done with AI at Work Free sample: the preface and the chapter on the professional mindset shift; most chapters appear as headings only. 2026. Free sample: PDF · EPUB
- 14.Spec-Driven Development: From Requirements to Working Software with AI, Steve Publications: A Complete Practical Guide to Building Real-World Software Through Specification-First Engineering with AI Assistants and Autonomous Agents Free sample: the introduction and part of chapter 1 (from autocomplete to agents; why prompting alone fails at scale). 2026. Free sample: PDF · EPUB
- 15.AI-Assisted Development, Yohan J. Rodríguez: Working With Coding Agents Free sample: the preface and chapter 1, a map of AI development tools; the chapter on prompting is not in it. 2026. Free sample: PDF
- 16.Agentic Coding Harnesses, Compared & Explained, Yohan J. Rodríguez: Master Claude Code, Aider, OpenCode, Goose, and Codex — Then Run Them Locally Free sample: the preface and the opening of chapter 1 (what a harness is; the range of tools from autocomplete to agents). 2026. Free sample: PDF
- 17.Mastering the AI Coworker, Robert Nash: Principles for running an AI coworker in a one-person studio Free sample: the introduction and the opening chapters (the plateau after the first weeks; the four layers of the working environment). 2026. Free sample: PDF
- 18.The Claude Skills Handbook, Steve Publications: Designing, Building, Testing, and Operating AI Capabilities at Scale Free sample: the introduction and chapter 1 (what a Skill is, on-demand loading, the problems the format addresses). 2026. Free sample: PDF · EPUB
- 19.Prompt Engineering & Security, Steve Publications: Building Injection-Resistant AI Systems Free sample: the introduction (a timeline of prompt injection incidents from 2022 to 2026, the book's thesis and structure). 2026. Free sample: PDF · EPUB
- 20.Vibe Coding A Complete Visual Guide, Reiner Braun: Complete Practical Guide: Foundations, Delivery, Operations, Security, and Scale Free sample: chapters 1 and 2 (assistance modes, standards of done, risk and autonomy; the layers behind a coding agent). 2026. Free sample: PDF · EPUB
- 21.AI Driven Development A Complete Visual Guide, Reiner Braun: From Core Concepts to Secure Production Workflows Free sample: chapter 1 and the start of chapter 2 (a control loop, autonomy levels, evidence; tokens and context windows). 2026. Free sample: PDF · EPUB
- 22.AI Agents, Engineered, Enrique Gutiérrez: Designing, Building, Evaluating, and Operating Agents You Can Verify Free sample: front matter and the table of contents only; cited for its description. 2026. Free sample: PDF
- 23.
- 24.PROMPT ENGINEERING BASICS FOR DEVELOPERS, Anshuman Mishra: Write Better Prompts with GPT-6 No sample: from the description and table of contents. 2026.
- 25.1,000 Practical Prompts for Claude, Magicienduweb: 20 Domains. Clear Inputs. Useful Outputs. No sample: from the description and table of contents. 2026.
- 26.Context Engineering for AI Agents, CAIO INCAU: Context Engineering for AI Agents / Retrieval, Memory & Compression for AI Agents No sample: from the description and table of contents. 2026.
- 27.Reliable Generative AI Context Engineering, George Tome: A Practical Guide to Context Engineering, Reliability, and Enterprise Operationalization No sample: from the description and table of contents. 2026.
- 28.
- 29.Software Development in the AI Era, J.C.Ködel: From Prompts To Specifications No sample: from the description. 2026.
- 30.
- 31.Beyond "Prompt and Pray", Agus Sudjianto and Wing Yan Lau: Building Governed Agentic Systems with Geometric Memory and Verification A Practical Tutorial on Perception, Planning, Tools, Memory, Evaluation and Runtime Governance No sample: from the description and table of contents. 2026.
Further reading
Other books in the library on the same ground, not cited above.
- The Agentic AI CourseCourse, Dr. Ryan Rad: From Language Models to Multi-Agent Systems A twenty-lesson course on agentic systems, from model fundamentals to multi-agent orchestration. 2026.
- Engineering Memory for AI Agents, Steve Publications: From First Principles to Production Systems On memory systems for agents, including how stored memories are placed into a prompt. 2026. Free sample: PDF · EPUB
- Practical AI Security Engineering, Steve Publications: Building and Operating Secure AI Systems in Production An engineering reference on securing AI systems, with prompt injection among its threats. 2026. Free sample: PDF · EPUB
- PHOENIX - BUILDING PERSISTENT AI, Cleverson Santos A build guide for an assistant whose memory and identity are kept outside the model. 2026. Free sample: PDF
- Beyond "Chunk and Pray", Agus Sudjianto and Wing Yan Lau: Building Trustworthy RAG with Geometric Knowledge Graphs On retrieval systems whose answers can be traced to their evidence. 2026. Free sample: PDF