instructor

Extracts structured data from LLM responses and validates it with Pydantic.

2|Updated Apr 25, 2026
One-click install
npx skills add https://github.com/AlexiosBluffMara/mercury --skill instructor-alexiosbluffmara
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: instructor
Source: https://github.com/AlexiosBluffMara/mercury/tree/main/optional-skills/mlops/instructor
Command: npx skills add https://github.com/AlexiosBluffMara/mercury --skill instructor-alexiosbluffmara

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Automates extraction of structured data from unstructured LLM outputs with automatic validation, reducing errors and manual post-processing.

Core Features & Use Cases

  • Robust validation with Pydantic schemas to ensure type-safe outputs.
  • Automatic retries on validation failures with actionable feedback to the LLM.
  • Streaming support for partial results and real-time processing across providers (OpenAI, Anthropic).

Quick Start

Send a sample LLM response and request a validated Pydantic model output.

Frequently Asked Questions about instructor

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

FAQPage Schema
How do I validate structured LLM outputs with Pydantic?

You can validate structured LLM outputs by defining a Pydantic schema and using this skill to automatically extract, type-check, and enforce that structure on LLM responses. It retries with actionable feedback upon validation failures.

How do I stream partial LLM results while ensuring type safety?

Streaming partial LLM results with type safety is supported across providers like OpenAI and Anthropic. This skill processes partial Pydantic models in real-time, enabling developers to consume progressive data streams during generation.

Can I use this structured output validation with both OpenAI and Anthropic providers?

Yes, structured output validation works with both OpenAI and Anthropic providers. The skill supports multiple LLM providers, allowing you to build reliable data-extraction pipelines and validation layers across different model environments.

What's the best way to automatically retry LLM responses that fail validation?

The best way to retry failed validations is to automatically send actionable error feedback back to the model. This skill handles that retry loop, prompting the LLM to correct its output until it successfully matches the Pydantic schema.

How do I extract structured data from unstructured LLM text responses?

Extracting structured data from unstructured LLM text requires parsing the response into a defined Pydantic schema. This skill automates that extraction, reducing manual post-processing and ensuring the resulting data is type-safe and validated.

Why do I need Pydantic schemas for LLM data extraction pipelines?

Pydantic schemas are needed for LLM data extraction pipelines to ensure type-safe outputs and deterministic error handling. By enforcing a strict schema, this skill minimizes errors and guarantees the extracted data conforms to expected formats.