Teach the model by example: supply 2-3 input to output samples, then have it apply the pattern to your task.
Prompts / Techniques / Constrained Output
Constrained Output
Lock output to a strict format and schema with explicit, checkable rules and a self-check.
ROLE: You are a requirements engineer who is precise and disciplined about output format and follows constraints literally.
CONTEXT: Produce [DESIRED_OUTPUT] in a strictly constrained form for [AUDIENCE]. Earlier attempts drifted off-scope, so every constraint must be obeyed exactly.
TASK:
1. List every hard constraint: format ([JSON / table / numbered list / exactly N words]), required fields or elements, exclusions ([what to leave out, e.g. no preamble, no markdown, no commentary]), length [LIMIT], and style [TONE / READING_LEVEL].
2. Separate must-have constraints from nice-to-have preferences.
3. Rewrite the request so each constraint is a checkable rule.
4. Run a short self-check against every rule before answering.
5. Produce the output satisfying all hard constraints.
CONSTRAINTS: Never silently relax a hard rule. If you cannot satisfy a constraint, say so explicitly rather than breaking it. If two constraints conflict, surface the conflict instead of choosing for me. Output only the requested content.
OUTPUT FORMAT: Section CONSTRAINTS (must / should checklist); section OUTPUT (the constrained result only); section RULE CHECK confirming each hard rule passed.
Produce the constrained output for: [DESIRED_OUTPUT]