Guaranteeing the steps that matter
Telling Claude to do something is a request, not a guarantee. For most steps that is fine. For the ones that move money, delete something or go out to a customer, the gap between usually and always is the whole problem. This is how you close it, and how to decide which steps are worth closing. The wider set of decisions this sits inside is Prompt engineering with Claude.
Telling Claude to do something is a request, not a guarantee. It will usually follow a clear instruction, but usually is not always, so for some steps that gap matters. The way to make a step certain is not a firmer sentence in the prompt, it is to enforce it in the code around Claude: a check that simply will not let the next step run until the one before it has genuinely finished. A prompt asks; code guarantees.
Underneath that sits a bigger question. It has a page of its own. Some of what a system does needs judgement and the rest of it has a right answer. Those two want different machinery at wildly different prices: one is paid for in tokens and time on every run, the other is written once and then costs nothing. Telling them apart, case by case, is When to use AI and when not to.
You do not do this for everything, because a gate is effort and rigidity you do not always need. You spend it where the cost of getting it wrong is real. A slightly clumsy summary is cheap to fix, so a prompt instruction is fine. Moving money, deleting something, sending a message to a customer, these are expensive or hard to undo, so a small failure rate is no longer acceptable and the step is enforced rather than trusted. The stakes decide the mechanism.
When you do gate a step, gate it on what actually happened, not on what the model says happened. The model might believe it checked the customer’s identity, or have called the check and got an error back. The gate ignores the narrative and reads the one hard fact: did that step genuinely succeed? If not, the action it guards does not run. A result coming back is not the same as a result that worked.
And when a step cannot be handled and has to pass to a person, hand over the whole picture, not a shrug. Someone picking it up cannot see what came before, so a vague “over to you” makes them start from nothing or, worse, guess. A good handoff carries the facts, what caused it to stop and what you would suggest doing next, so the person spends their time deciding rather than reconstructing.
Say it another way
You do not padlock the salt cellar. If a cook over-salts once you remake one dish, so a quiet word is enough. But the till and the walk-in freezer are locked, with only a keyholder allowed in, because a mistake there, cash gone or stock spoiled, is expensive and hard to undo. You spend the lock only where the downside earns it. Enforcing a step in code rather than trusting the prompt is the same call: lock the things that would really hurt to get wrong.
Doing this with Claude Code
When a build has a step that must not go wrong, decide on purpose whether a prompt is enough or the step needs to be enforced.
Ask in the prompt for the cheap steps. Where a rare miss is easy to undo, a clear instruction is the right amount of effort. Do not gate everything.
Enforce the costly ones in code. For anything that moves money, deletes or goes out to someone, put a check around the action so the wrong order cannot physically happen, rather than trusting the model to remember.
Gate on the real result, not the claim. Have the guard read whether the step before genuinely succeeded, so an action never fires off the back of a step that errored or came back empty.
Hand off with the full picture. When something has to go to a person, pass the facts, the cause and your recommended next step, so they can act without piecing the story back together.
Notice what the asking costs. A rule you put in the prompt is charged every time it runs, where the same rule in code is paid for once. At any volume that gap stops being academic, so let it weigh on the choice rather than discovering it on a bill.
Back to Prompt engineering with Claude. The craft around it is Working with Claude.