Prompting & Structured Output
Prompts as API contracts: system prompt design, few-shot patterns, JSON schema outputs, tool definitions, and treating model output as untrusted input.
- 01·The System Prompt Is an API ContractThe system prompt is your service's interface definition. Structure it like config, separate instructions from data, and set precedence rules.9 min
- 02·Examples Are Fixtures You Ship on Every RequestFew-shot examples are test fixtures you ship on every request. When examples beat instructions, how to pick them, and what they cost in tokens.8 min
- 03·Prompts Are Config That Can Take Down ProdPrompts are hot-path config written in English. Version them in git, deploy them like code, log the version on every call, and roll back in one step.9 min
- 04·Three Ways to Get JSON Out of a ModelJSON mode, structured outputs, and the forced tool call solve different problems. What each guarantees, what it doesn't, and which one to reach for.8 min
- 05·Schemas the Model Can Fill, Tools the Model Can CallEnums over free strings, flat over nested, descriptions as docs. Design schemas a model can fill, then define your first tool the same way.9 min
- 06·Model Output Is Untrusted InputSchema-valid is not correct. Validate model output like user input with Zod, repair failures once, then compose it all into a typed LLM function.9 min