Gazar BreakpointEpisode 10July 8, 2026

Prompting Like an Engineer: The Prompt Is a Contract, Not a Spell

Most prompting advice reads like spellcasting: say the magic words and hope. That falls apart the moment an LLM sits in your request path. This session is the engineer's version: a prompt is a contract with a non-deterministic service, so you write it the way you write an API schema, and you verify the result in code. We start from what actually happens in production, a feature that was flawless in the demo and then quietly returned prose instead of JSON, and build the contract that stops it. Every prompt gets four parts: a role that names one job, fenced inputs so user data can't hijack your instructions, explicit constraints so the model stops improvising, and a required output schema you validate against your own code.

In this episode

  • Why "a prompt is a contract with a non-deterministic service" is the only mental model that scales
  • The four parts every production prompt needs: role, fenced inputs, constraints, output schema
  • Role as a function signature, not a personality ("extract ticket fields", not "be a helpful assistant")
  • Prompt injection, and why you fence the data instead of trusting it
  • Demand a schema, then verify it in code: the prompt persuades, the code enforces
  • The one decision that matters: what to hand the model versus what to keep deterministic

Transcript

CHAPTERS

0:00 Intro: who I am

0:11 How AI features really work

3:42 The prompt is a contract

5:21 It worked in the demo, then it lied quietly

8:31 A non-deterministic service

9:21 The four-part contract

11:48 Part 1: give it one clear job (role)

12:33 Part 2: fence off the data (prompt injection)

15:35 Part 3: kill the vagueness (constraints)

17:53 Part 4: demand a schema (output shape)

22:03 A wish versus a contract

25:09 The prompt versus your code

25:56 Write the one constraint line

26:51 Wrap up and the cohort

GO DEEPER

I run a hands-on Maven cohort, Production-Ready Systems with LLMs and Agents: An Intensive for Engineers. Build LLM and agent systems that survive real traffic, cost, and failure. Use code AGENTS300 for $300 off.

LINKS

Course and cohort: https://maven.com (search "Ehsan Gazar")

Site and writing: https://gazar.dev

Slides: https://hub.gazar.dev/prompting-like-an-engineer

Subscribe: @gazarbreakpoint