Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Structured Output Repair

    1

    Fix unreliable JSON from an LLM: classify the failures, repair the schema and add validation that fails loudly.

    $12

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Structured Output Repair

    Structured Output Repair

    Example session with this skill installed

    Our invoice extractor returns JSON that fails to parse about 2% of the time. Here are 40 failing outputs and the schema. Fix it.

    • Read your context and instructions
    • Compiled the structured output repair

    Worked example — illustrative data.

    Structured output repair: invoice extractor

    Verdict

    2.3% parse failure. 71% of it is truncation from a 256-token output cap; 18% is trailing commas; 11% is a prose wrapper.

    Failure distribution

    ClassShareCause
    Truncation71%max_tokens 256, invoices with 8+ line items
    Invalid JSON18%no strict mode; example uses single quotes
    Prose wrapper11%prompt says "return JSON" only

    Schema changes

    • Flatten line_items: the nested tax object is never used.
    • Cap items at 30, require at least one.
    • status becomes an enum of 4 values (was free string, 11 invented values seen).
    • Every field the consumer reads is required; unknown uses null.

    Validation contract

    on_invalid: repair once with the error, then fail with the raw output attached.
    fallback: none — a default object would corrupt the ledger.
    log_raw: true, 30-day retention.

    Test matrix

    CaseBeforeAfter
    3-line invoicevalidvalid
    14-line invoicetruncatedvalid
    blurry scanprose wrappervalid with nulls
    ambiguous currencyvalid, wrongvalid, null + flag

    Monitoring

    Parse-failure rate by model version; alert above 0.5%.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Structured output repair: find why JSON and schema output breaks, then fix it with constrained decoding, validation and a repair loop.

    Use this skill when:

    • JSON parsing fails
    • the model violates a schema
    • reliable structured output
    • function calling returns invalid data

    Who it's for: Teams parsing LLM output in production.

    Example request

    6% of our responses fail JSON parsing. Fix it.

    What the example returns

    • Cause: unescaped quotes in prose
    • Schema plus constrained decoding
    • Repair loop, 0.2% still invalid

    In the package: five files — SKILL.md with the trigger and workflow, README.md, references/METHOD.md (the full method), references/CHECKLIST.md (the pass/fail gate) and examples/EXAMPLE.md (a worked run you can copy).

    Works with Claude Code, Cursor, Codex CLI and any agent that reads SKILL.md. Plain markdown: no API key, no account, no network access.

    Structured Output Repair

    Requires access to raw model logs. Does not include a proprietary parser. Framework-agnostic but requires a validation layer (e.g., Zod, Pydantic) to implement the prescribed fixes.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    Permissions

    Read Files
    Listed3 days ago
    Updated2 days ago

    What's inside

    Frequently Asked Questions

    This skill provides a comprehensive framework and set of protocols to eliminate JSON parsing errors by moving beyond simple prompting to advanced schema engineering and constrained decoding configurations.

    The skill is provider-agnostic and works with any agent using OpenAI, Anthropic, or Google Gemini, specifically targeting workflows that utilize Pydantic, Zod, or standard JSON Schema.

    You will receive the systematic diagnostic framework, schema optimization templates, validation loop architectures, and a guide for implementing provider-specific strict modes.

    No, this skill focuses on preventing and repairing errors at the infrastructure and schema level; you will still use your existing validation libraries like Pydantic or Zod to catch the initial failures.

    While results vary by model, this skill is designed to bring intermittent parse failures (typically 2-5%) down to near-zero by addressing the root causes of token truncation and schema ambiguity.

    New in LLM Ops