Pre-launch · Training and the free Foundations exam are open now. Levels 1–5 open soon. Get notified on any level page.
20 min read
When a prompt's output feeds a spreadsheet, a ticketing system, or another prompt, it stops being a draft and becomes data. Data needs a schema, a way to check it, and a plan for what happens when the check fails. This module covers how to define that contract, how to turn a working prompt into a reusable template, and how to manage it like any other piece of shared infrastructure.
A schema is a contract. It names each field, its type (string, number, date, boolean), whether it's required, and what null means. Null should mean "the source doesn't say," and nothing else. If the model fills a null field with a plausible value, the output is well formed and wrong.
Validation is code, not a request. Asking the model "make sure the JSON is valid" doesn't validate anything. Parse the output with a schema validator or a short script. Then check the business rules separately: dates in the future, amounts nonnegative, IDs that exist. Format validity, business validity, and factual accuracy are three different checks.
Plan the failure path. Decide in advance what happens when validation fails. A common pattern: retry once with the validation error included in the prompt, and if it fails again, route the item to a human queue with the error attached. Never let a failed record pass through with defaults filled in.
Templates separate the fixed from the variable. A template keeps instructions, schema, and examples constant and marks the parts that change, such as {{meeting_notes}} or {{team_name}}. That makes outputs consistent across runs and makes changes deliberate.
Document the contract. Each shared template should state its owner, purpose, input format, output schema, failure path, test set, model and settings used, and known limits.
Tokens are what you pay for. A token is a chunk of text the model processes. It isn't a word: a common word may be one token, and a long or unusual word may be several. Usage is usually counted and billed in tokens, and context limits are measured in them. A 2,000-token template run 5,000 times a month carries that cost every time, so trim text that doesn't change the output. Don't trim the examples or rules that keep it correct.
Version it. Store templates in version control, like code. Each change gets a version number, a reason, and a test-set result. When version 1.4 breaks something, you roll back to 1.3 and know exactly what you're running.
Sam Adeyemi runs project operations at a 120-person architecture firm. After each client meeting, someone pastes notes into a chat tool to pull out action items, which then get typed into the project tracker by hand. Owners and due dates frequently appear in the tracker that nobody agreed to.
Before:
Pull out all the action items from these meeting notes and assign
each one an owner and a due date. Format it as JSON.
"Assign" instructs the model to invent owners and dates. There's no schema, so field names change between runs. Nothing checks the output before it reaches the tracker.
After:
Template: action-items-extract v2.1 (owner: S. Adeyemi)
Extract action items stated in {{meeting_notes}}.
Return a JSON array. Each item:
{
"action": string, required, as stated in the notes,
"owner": string or null (null unless a person is explicitly
named as responsible),
"due_date": "YYYY-MM-DD" or null (null unless a date is
explicitly stated),
"source_quote": string, required, the exact sentence the item
comes from
}
Do not infer owners from who spoke or dates from phrases like
"soon" or "next sprint". If there are no action items, return [].
Outside the prompt, a 30-line script validates every response against the schema and checks that each source_quote appears verbatim in the notes. On failure it retries once with the error message. On a second failure, the notes go to Sam's review queue. Items with a null owner or date land in the tracker flagged "needs assignment."
Why this is stronger. The schema makes null a legitimate answer instead of a gap to fill. The source quote ties each action to the notes, and the script checks it mechanically. The failure path keeps bad records out of the tracker. The template has a name, an owner, and a version, so when Sam changes it he can test v2.2 against the same 25 saved meeting notes and roll back if needed.
Setup. Take three sets of synthetic or redacted meeting notes or email threads that include tasks, with some tasks that have no clear owner or date. Do not use real names, addresses or other personal data.
Task. Write a schema with four fields, including a source quote, and null rules for owner and date. Run your prompt on all three inputs. Validate the format with those synthetic or redacted inputs, or with an approved local validator. Do not paste realistic meeting or email content into an online validator: formatting validation must not introduce a data-disclosure problem. Then check each source_quote against the original text by searching for it.
What a good result looks like. Every output parses. Every item with no stated owner or date shows null rather than a name or date. Every source quote is found verbatim. You've written down, in one sentence, what happens to an output that fails.