Designing a Structured Output Schema for Legal Data
Designs a JSON schema for legal data extraction with explicit representation of uncertainty and missing values instead of silent defaults.
Prompt
Design a structured output schema for legal data extraction. Core rule: the schema must let the model say "unknown" without lying.
What is being extracted: [describe the entity] Source: [document type] What happens to the data: [display / computation / automated decision]
Produce a JSON Schema with:
- Fields — each with type, description, and an example. The description is written for the model, not the developer.
- Uncertainty representation — every substantive field takes one of two shapes: value + confidence, or null + reason. A missing value must never become an empty string or zero.
- Source anchoring — for each extracted value, a field pointing at the text it came from (clause number, quote, offset). Without this, verification is impossible.
- enum over free text — anywhere the answer comes from a closed set. Always include an "other" value with an accompanying text field.
- Dates and amounts — explicit formats (ISO 8601, currency and value as separate fields). Never a free-form string.
- Multi-value fields — always an array, even where a single value is expected. Contracts will surprise you.
- A global extraction_notes field — what was ambiguous, what conflicted, what required interpretation.
After the schema, state:
- three ways extraction can fail silently and how the schema catches each
- which fields must never feed an automated decision without human review
Why this converts well
- Ready to copy and use immediately
- Tailored for legal and public-sector work
- Easy to adapt to internal workflows
Tags
Related Prompts
Tool Specification for a Legal AI Agent
Produces a complete agent tool definition — schema, description, errors, permissions — with emphasis on tools that perform irreversible actions.
Regression Test Suite for a Production Prompt
Builds a test suite for a prompt before changing it, catching silent regressions introduced by an innocent-looking improvement or a model swap.
Data Model for a Legal System
Designs a database schema for legal entities with emphasis on versioning, audit trail, and tenant isolation — three things that are very hard to retrofit.