Works with the AI Agents you already use
Structured Output Repair
Fix unreliable JSON from an LLM: classify the failures, repair the schema and add validation that fails loudly.
$12
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
| Class | Share | Cause |
|---|---|---|
| Truncation | 71% | max_tokens 256, invoices with 8+ line items |
| Invalid JSON | 18% | no strict mode; example uses single quotes |
| Prose wrapper | 11% | 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
| Case | Before | After |
|---|---|---|
| 3-line invoice | valid | valid |
| 14-line invoice | truncated | valid |
| blurry scan | prose wrapper | valid with nulls |
| ambiguous currency | valid, wrong | valid, 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.

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
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
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 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