The Prompt
local graph
Chapter 4 — The Prompt
Section titled “Chapter 4 — The Prompt”Once you start working with AI, the prompt becomes a large share of what you do — and for many practitioners, the main thing they do all day. You will write thousands of prompts, most of them short and almost casual — a sentence, sometimes a phrase. Behind every prompt is a decision almost no one makes consciously: what kind of conversation are you trying to have? Different shapes of prompt pull different work out of AI. Getting the shape right costs nothing extra. Getting it wrong costs you twice: tokens and cleanup.
Most people default to one shape — they type a command. “Do this.” “Fix that.” “Write me a function.” It works often enough that it feels like the whole job. It is not. A prompt can also ask AI to research, to plan, to suggest options, to analyze, to explain, to critique — or to combine several of these in one prompt. You do not need to label every prompt, but knowing which kinds exist helps you get what you actually want. The list is not exhaustive — it is meant to show variety, not to constrain you. The names of the modes that follow are mine; the point is the shape, not the vocabulary.
One framing note before the modes themselves. The shapes that follow assume fairly tight control over AI’s actions — you write the prompt, AI responds, you decide what comes next. That is the workhorse pattern, and the rest of this chapter explores its range. Agentic AI is capable of far more, and the book gets to that gradually in the chapters ahead.
Command
Section titled “Command”Command mode is the one everyone starts with. You tell AI to do a thing, and AI does it.
Add a cancellation_reason string field, 200 characters max, nullable, to theBooking entity.Create file voice.md at the project root with three rules: write in plainlanguage, push back when needed, no filler.Rename folder drafts/ to archive/.The request is concrete. The result is a change in the project.
Command mode is fast, but it is also the most dangerous. When AI follows an instruction without question, it produces output you do not see before the change lands. If your instruction was incomplete — and most instructions are — AI fills the gaps with its defaults. By the time you see the result, the work is done, and rolling it back costs both tokens and time.
Command mode has a safer variant worth using often: ask AI to display the changes before making any of them. You describe the thing you want done, and you tell AI not to touch any files yet — just to list, concretely, what it would change.
Add a cancellation reason field to the booking entity. Do not change any files.List every file you would touch and every specific change you would make, and askfor my approval. Once I approve, apply the changes.AI responds with a list — the files, the exact edits, the new fields, the rename operations. You read the list. If it matches what you meant, you say “go.” If it does not, you correct the list before any edit happens.
The preview variant is for when you already know what you want done and just want to confirm that AI understood you before it acts. It pairs especially well with larger edits, changes that span multiple files, and anything irreversible.
Research
Section titled “Research”Research mode is when you ask AI to go find something — usually on the web, sometimes inside your own project, sometimes both.
Research online the current pricing for pet insurance providers in California.Search the web for what books exist on spec-driven development.Read through the data model file in this project and tell me where we define thebooking status.The output of Research is information, not action. Nothing changes in the project unless you decide it should. That is what makes this mode safe — AI is fetching, not building.
For most agents — Perplexity is the one exception I know of — phrases like “search the web” or “research online” are necessary cues. Without them, the model may answer from training data, which is fine for stable knowledge but almost never right for anything recent. Make the choice explicit: search the web, answer from training data (faster, but possibly stale), or combine sources — for example, read a project file first and then search the web to fill in what is missing.
For long reports, ask AI to save the result to a file rather than dump it into the chat.
Research the current pricing for pet insurance providers in California. Record thefindings to research/pet-insurance-pricing.md. Let me know once done; no summaryin the chat.The file lets you come back to the report later, potentially in a fresh session, without dragging the original research context along.
Suggest
Section titled “Suggest”Suggest mode is when you do not yet know what you want, and you want AI to give you options.
I want to add a loyalty feature to the booking app. Give me five approaches, eachwith a short description of how it would work.What are the ways we could handle same-day cancellations?Suggest three titles for this book, each with a justification.The difference between Command and Suggest is that in Suggest mode, you are not committing. You are shopping. The output is a menu. You pick, you mix, you reject, you ask for more. Nothing is built until you choose.
The value of Suggest mode grows the further you are from a decision. When you have already decided, asking for suggestions wastes tokens — AI will produce options, you will pick the one you already had in mind, and the rest will be discarded. When you are genuinely unsure, Suggest mode widens your thinking before you narrow it.
One caution. AI’s suggestions reflect the statistical center of its training data, often clustering around the same mainstream answer with minor variations. If you want variety, ask for it explicitly — “give me five genuinely different approaches, not five variations on the same one” — and be prepared to reject options that look alike.
Draft mode is when you give AI a seed — a sentence, a kernel, a rough idea — and ask it to expand the seed into prose, a clause, a paragraph, a piece of copy. AI returns a draft. You read it, revise it, ask for another pass, or scrap it. Nothing lands in any file until you say so.
Draft a section explaining how cancellation refunds work in this booking app. Theseed: refunds are issued automatically for cancellations more than 24 hours ahead,partial for 12-24 hours, none under 12 hours. Tone: clear and customer-facing.Display for review.Draft a terms-of-service clause for booking modifications. The pattern: bookingscan be modified up to 24 hours before the appointment without fee. Show theclause; do not commit it anywhere yet.Draft a paragraph for the FAQ explaining the difference between cancellation andreschedule. Show it to me first.Draft is close to Suggest, but the shape is different. Suggest produces options to pick from — a menu. Draft produces a single piece of content to revise. If you want to compare alternatives, ask for suggestions; if you have an idea and want it made concrete, ask for a draft.
The “do not commit yet” instruction is the part that makes Draft mode safe. Without it, in a project where AI has write access, the same prompt slides into Command mode territory. AI writes the section into the file, and you review it in place. Rolling back a bad draft costs more than rejecting it before it is written. Keep drafts in the chat until you accept them.
Draft mode applies anywhere you go from a condensed idea to cohesive prose: book chapters, marketing copy, contract clauses, research-protocol sections, policy text, internal memos, speech drafts, customer emails, press releases, blog posts, translation drafts. The mode helps most in three situations: when you are not a native speaker of the target language and want fluent prose; when you are a creative writer who wants specific voice guardrails enforced; and when you can think faster than you can type, and the act of writing is the bottleneck.
For long drafts, ask AI to save the generated text to a working file rather than dump it into the chat.
Draft Chapter 3 in full. Save to drafts/chapter-3-draft.md. I will review the fileseparately.The point is to enable the work downstream — potentially across multiple sessions, potentially piece by piece over time. A draft in the chat is stuck in the session that produced it; a draft in a file can be picked up later, in any session, and worked on incrementally.
One last thing. Drafts default to the statistical average of AI’s training data — earnest, slightly generic, polished without personality. What lifts drafting beyond that default is a voice profile: a written description of the project’s voice, with dos and don’ts, and optionally an anchor to a well-known author whose style the model already knows. The mechanism that holds the voice in place is the subject of the Guardrails section below and of the durable rules in the next chapter. Once a voice profile is in place, the prose comes back closer to yours than to AI’s.
Analyze
Section titled “Analyze”Analyze mode is when you ask AI for a judgment about something — an evaluation, a diagnosis, a comparison, a pass for weaknesses.
Here is the data model. Walk through it and identify any fields that might needindexing.Read this section and list all logical conflicts.Analyze these two approaches to handling cancellations. Give me pros and cons foreach.Analyze produces a structured opinion. You hand AI an object — a file, a description, a list of options — and ask it to take that object apart. The output is neither an action nor raw information. It is a judgment, rendered on something specific.
Analyze mode is useful because it forces AI to slow down. A command gets executed; a suggestion gets generated; an analysis requires AI to look at the subject and reason about it. The reasoning appears in the output, and that visibility gives you a chance to spot where AI’s understanding diverges from yours.
Be specific about what you want analyzed. “Analyze this” produces a little of everything. “Analyze this for edge cases in the cancellation flow” or “Analyze this for fields that do not match the glossary” produces a focused response you can actually use.
For long analyses, have AI record the findings in a file, not in the chat.
Analyze the entire book and find every place where the written text disagrees withthe voice guidelines of the project. Record each finding inanalysis/voice-misalignment.md with the chapter number, the section name, theparagraph number within the section, and a short sentence describing themisalignment. Let me know once the file is written; no summary in the chat.The reason is the same as in Research mode: you can handle the file in a fresh session, at a later time.
Explain
Section titled “Explain”Explain mode is when you ask AI for an explanation of something — a definition, a walk-through, a rationale. Not to evaluate it, not to change it.
Explain how the booking status transitions work in this project.Tell me what a foreign key is, in the context of this data model.Walk me through why we chose to keep the glossary inside CLAUDE.md.Where Analyze asks for a judgment about an object, Explain asks for understanding of it. The simplest test is whether “is it good?” fits the question — if it does, you are in Analyze mode; if not, Explain mode. The output is usually a translation from dense to understandable: a walk-through, a definition, a piece of prose meant to be read once and absorbed.
Two variants of Explain are worth naming.
The first restricts AI to the project.
Explain how booking status transitions work in this project. Use only the projectfiles. Do not use training knowledge or online sources. If something is missingfrom the files, say so explicitly rather than fill it in.Run this in a fresh session — an existing session carries earlier conversation in its context, and AI can easily blur what you said with what the files contain. Used this way, you get a clean picture of what the project actually says — and, just as usefully, what it does not. The gaps are honest gaps, not hidden behind plausible-sounding defaults. You will sometimes discover that something you thought was written down only lives in your head.
The second variant uses all sources but asks AI to keep them separate.
Explain how booking status transitions work in this project. Then summarize whichparts of the explanation came from the project files and which came from trainingdata or online sources.This gives you a usable explanation now and an inventory of context that is not yet recorded. You can decide, item by item, whether to bring the external material into the project — verbatim, with edits, or not at all.
One of the biggest wins of Explain mode is that it turns your project into an interactive wiki. Months after the work is done, you — or a newcomer to the project, or anyone with access — can ask the project anything: what a term means, why a decision was made, how a flow works, what a piece of inherited architecture is for. The answer comes back instantly, grounded in the project records, and targeted to exactly what you asked.
Critique
Section titled “Critique”Critique mode is when you want AI to argue against you — attack your assumptions, generate counterarguments, push back on a direction you are leaning toward.
Shoot holes in this assumption: small grooming shops will pay $50/month for amobile app for appointment booking.Give me three counterarguments to building our own authentication mechanism insteadof using a third-party provider.I want to switch from monthly to annual billing on the main plan. Push back withjustification.Critique is close to Analyze, but the posture is different. Analyze asks for a fair examination. Critique asks for the opposition — the case for the other side, the holes you have not seen, the assumptions you made without realizing. A good critique is uncomfortable to read, but extremely useful.
One rule worth following: do not muddy the prompt with your own reasons. The moment you say “I want X because Y,” you have given AI a justification to anchor on — and AI’s trained tendency to please will quietly soften the critique or echo your reasoning back at you. Withhold the why. Let AI build the case against you from a clean prompt.
Critique mode works because AI is not attached to your ideas. A human collaborator who likes you will hold back. AI has no such instinct unless you put it there. The downside: AI will sometimes invent weaknesses that do not exist, so after the critique, you separate the real problems from the imagined ones. Even with that extra step, you catch more real weaknesses than you would by reviewing alone.
Combining Modes
Section titled “Combining Modes”Modes are not mutually exclusive. A single prompt can combine two or three of them, and some of the most useful prompts are stacked.
Consider this one:
I feel that storing booking history in a separate table is the right solution, butI cannot rationalize it. Analyze the current schema, research best practicesonline, and list the pros and cons with detailed justification for each.The prompt stacks Analyze mode, Research mode, and a structured form of Suggest mode. AI examines what already exists, pulls in outside references, and hands back a comparison you can decide from. Any one of the three modes alone would give you less: analyze without research is internal-only; research without analyze floats above your actual project; suggest without either is a menu with no grounding.
Consider another prompt:
Add a cancellation reason field to the booking entity, unless you see a seriousreason not to - in which case, push back with justification.[…] Command mode with a built-in opening for Critique. You tell AI what to do, and you give it explicit permission to object if something is off. The permission matters. Without it, a Command mode prompt invites execution — even on instructions that are subtly wrong. With it, AI will sometimes come back with “before I do this, the booking entity already has a status_reason field; should I use that instead?” That is a different outcome from silently adding a duplicate field. The same critique-on-top pattern shows up in non-software work: a prompt that adds a clause to a contract spec, unless the clause already exists in another section; a prompt that adds an exclusion criterion to a research protocol, unless the criterion contradicts an inclusion already recorded.
Consider a third:
Research best practices for processing refunds via Stripe for online purchases, andgive me the top three recommendations for the website specification in thisproject.This stacks Research mode and Suggest mode. AI gathers external knowledge, then narrows it to a short list scoped to your project. Without Research, Suggest mode produces options from training defaults — generic, possibly stale, untethered to current practice. Without Suggest, Research mode produces a wall of findings you still have to distill yourself. The combination saves the second step.
The pattern behind these examples is the same. You pick modes because they match what you are trying to accomplish, not because more modes are better. If you need a decision, one prompt that analyzes your current state, pulls in outside references, and lays out options is faster and more coherent than three separate prompts. If you are about to issue a command but are not sure it is right, stacking Critique on top of Command turns the prompt into a single round trip that catches the obvious problems before they land in your files.
The risk of stacking is scope. Keep the stack small — two or three modes in one prompt is useful; five is a mess. And keep it intentional: stack modes because you want the combined output, not because you are hedging.
Iterate
Section titled “Iterate”Iterate mode is when one step in the prompt produces a list, and a later step runs against each element of that list. The list is not known when you write the prompt — it is whatever AI finds, builds, or returns from the first step.
Search Amazon for every book on Spec-Driven Development. For each book found,research independent reviews outside Amazon. Display a combined summary table withtitle, publication date, author, and an aggregate ranking from 1 to 10 across theindependent reviews.Read through every entity in the data model. For each entity, list the fields thatare nullable and write one sentence explaining why each one is allowed to be null.Pull every cancellation reason logged by the booking app over the last 90 days.For each distinct reason, count how often it occurred and rank the list from mostto least common.The shape has three parts: a step that produces a list, a step that runs against each element of the list, and — usually — a join at the end that pulls the per-element results into one deliverable. The phrase “for each” is the giveaway. AI handles the loop internally; you do not type a separate prompt per element.
What makes Iterate distinct from Combining Modes is the dependency between steps. Combining stacks several modes against the same fixed input — a file you point at, a question you ask. Iterate chains them: the second step’s inputs come from the first step’s output, and the size of the second step’s work depends on what the first step finds.
Each step inside the loop can itself be one of the modes covered above. The outer step is often Research or Analyze. The inner step might be Research again, Analyze (“for each entity, analyze what indexes it would need”), Draft (“for each clause, draft a plain-language summary”), or Critique (“for each assumption, give me one counterargument”). Suggest mode, interactive by design, does not fit naturally inside the loop. The join at the end of the loop is often a table, a file, or a short summary.
A few cautions. The cost of an Iterate prompt scales with the size of the list, and you do not know that size when you write the prompt. If the first step returns 500 items, the second step runs 500 times. Three independent controls help. Treat each as a separate decision in the prompt — do not fold them together.
The first is the size of the list. Cap it with an upper bound (“at most 30 items,” “no more than 50”) to keep the loop from running away. Add a floor when you want to push the first step to do more work — “find at least 100 books on Spec-Driven Development online” makes AI search wider and assemble a substantial dataset for the loop to chew on. Without a floor, AI is free to decide that two results are enough and move on. The cap is a safety rail; the floor is a work order. Together they say how many, not which ones.
The second control is the sort order. State the criterion explicitly — “sort by publication date, newest first,” “sort by average review score, highest first,” “sort alphabetically by title.” Without an explicit criterion, AI picks an order from defaults, and a phrase like “top ten” can mean five different things in five different sessions.
The third control is the shortlist, and it is optional. The shortlist exists for situations where you want the loop to run against the top items by some criterion, but evaluating every candidate against that criterion is impractical. Two shapes of “impractical” call for it. Either the source cannot search by the criterion you care about, or it can but the candidate set is too large to iterate through — a product database with a million rows is technically searchable, but querying it may take unreasonable time and will exhaust AI’s context window. Take “the ten cheapest suppliers of corrugated cardboard.” Web search does not let you sort by price — it only matches keywords. Search for “cheapest corrugated cardboard supplier” and you get the suppliers most aggressively advertised as cheap, which is not the same thing; suppliers with other marketing claims, or with no investment in search visibility, never surface. Search for “all suppliers” and you get a near-infinite number of results to sift through. Neither gives you the ten cheapest.
The fix is a statistical approximation. Have AI gather a wider candidate pool, sort it by the criterion you actually care about, and shortlist the top portion. Build a list of a hundred suppliers from a search, sort by ascending price, take the first ten — and those ten are a reasonable stand-in for “the ten cheapest.” The wider the pool, the closer you get to the real-world data. The shortlist is the top slice of the sorted list, and it is what the loop runs against. The shortlist is different from the cap: the cap sets how many items AI pulls into the candidate pool in the first place; the shortlist sets how many of the sorted items survive into the loop. The two are independent — a cap of one hundred with a shortlist of ten, a cap of one thousand with a shortlist of fifty, or a cap with no shortlist at all are all valid combinations.
Find at least 100 suppliers of corrugated cardboard on the web. Sort the list byprice per unit, ascending. For each of the first 10 pull contact information,minimum order quantity, lead time, and shipping locations. Display a combinedcomparison table.Skip the shortlist when you want the loop to run against every item the first two controls produced; the shortlist is a budget tool, not a default.
One last note about list shape. Any filtering you have in mind belongs in the first step’s prompt, not in a separate pass afterward. Say you need a list of ten plumbers in your area with independent reviews on Google. “Find ten plumbers, then filter for ones with reviews” may leave you with one — the filter discards items you already counted toward the ten. “Find ten plumbers in my area with independent reviews on Google” returns ten that already qualify. Removing duplicates and junk follows the same principle: any rule about what belongs in the list — uniqueness, presence of an attribute, exclusion of obvious mismatches — belongs in the criteria that build the list, not in a cleanup step that runs afterward.
Caution: on large efforts — very long lists, complex per-element processing, or both — even a well-shaped Iterate prompt can outgrow a single session. The running context bumps against the model’s window, or quality degrades long before the window fills as older parts of the session lose AI’s attention. When this becomes a real risk, do not run the loop as one prompt. Use the Playbook pattern below: it separates the construction of the list from the loop that processes it, and runs the loop across many short sessions rather than a single long one.
Plan mode is when you want AI to describe how it would do something at a higher level, without doing any of it and without listing specific edits yet.
If we were going to rebuild the booking engine, what would the steps be?Outline the work to add a waitlist feature, but do not write any code or create anyfiles.Before we touch anything, walk me through the approach you would take to migratethe data model to support multi-location shops.Plan mode is the relief valve when the work is too large to act on without first laying it out — particularly for Command-mode work, but useful for any sequence of moves you need to think through before starting. The steps in a plan can be of any kind covered above: research a topic before deciding, analyze an existing file, suggest options when the path branches, critique a proposal, or commit a change. You ask for the plan, review it, adjust it, and then — separately — move into execution.
The distinction from Command mode with preview is important. A Command-mode preview lists specific changes to specific files. A Plan describes the approach: the sequence of steps, the decisions that need to be made, the tradeoffs, the order of operations. A plan is about the shape of the work. A preview is about exactly what AI is about to change. Use a plan when you are not yet sure how the work should be structured. Use a preview when the structure is settled and you only want to confirm AI understood the concrete instructions.
Many AI agents have a built-in plan mode that prevents AI from making any changes while the mode is active. If yours does, use it for any task that is bigger than a quick fix. If yours does not, you can simulate it by being explicit:
Do not make any changes yet. Do not list specific file edits yet. Describe theapproach you would take, the steps in order, and any decisions that need to be madebefore we can proceed. Wait for my confirmation.Playbook
Section titled “Playbook”Playbook mode is when you ask AI to write the entire job down before any of it gets done — not as a high-level approach, but as a detailed, step-by-step file that can be executed later, one step at a time, possibly across multiple sessions.
Lay out every step to migrate the booking schema to multi-location. Write thesteps to playbook.md as a numbered checklist. Do not execute anything yet - eachstep should contain enough context that someone in a fresh session could run it onits own.Draft the entire master services agreement as a sequence of clauses in playbook.md,each numbered, each with the obligation it encodes. We will fill in the finallanguage one clause at a time.Document the full setup procedure for the cohort study as a numbered playbook inplaybook.md. Each step should be self-contained - what to do, which files or datait touches, how to verify it is done. Do not run anything yet.The output is a file. The file is the playbook. Subsequent sessions reference the file, execute one step (or a small group of steps) at a time, and update the file as the work progresses.
Structurally, Playbook is Iterate with the list and the loop pulled apart. An Iterate prompt builds the list and runs the loop in one conversation; a Playbook splits the two — the list lives in the file, one step per row, and the loop runs across many short sessions, one step at a time. The split is what makes the pattern usable where an Iterate prompt falls apart.
Playbook mode addresses the problem laid out in Chapter 3: a long session costs more, drifts further, and carries off-topic baggage forward. A Playbook breaks free of the session. The plan is written when the context is fresh and focused. Execution then runs in short, clean sessions, each one anchored to a small slice of the playbook.
The distinction from Plan mode is the level of detail. Plan mode produces an approach — sequence of steps, decisions to make, tradeoffs to weigh. Playbook mode produces an executable artifact: each step is specific enough that AI in a different session, with no memory of the planning conversation, can execute it without needing to reconstruct your intent. That extra specificity is what makes the playbook portable across sessions.
A few practical notes. The playbook drives the work. When you ask AI to write it, instruct it to mark each step open. The marker flips to done as the work proceeds. To execute, use a prompt like this against the file:
In playbook.md, find the first step marked open. Execute that step. When it iscomplete, mark it done in the file, append any decisions or surprises that came up,and stop.Then close the session. To advance, open a fresh session and run the same prompt — it picks up wherever the last session left off. One step per session, no manual tracking required. When every step is done, the playbook has served its purpose — archive it or delete it.
Intent Over Instruction
Section titled “Intent Over Instruction”Underneath every mode in this chapter is a deeper choice — simple to describe, harder to practice: explain your intent.
Tell AI what you are trying to achieve and why. Describe the environment it is working in. State the constraints the result must satisfy — the non-negotiable ones, not your preferences. Set guardrails on what AI may and may not do along the way (covered in the next section, Guardrails). Then let AI reason about how.
Compare two prompts. The first is instruction-heavy:
Create a new field on the booking entity called cancellation_reason. Make it astring of up to 200 characters. Allow null. Add it in alphabetical position.Update the schema file. Update the migrations folder. Update the tests.This is a program in English. If AI executes it wrong, you will blame AI. If AI executes it right, you have paid reasoning-engine rates to run a script.
The second is intent-heavy: > When a booking is canceled, we want to capture why, so we can spot patterns - repeat cancellations from the same household, seasonal trends, complaints about specific service providers. Add whatever is needed to the data model to support that, and keep the change consistent with the rest of the project.
This prompt carries less detail but more meaning. AI can now reason about the problem. It may propose a single text field. It may propose a small set of categories plus an optional note. It may ask a clarifying question — “Should this be required when a booking is canceled, or optional?” — because the intent is visible enough to identify the real question.
Agentic AI’s strength is autonomy — it can run for a long time, making decisions along the way. Most decisions are small. A few are judgment calls, where the next move is not mechanically dictated by what came before. To run continuously, AI has to make those calls without checking with you each time. That means delegating judgment to AI. But judgment cannot be programmed. It is the result of reasoning, and reasoning needs intent to work from. Give AI your intent, and its judgment calls have a strong chance of matching yours. Give it a step-by-step plan with no intent, and every gap in the plan becomes a wrong call — and over a long run, wrong calls compound into wasted time and money.
This is the shift the rest of the book leans on. The chapters ahead build a rule system, a project memory, a glossary, a separation of source files from generated artifacts, and an audit trail — none of these is a detailed instruction about what AI should do next. They are context. They set up the environment and the intent and let AI fill in the procedure. That is where AI is useful. That is where paying for a reasoning model makes sense.
One practical consequence: the model you use matters. If AI is doing the thinking, the quality of its reasoning sets the ceiling. This is why I use — and recommend you use — the best reasoning model available at any given time. A weaker model given an intent-heavy prompt will miss the intent, pick a plausible but wrong interpretation, and produce confidently flawed work. A stronger reasoning model given the same prompt asks the right clarifying question, or converges on something you can recognize as correct.
Instructions still matter sometimes. Two cases come up. The first is when step-by-step instructions — “do A, then B, then C” — are simpler and more natural to express than intent with guardrails. The second is when the process itself is what matters — when the value depends on AI following a specific sequence, not just on reaching the end state. Outside these two cases, the trap is reaching for instructions because you do not trust AI — and the fix is to drive AI by intent, not steps.
Intent over instruction is not a magic trick. AI has failure modes that intent does not eliminate — the book works through them when it turns to validation. But intent changes the shape of the failures. An instruction-heavy prompt fails when the instructions do not match what you meant, and you may not catch it for a long time. An intent-heavy prompt fails more visibly because the failure is in interpretation, not execution — AI misreads what you want, and the misreading shows up in the approach it proposes or the question it asks. Misinterpretation surfaces earlier, costs less to fix, and teaches you something about your own thinking.
Intent sets the direction. Guardrails come next.
Guardrails
Section titled “Guardrails”Intent points AI in a direction. Guardrails fence the road. Give AI intent without limits, and it will roam — touching files you did not mean for it to touch, picking tools you did not mean for it to use, making decisions you would have wanted to weigh in on. AI does not know your unwritten limits. If you do not state them, they do not exist.
A useful guardrail is anything that turns an implicit “do not go there” into an explicit one. The categories that come up most often are scope, decisions, tools and approaches, budget, and irreversibility.
Scope is which files, folders, or systems AI is allowed to modify:
Touch only files under models/Do not edit anything outside the current feature folder.Decisions are which calls AI can make alone and which need your approval:
Choose freely between a text field and an enumStop and ask before changing any public API.Tools and approaches are what AI is not allowed to reach for:
Do not add new dependenciesDo not introduce a database migration in this request.Budget caps how long AI may run, how many attempts before stopping, how much money it may spend:
Cap at three failed attemptsStop after thirty minutes of work.Irreversibility covers actions whose effects cannot be undone:
Never delete files without confirmationNever modify any data on the backup driveNever send the email - show me the draft.In a prompt, guardrails appear as a short list of “do not” or “stop and ask” conditions, attached to the intent. The intent-heavy prompt from earlier in this chapter could carry guardrails like this:
When a booking is canceled, we want to capture why, so we can spot patterns -repeat cancellations from the same household, seasonal trends, complaints aboutspecific service providers. Add whatever is needed to the data model to supportthat, and keep the change consistent with the rest of the project. Touch onlyfiles under models/ and migrations/. Do not add new dependencies. If the changeaffects the public API, stop and ask before proceeding.The intent part is the same as before. The three guardrail lines fence the work. AI now has direction and limits at the same time.
Some guardrails belong in one prompt; others belong in every prompt. A one-time “do not touch the deployment config for this request” is request-scoped — it lives in the prompt and disappears when the request ends. A permanent “Never delete files without confirmation” is project-scoped — it belongs in the rules file as a durable rule, covered in the next chapter. The test for which is which: if you would say the same thing on every relevant request, the guardrail belongs in the rules; if it is true only of the current task, it belongs in the prompt.
State the limits, and let AI work inside them.
Triggers
Section titled “Triggers”The Guardrails section above covered the rules that fence — rules that say “do not” or “stop and ask.” A second kind of rule sits alongside them: rules that spawn activity. Where a guardrail restricts what AI may do, a trigger names a condition and the behavior that should follow. When this happens, do that. These rules are called triggers because each one has a condition that fires the behavior.
A handful of examples will make the shape concrete:
When you finish drafting the section, save the result to drafts/section-3.md; donot display it in the chat.If a search returns more than thirty results, narrow the criteria and repeat thesearch.Whenever you encounter a glossary term you have not seen, stop and ask me what itmeans before continuing.When you propose adding a new field to the data model, also list every file thechange will affect.Each of these has the same shape: a condition (a finished draft, a result count, an unknown term, a proposed change) and a behavior that fires when the condition is met. Triggers are useful precisely when you want AI to act on its own initiative — usually as side effects of a main action.
A trigger in a prompt is sometimes intended to fire only while AI works on that particular prompt, and sometimes intended to apply to all subsequent activity in the session. The scope is not always obvious to AI. A scope misinterpretation is invisible until you notice the consequence, often several turns later.
The fix is simple: whenever you plan to run more than one prompt in the same session, state the scope explicitly. Two phrasings carry the work cleanly:
While doing the above, save every intermediate draft to a file instead of pastingit.For everything in this session going forward, save every intermediate draft to afile instead of pasting it.The first scopes the rule to the current prompt; the second scopes it to the rest of the session. State the choice deliberately — an unscoped trigger is unpredictable.
Even with the scope stated, session-scoped triggers are fragile. AI does not police your prompts; the further into the session you get, the more likely a session-scoped rule slips out of use. The honest pattern for a rule that has to survive a session is to restate it at the top of every prompt where it matters, or — once you find yourself doing that — to graduate the rule out of the prompt entirely and into the project. Rules that live in the project and apply on every turn without restatement are called durable rules, and they are the subject of the next chapter.
The Language of Rules
Section titled “The Language of Rules”The Guardrails and Triggers sections above introduced two kinds of rules you can put inside a prompt. This section establishes the language for writing them well — a small set of conventions that apply to either kind, and to durable rules as well.
Rules are written in plain English — or whatever natural language you prefer. There are countless ways to phrase any given instruction, and that freedom is both a strength and a trap. The language must be precise. It must leave no room for interpretation. Every gap you leave is a gap AI will eventually walk through. AI has no intent of its own — it does not act out of malice — but it does not pause on ambiguity either. When a rule does not say what to do, AI decides for you. The decision will not always be the one you wanted.
Writing rules for AI is closer to drafting a legal contract than to everyday writing. You are constructing a document in natural language that must account for every significant case. A good lawyer assumes the other party will find every loophole. Assume the same about AI — not because AI is adversarial, but because it will find gaps you did not anticipate.
A few conventions help. They come from technical writing — a discipline that has been working out, over decades, how to write instructions that do not get misinterpreted. Three habits are worth borrowing.
First, use uppercase priority markers — MUST for required behavior, SHOULD for recommended, MAY for optional. The capitalization is not for emphasis. It is a signal that the word is acting as a rule keyword, not an everyday English verb. A lowercase “must” is the same word and reads the same, but it does not carry the same weight for AI — and AI is more likely to miss the word when interpreting a string of instructions.
Second, drop the subject when you can. Save the result to drafts/section-3.md reads better than You must save the result to drafts/section-3.md, and the subject is unambiguous either way — the command is clearly addressed to AI. Use “AI” only when the rule mentions both AI and the user in the same sentence and the verbs would otherwise be ambiguous.
Third, when a rule forbids something, pair the prohibition with the alternative. Do not paste the result into the chat is half a rule; do not paste the result into the chat — save it to a file and let me know once done is the whole rule. AI does not need to invent a fallback when you give it one.
The conventions are light — most carefully written prompts already follow them. The point is to follow them deliberately, not by accident.
Challenge
Section titled “Challenge”You have seen how to drive a Playbook one step at a time by hand: a fresh session per step, the same prompt each time, the file flipping its open markers to done as the work proceeds. The pattern is reliable. It is also tedious when the playbook runs to a thousand steps.
There is a faster way this book does not unpack: sub-agents. Agentic AI that supports sub-agents can run the playbook to completion by spawning a fresh sub-agent for each step, each with its own clean context, and surfacing only the summaries. Without going into the details, here is the shape of the prompt when using sub-agents:
Run playbook.md to completion by sequentially spawning a sub-agent for each step.Each sub-agent's task: in playbook.md, find the first step marked open, executeit, mark it done, append any decisions or surprises, return a one-line summary.Keep spawning sub-agents until no open steps remain. Surface only the summaries.Look up how sub-agents are invoked in your AI. The challenge is to make the prompt above actually work for your agent and your playbook. Different agents use different sub-agent conventions; you will likely need to adjust the wording, swap a few terms, and tune the summary format until the loop runs end to end. Once it does, ask yourself: what other kinds of work, beyond playbook execution, would compose well as a chain of sub-agents?
One more twist. Most AI agents that support sub-agents also support running them concurrently — many sub-agents in flight at once instead of one at a time. Apply that to the playbook pattern. Does it still fit? Walk through what happens if step 7 starts before step 6 has marked itself done. Then ask the inverse: what kinds of work compose well as many sub-agents running in parallel, and how does the prompt change?