instructor

Extract structured data from LLM responses with Pydantic validation and automatic retries.

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/tadod12/fraud-detection-research --skill instructor-tadod12
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/tadod12/fraud-detection-research/tree/main/.agent/skills/16-prompt-engineering/instructor
Command: npx skills add https://github.com/tadod12/fraud-detection-research --skill instructor-tadod12

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires instructor, pydantic, openai, anthropic, and includes references (resource) components.

What problem does it solve?

Extract structured data from LLM responses using Pydantic validation, with automatic retries on invalid outputs and streaming support for real-time processing.

Core Features & Use Cases

  • Pydantic-based validation of LLM outputs to enforce strict data contracts.
  • Automatic retries on validation failures with actionable guidance to the LLM.
  • Streaming results for real-time downstream processing and UI updates.
  • Multi-provider support (OpenAI, Anthropic) with consistent schemas and error handling.

Quick Start

Prompt the skill to extract a User object from a sample response and validate all fields with Pydantic during processing.

Frequently Asked Questions about instructor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract structured data from LLM responses?

You can extract structured data from LLM responses by using Pydantic validation schemas to enforce strict data contracts, ensuring the model output matches your required fields and types automatically.

How do I validate JSON output from OpenAI and Anthropic models?

You can validate JSON output from OpenAI and Anthropic models by applying Pydantic-driven validation rules, which automatically trigger retries with actionable guidance when the LLM produces invalid or malformed data.

Can I stream partial structured results from LLMs in real time?

Yes, you can stream partial structured results from LLMs in real time. This approach supports immediate downstream processing and UI updates as the model generates data progressively.

What is the best way to handle validation failures when parsing LLM JSON?

The best way to handle validation failures when parsing LLM JSON is to implement automatic retries that send actionable error guidance back to the model, prompting it to correct the invalid output.

Do I need Pydantic to parse structured LLM outputs?

Yes, Pydantic is required to parse structured LLM outputs in this workflow. It provides the schema definitions and validation logic needed to enforce strict data contracts on multi-provider responses.

Why does my LLM output fail JSON parsing across different providers?

LLM output fails JSON parsing across different providers when responses lack strict schema adherence. Using Pydantic validation with automatic retries resolves this by enforcing consistent data contracts.