# LLM JSON Contract — Validate, Locate, Repair

> Validates a model's JSON response against a schema subset, recovers fenced or chatty output first, and returns the exact violating paths plus a repair prompt that fixes those paths and nothing else — with truncation diagnosed instead of retried.

LLM JSON Contract — Validate, Locate, Repair is a free AI agent skill on Agensi by SHUN, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [SHUN](https://www.agensi.io/creators/66shun66)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-23
- Security: scan passed (2026-11-23); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/llm-json-contract-validate-locate-repair
- Tags: llm-ops, apis-backend, workflow-automation

## About this skill

A model that returns JSON returns approximately JSON: a fence, an apology, a trailing comma, a renamed key. Downstream code fails on a KeyError, the retry sends the same prompt, and the same failure comes back.

This skill separates three failures that get treated as one:
- formatting noise (fence, prose, trailing comma, Python literals, smart quotes) — stripped and recorded, then validated
- contract violations — reported per JSON path with code, expected value and actual value
- truncation — detected from brace counts and reported as "shorten the response", not "try again"

Supported keywords: type, required, properties, additionalProperties, items, enum, pattern, minimum, maximum, minLength, maxLength, minItems, maxItems, allOf, oneOf, anyOf. It emits a repair prompt listing only the failing paths, states which fields to leave untouched, and advises a retry budget per failure category. Output: contract_check.md plus contract_check.json; exit codes 0/1/2 for PASS/REPAIR/FAIL.

## Requires

- Python 3.9+

## Known limitations

Subset only: no $ref, format, if/then, patternProperties, uniqueItems. Does not judge whether the content is true. Cannot fix prompt design or repair an unparseable syntax error it will not guess at.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the LLM JSON Contract — Validate, Locate, Repair skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### What does LLM JSON Contract — Validate, Locate, Repair do?

Validates a model's JSON response against a schema subset, recovers fenced or chatty output first, and returns the exact violating paths plus a repair prompt that fixes those paths and nothing else — with truncation diagnosed instead of retried.

### Which AI agents support LLM JSON Contract — Validate, Locate, Repair?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use LLM JSON Contract — Validate, Locate, Repair?

Connect your AI agent to Agensi through MCP, then ask it to use LLM JSON Contract — Validate, Locate, Repair on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
