Prompt Patterns

Output Template

Declares the response structure in advance to produce predictable, reusable outputs.

Also known asOutput SchemaStructured OutputResponse TemplateOutput Formatting Constraint
Output Template pattern diagram

Problem

Free-form answers vary in section order and granularity, making cross-run comparison and downstream use difficult.

Solution

Predeclare sections/fields/slots and have the model fill them. Converting open generation into structured completion yields predictable, reusable artifacts.

Example

One worked example. The book has 2–4 per technique.

Prompt
Evaluate the deployment readiness of the payments service for the Friday production release.

Return your assessment in the following format:

Status: READY / NOT READY / READY WITH CONDITIONS
Test Coverage:
Open Defects:
Infrastructure:
Rollback Preparedness:
Recommendation:
Response
Status: READY WITH CONDITIONS

Test Coverage: Unit tests at 87%, integration tests cover main transaction flows. Coverage is sufficient for release.

Open Defects: Two open: one medium-severity (timeout handling under high concurrency), one low-severity (receipt formatting). Neither is blocking, but the timeout issue should be monitored post-deployment.

Infrastructure: Production environment provisioned. Load testing passed at 2x expected peak traffic.

Rollback Preparedness: Procedure documented but not tested end-to-end. No rollback drill has been run.

Recommendation: Proceed with deployment. Require a rollback drill before the next release, and set up alerting for the timeout defect in the first 48 hours post-deployment.

Techniques

Concrete ways to implement Output Template. Each technique fits a different situation.

  • 01

    Section Template

    Define named sections that organize the response into conceptual regions, each filled with narrative content of appropriate length.

  • 02

    Field Template

    Define named fields expecting short atomic values (labels, numbers, one-sentence judgments) so the output reads as a record rather than a report.

  • 03

    Slot Filling

    Provide a pre-written artifact with explicit placeholders that the model replaces with appropriate values, preserving surrounding text exactly.

Prompt Patterns book cover

Full treatment in the book

Output Template — the complete chapter

  • Mechanism — why this pattern works
  • 2–4 worked examples per technique
  • Placement, sequencing, and debugging rules
  • Composition with related patterns