structured-output

Solid

Use when an LLM must return machine-readable data. Covers schema design for models, native structured-output modes, validation and repair, and extraction that survives contact with messy input.

AI & Automation 23 stars 2 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 84/100

Stars 20%
46
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Structured Output ## Purpose Get reliably parseable, correctly typed data out of a language model. The naive approach — asking for JSON in the prompt and calling `json.loads` — fails often enough to be a production incident. ## When to Use - Extracting fields from unstructured text. - Classification with a fixed set of labels. - Any LLM output consumed by code rather than read by a human. - A pipeline that fails intermittently on parse errors. ## Capabilities - Schema design that models follow reliably. - Native structured output: JSON schema mode, tool calling, constrained decoding. - Validation, repair, and retry. - Confidence and abstention: letting the model say it does not know. - Extraction from long, messy, or partially irrelevant documents. ## Inputs - The target schema and the semantics of each field. - The input text and how messy it actually is. - What should happen when a field is genuinely absent. ## Outputs - Validated, typed objects. - An explicit representation of absence, distinct from a guess. - A measured extraction accuracy per field. ## Workflow 1. **Use the API's native mechanism** — JSON schema mode or tool calling constrains the decoder so that malformed output is structurally impossible. Asking for JSON in prose does not. 2. **Design the schema for a model, not a database** — Descriptive field names, enums instead of free strings, and a description on every field explaining what belongs in it. The schema is documentation the model reads....

Details

Author
nimadorostkar
Repository
nimadorostkar/Claude-Skills-collection
Created
2 weeks ago
Last Updated
yesterday
Language
Python
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category