Skill
Instructor pydantic extractor
Wrap any local Ollama or cloud LLM in Instructor to extract Pydantic-schema-conformant JSON with context-aware reask on ValidationError — the model sees its own error and can correct it on the next try
Corrected on 2026-11-01: the unsourced '95%+ first-retry self-correction' figure was removed; the reask behaviour is described as in the primitive instructor-reask-loop.
Primitives inside (12)
cot-fields-before-answer-fieldsdisciplineOrder schema fields evidence -> reasoning -> answer: models fill schemas in token order, so a reasoning field placed before the answer forces deliberation before commitment.
When: Designing an extraction/classification schema where answer quality depends on reasoning (complex judgment, or a low-capability model).
extra-forbid-blocks-hallucinated-keysdisciplineSet ConfigDict(extra='forbid') on extraction schemas so hallucinated extra fields become validation errors instead of silently accepted junk.
When: Defining the Pydantic model that an LLM will fill.
from-provider-cache-paramcalibrationfrom_provider (1.15.4) exposes a `cache` parameter — a response-caching hook (signature: model, async_client=False, cache=None, mode=None, **kwargs) — available for dedup/cost control though undocumented in most recipes.
When: Repeated identical extractions where response caching could cut calls.
instructor-exception-surfacecalibrationinstructor 1.15.4's exception surface spans instructor.core.exceptions (ValidationError, ProviderError, ConfigurationError, ModeError, ResponseParsingError, InstructorError, ClientError) plus InstructorRetryException from v2 core on retry exhaustion — catch broadly at the pipeline boundary and return a telemetry dict, not a crash.
When: Wrapping instructor extraction inside a pipeline step that must degrade gracefully.
instructor-reask-looptool-sequenceContext-aware reask: on Pydantic ValidationError, Instructor appends the broken model response AND the literal validator error text to the message history and re-calls — the model sees its own mistake and self-corrects, unlike retry-from-zero.
When: Structured extraction where semantic validators (field_validator, cross-field constraints) must hold on the output.
inverted-regression-canarydisciplinePin a known UPSTREAM defect with an assertion that the bug still EXISTS ('if this ever stops failing, upstream fixed it -> update the doc') — the selftest then detects the upstream fix the day it lands instead of shipping stale workaround docs forever.
When: A skill/doc teaches a workaround for a third-party library defect that upstream may silently fix.
llm-validator-client-requiredgotcha-fixinstructor.llm_validator's real 1.15.4 signature is llm_validator(statement, client, allow_override=False, model='gpt-3.5-turbo', temperature=0) — the client positional is REQUIRED and there is no allow_reask parameter (older examples showing it are stale; closest is allow_override).
When: Delegating semantic field validation to an LLM inside a Pydantic validator.
Corrected on 2026-10-23: an internal remark was removed.
local-retries-free-money-not-timecalibrationAgainst local Ollama, retries cost zero money but real wall-clock time per call (more when the model must first be loaded) — retry aggressively only when time is not the constraint; for cloud, every retry is another billed call, and each reask resends the growing history (the card instructor-reask-loop: the broken response and the error text are appended), so retries can cost several times the base call.
When: Setting max_retries and designing test suites around local vs cloud LLM calls.
Corrected on 2026-11-01: the unsourced '~36s per qwen3:32b call' and '~6x base cost' figures were removed; the cost growth now cites the card instructor-reask-loop.
max-retries-create-onlygotcha-fixIn instructor 1.15.x, passing max_retries to from_provider() poisons the client: EVERY subsequent create() raises TypeError 'got multiple values for keyword argument max_retries' — max_retries belongs on create() ONLY.
When: Building instructor clients and wondering why every extraction call TypeErrors.
provider-mode-autoselect-and-overridecalibrationInstructor auto-selects TOOLS mode for function-calling-aware Ollama models (llama3.1, qwen2.5, gemma3) and JSON mode for the rest — override explicitly (mode=Mode.JSON) when auto-detection misfits the model.
When: Structured extraction misbehaves on a particular local model (tool-call errors or malformed JSON).
removed-helper-import-guardgotcha-fixdisable_pydantic_error_url is not exported by the instructor package root: `from instructor import disable_pydantic_error_url` raises ImportError (tested on instructor 1.10.0 and 1.15.4; the root names it in no release checked, 1.0.0 to 1.17.0) — on those tested versions import it from instructor.utils instead, and let a doc-guard assertion keep the root-import form out of the docs.
When: Porting older instructor recipes (token-saving helpers) onto current versions.
Corrected on 2026-11-01: the helper was not removed. A source check of the instructor releases 1.0.0 to 1.17.0 finds it defined in instructor/utils.py (1.3.4 to 1.10.0), instructor/utils/core.py (1.11.0 to 1.15.1) and instructor/v2/core/utils.py (1.15.3 to 1.17.0), and in none of 1.0.0 to 1.3.3; tested on 1.10.0 and 1.15.4, `from instructor.utils import disable_pydantic_error_url` works and the package-root import raises ImportError.
retry-on-quality-predicatetool-sequenceRetry not only on exceptions but on result-quality predicates — e.g. wrap the extraction with tenacity retry_if_result(confidence below threshold) so a schema-valid but low-confidence result gets another bounded attempt.
When: A structured extraction validates fine but carries a machine-readable quality signal (e.g. a confidence score) that can be too low to accept.
Corrected on 2026-11-01: added what happens when the attempts run out (tenacity raises RetryError; measured with tenacity 8.2.3).
Get the whole skill
All 12 primitives of this skill as one package, with the order to apply them.
Buy only the primitives you need
Each primitive is 1 credit (≈ €0.10). Pick them from the list above — the button is next to each one.
Upgrade your own skill
Paste your skill; we pick the 5 primitives from the shelf that fit it best, as one bundle for 5 credits (≈ €0.50).
Upgrade my skillNeighbour skills
Skills whose primitives are closest to this one (bge-m3 similarity):