instructor

Extract LLM outputs into validated Pydantic models with automatic retries.

2|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-config --skill instructor-clay-hhk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/Clay-HHK/claude-config/tree/main/skills/AI-research-SKILLs/16-prompt-engineering/instructor
Command: npx skills add https://github.com/Clay-HHK/claude-config --skill instructor-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill converts freeform LLM responses into validated, type-safe Python objects so downstream systems don't break on malformed or inconsistent outputs. It reduces manual post-processing and debugging by enforcing schemas, providing clear validation feedback, and automatically retrying extractions until they conform.

Core Features & Use Cases

  • Pydantic-backed Response Models: Define precise field types, nested models, enums, and constraints to guarantee structure and type safety.
  • Automatic Validation & Retries: If validation fails, the Skill returns error feedback to the model and retries extraction up to configurable limits.
  • Streaming & Partial Results: Stream partial objects or iterable items for real-time UI updates or incremental processing.
  • Multi-provider Support: Works with Anthropic, OpenAI, and local endpoints with modes for JSON or provider-specific structured outputs.
  • Common Uses: entity extraction, classification with confidence scores, batch processing of documents, and robust analysis pipelines that require strict schemas.

Quick Start

Extract a validated User object from the text John Doe is 30 years old, email [email protected] using a Pydantic response model with automatic retries.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I get structured LLM outputs that pass Pydantic validation?

To get structured LLM outputs that pass Pydantic validation, this Skill extracts freeform LLM responses into validated Python models and automatically retries extraction upon validation failures until schemas conform.

Does structured data extraction work with Anthropic and OpenAI providers?

Structured data extraction works with Anthropic, OpenAI, and local endpoints, supporting both JSON mode and provider-specific structured output modes for validated Pydantic models.

How do I stream partial objects during LLM data extraction?

To stream partial objects during LLM data extraction, this Skill supports streaming partial results and iterable items for real-time UI updates or incremental processing of your Pydantic response models.

What's the best way to parse multiple entities from LLM outputs in Python?

The best way to parse multiple entities from LLM outputs in Python is using Pydantic-backed response models with batch processing to enforce strict schemas and ensure type-safe multi-entity parsing.

Why does my LLM output fail schema validation during classification?

LLM outputs fail schema validation during classification due to malformed or inconsistent responses, but this Skill returns error feedback to the model and automatically retries extraction up to configurable limits.