llm-output-schema-generatorlisted
Install: claude install-skill imtiazrayhan/agentscamp-library
The reliable way to get data (not prose) from an LLM is to give it a schema and validate against it. This skill builds that schema from a concrete example of what you want back, then wires it into a structured-output call — so the model returns typed, validated objects and your code stops parsing free-form JSON by hand.
This is distinct from generating **test fixtures** (that's a mock-data factory) and from documenting an **existing API** (that's an OpenAPI doc writer): here the output *is the schema the LLM must conform to*.
## When to use this skill
- Adding typed/structured output to an LLM feature (extraction, classification, form-filling).
- Replacing fragile `JSON.parse` + try/catch around model output with a validated schema.
- Designing the exact shape for an extraction or tool-output contract.
## Instructions
1. **Start from a real example.** Take a representative sample of the desired output (or a few). Infer fields and types from the data, not from a guess — and gather a couple of edge-case examples so optionality and unions are right.
2. **Type precisely.** Choose specific types (int vs. float, date vs. string), mark genuinely optional fields optional and required fields required, and use **enums** for closed sets rather than free strings.
3. **Add model-facing descriptions.** Field descriptions are prompt surface in structured-output libraries — say what each field means, with units and formats ("ISO 8601", "USD cents"). This improves the model's accuracy, n