Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Llm Structured Outputs?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ansh44233-llm-structured-outputs)
---
description: Get reliable structured data from LLMs with JSON schemas, provider structured-output modes, validation and repair
profile: standard
tags: ai, llm, json, validation
---
# LLM structured outputs
Never parse free text with regex when the provider can return schema-valid JSON.
## Generation
- Use the provider's structured-output or tool-calling mode with a JSON Schema (or zod/pydantic-derived schema).
- Keep schemas small and flat; describe each field; use enums for closed sets.
## Validation
- Validate every response against the schema in code; treat it as untrusted input.
- On failure, retry once with the validation error, then fail loudly; log failures for evals.
## Safety
- Never execute, render as HTML or use in SQL/shell any model output without validation and escaping.
## Verify
A test feeds known inputs (with a mocked or recorded model response, plus one malformed response) and asserts parsed objects or a clean failure.