Agent skill · data analytics · davila7
instructor
Extract structured data from LLM responses with Pydantic validation, retry failed extractions automatically, parse complex JSON with type safety, and stream partial results with Instructor - battle-tested structured output library
Why this skill is useful
Adds a structured output library with Pydantic validation and automatic error handling for LLM responses, enabling reliable data extraction and type safety.
What it needs
Requires anthropic, instructor, openai, pydantic installed locally. About 7k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.
What this skill does
Instructor: Structured LLM Outputs When to Use This Skill Use Instructor when you need to: Extract structured data from LLM responses reliably Validate outputs against Pydantic schemas automatically Retry failed extractions with automatic error handling Parse complex JSON with type safety and validation Stream partial results for real-time processing Support multiple LLM providers with consistent API GitHub Stars: 15,000+ Battle-tested: 100,000+ developers Installation Quick Start Basic Example: Extract User Data With OpenAI Core Concepts 1. Response Models (Pydantic) Response models define the structure and validation rules for LLM outputs. Basic Model Benefits: Type safety with Python type hints Automatic validation (wordcount > 0) Self-documenting with Field descriptions IDE autocomplete support Nested Models Optional Fields Enums for Constraints 2. Validation Pydantic validates LLM outputs automatically. If validation fails, Instructor retries. Built-in Validators Custom Validators Model-Level Validation 3. Automatic Retrying Instructor retries automatically when validation fails, providing error feedback to the LLM. How it works: 1. LLM generates output 2. Pydantic validates 3. If invalid: Error message sent back to LLM 4. LLM tries again with error feedback 5. Repeats up to maxretries 4. Streaming Stream partial results for real-time processing. Streaming Partial Objects Streaming Iterables Provider Configuration Anthropic Claude OpenAI Local Models (Ollama) Common Patterns Pattern 1: Data Extraction from Text Pattern 2: Classification Pattern 3: Multi-Entity Extraction Pattern 4: Structured Analysis Pattern 5: Batch Processing Advanced Features Union Types Dynamic Models Custom Modes Context Management Error Handling Handling Validation Errors Custom Error Messages Best Practices 1. Clear Field Descriptions 2. Use Appropriate Validation 3. Provide Examples in Prompts 4. Use Enums for Fixed Categories 5. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills davila7/prompt-engineering-instructor