Index of every page on this site: llms.txt
All skills
davila7 avatar

/prompt-engineering-instructor

@c1bc5c1
Run it yourself

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

Use this Skill: https://skilld.dev/gh/davila7/claude-code-templates/prompt-engineering-instructor

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesproviders.md

≈333 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Provider Configuration

Guide to using Instructor with different LLM providers.

Anthropic Claude

import instructor
from anthropic import Anthropic

# Basic setup
client = instructor.from_anthropic(Anthropic())

# With API key
client = instructor.from_anthropic(
    Anthropic(api_key="your-api-key")
)

# Recommended mode
client = instructor.from_anthropic(
    Anthropic(),
    mode=instructor.Mode.ANTHROPIC_TOOLS
)

# Usage
result = client.messages.create(
    model="claude-sonnet-4-5-20250929",
    max_tokens=1024,
    messages=[{"role": "user", "content": "..."}],
    response_model=YourModel
)

OpenAI

from openai import OpenAI

client = instructor.from_openai(OpenAI())

result = client.chat.completions.create(
    model="gpt-4o-mini",
    response_model=YourModel,
    messages=[{"role": "user", "content": "..."}]
)

Local Models (Ollama)

client = instructor.from_openai(
    OpenAI(
        base_url="http://localhost:11434/v1",
        api_key="ollama"
    ),
    mode=instructor.Mode.JSON
)

result = client.chat.completions.create(
    model="llama3.1",
    response_model=YourModel,
    messages=[...]
)

Modes

  • Mode.ANTHROPIC_TOOLS: Recommended for Claude
  • Mode.TOOLS: OpenAI function calling
  • Mode.JSON: Fallback for unsupported providers

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts5d3 checks · Risk SAFE
  • Gen Agent Trust Hub5d

    This skill is a comprehensive educational resource for using the 'Instructor' library to handle structured LLM outputs with Pydantic validation. It covers multiple providers, streaming, and advanced validation patterns. No malicious behavior or security vulnerabilities were detected.

  • Socket5d

    No alerts

  • Snyk5d

    Risk: LOW · No issues

Signed by skilld at c1bc5c1. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
Other metadata
metadata
{
  "version": "1.0.0",
  "author": "Orchestra Research",
  "tags": [
    "Prompt Engineering",
    "Instructor",
    "Structured Output",
    "Pydantic",
    "Data Extraction",
    "JSON Parsing",
    "Type Safety",
    "Validation",
    "Streaming",
    "OpenAI",
    "Anthropic"
  ],
  "dependencies": [
    "instructor",
    "pydantic",
    "openai",
    "anthropic"
  ]
}

README badge

README badge for davila7/claude-code-templates/prompt-engineering-instructor