structured-output
Skill756 starsChanged 5 months agoMITView on GitHub
Get JSON out of the model reliably. Prefer tool_use with a schema over prompted-JSON, validate on receive, retry on parse fail. Use when downstream code will parse the response.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- nahid-sparktales/agent-dispatchertheir own version, first seen Sep 21, 2026
- InterfazeAI/interfaze-skillstheir own version, first seen Sep 10, 2026
- LingXi-Org/LingxiSkillstheir own version, first seen Aug 17, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Jul 14, 2026
- mykaarma/kaarma-skillstheir own version, first seen Apr 28, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- nahid-sparktales/agent-dispatcher★ 59same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- InterfazeAI/interfaze-skills★ 4same name
- mykaarma/kaarma-skills★ 4same name
- LingXi-Org/LingxiSkills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/CLAUDE.mdCLAUDE.md
- a11y-passSkill
- active-memory-reminderSkill
- adversarial-verifySkill
- authz-checkSkill
- bisect-regressionSkill
- broken-window-checkSkill
- changelog-from-diffSkill
- clean-commitsSkill
- context-budgetSkill
- contract-testSkill
- coverage-gapsSkill
- decision-recordSkill
- dependency-auditSkill
- design-systemSkill
- eval-harnessSkill
- evaluator-calibrationSkill
- feature-list-jsonSkill
- flaky-hunterSkill
- harness-strippingSkill
- hitl-escalateSkill
- init-script-contractSkill
- input-validationSkill
- kill-dead-codeSkill
- loading-empty-error-statesSkill
- migration-writerSkill
- model-routingSkill
- owasp-reviewSkill
- pdf-ingestionSkill
- planner-spec-expandSkill
- pr-from-diffSkill
- progress-reading-protocolSkill
- prompt-cachingSkill
- readme-auditSkill
- read-the-traceSkill
- rebase-safelySkill
- reduce-nestingSkill
- revert-surgicalSkill
- schema-diffSkill
- secret-scanSkill
- self-eval-biasSkill
- shift-notesSkill
- simplifySkill
- spec-firstSkill
- sprint-contractSkill
- sql-reviewSkill
- subagent-fanoutSkill
- suggest-next-featuresSkill
- systematic-debuggingSkill
- tool-restraintSkill
- using-loopkitSkill
- verification-before-completionSkill
- write-failing-test-firstSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
One retry, not a loop: If the model can't produce it in two tries, the schema is too complex or the prompt is wrong.
- Distinctive: line 27
Never silently coerce: If a required field is missing, fail loudly.
- Distinctive: line 31
Flat objects beat nested: Every level of nesting is another chance to hallucinate.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Structured Output
Prompted JSON — "reply as JSON" in the system prompt — fails on ~2-8% of calls in the wild: stray prose before the object, trailing commas, unescaped quotes, code fences. That failure rate is fine for a demo and fatal for a loop that runs a thousand times.
The hierarchy — use the strongest that fits
- Tool use with schema (best) — declare a tool with a JSON Schema for its input. Force the model to call that tool. The API validates the arguments against the schema before you see them. Malformed JSON never leaves the model. Use this whenever the downstream is a real parser.
- JSON mode /
response_format(good) — where supported. Guarantees a valid JSON object at the top level; does not guarantee schema conformance. Cheap upgrade over prompted-JSON. - Prompted JSON with strict rules (fallback) — for models/tiers without tool use. Say "output ONLY the JSON object, no code fences, no prose", give an example, and validate on receive. Assume ~5% failure and handle it.
The validate-and-retry pattern
call → parse → if fail: retry once with the parse error appended → parse → if fail: hard fail- One retry, not a loop. If the model can't produce it in two tries, the schema is too complex or the prompt is wrong. Log and stop.
- Feed the parse error back verbatim on retry — the model will fix specific issues ("expected string at line 3") that it can't guess from a generic "please try again".
- Never silently coerce. If a required field is missing, fail loudly. Auto-defaults hide prompt bugs.
Schema design — keep it flat
- Flat objects beat nested. Every level of nesting is another chance to hallucinate.
- Enums over free strings.
"severity": "high|medium|low"not"severity": "...". - Optional fields default to null explicitly in the schema. Don't ask the model to "omit if unknown".
- No
additionalProperties: truewithout a reason. If the model can add fields, it will, and they'll be inconsistent.
When free JSON is acceptable
- Single scalar field, low-stakes (
{"answer": "yes"}). - Human-in-the-loop reviewing every output.
- Prototype throwaway.
Otherwise use tool_use.
Red flags
- Regex to extract JSON from a code fence. You're one prompt tweak away from breakage. Use tool_use.
json.loadswith a baretry/except: pass. Silent failure — you'll be debugging a downstream nil for hours.- Schema is a wall of
oneOf/anyOf. Split into multiple tools and let the model choose which to call. - "Just add 'ONLY JSON' to the system prompt" in a hot loop. Works 95% of the time. That's the problem.
- Different structured output on retry with same input. Set temperature to 0 for extraction tasks.
Loopkit-adjacent
Loopkit's adversarial-verify output is {"passes": bool, "failures": [...]} — that is exactly the shape this skill formalizes. When you compose skills, keep every machine-consumed hop tool_use'd.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

