llm-structured-output

llm-structured-output is a skill for Claude Code, Codex from hybridlabor-api/bdb-dev-optimized-agent-skills. It costs 42 tokens per session (3,420 once invoked), scanned A, original, Apache-2.0.

A skill for making language-model responses return validated JSON, fixed choices, and typed objects instead of free-form text. It covers structured response methods for OpenAI, Anthropic, and Google APIs.

In plain words
What is it for?
Use it to design schemas, extract data from model responses, validate results, and add retries when a response does not match the expected shape.
Why use it?
It reduces errors when an application's code needs to read model output directly, such as missing fields, invalid JSON, or unexpected values.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to design schemas, extract data from model responses, validate results, and add retries when a response does not match the expected shape.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add hybridlabor-api/bdb-dev-optimized-agent-skills --skill llm-structured-output
Clone the repo
git clone --depth 1 https://github.com/hybridlabor-api/bdb-dev-optimized-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for llm-structured-output

README.md
[![agentmods](https://agentmods.dev/badge/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output/github.svg)](https://agentmods.dev/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output)
Your own site
<a href="https://agentmods.dev/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output"><img src="https://agentmods.dev/badge/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for llm-structured-output

Your own site · 80×15
<a href="https://agentmods.dev/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output"><img src="https://agentmods.dev/badge/skills/hybridlabor-api/bdb-dev-optimized-agent-skills/llm-structured-output.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,420 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.03420
Opus 5 $0.00021 $0.01710
Sonnet 5 $0.00008 $0.00684
Haiku 4.5 $0.00004 $0.00342

Measured 5d ago against content hash d34cbf9c83e9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

llm-structured-output scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/global_config/llm-structured-output/SKILL.md · 214 lines

How it starts

The opening of the file, as written. The whole thing — 214 lines — stays where its author put it; the contents beside it link to each section on GitHub.

LLM Structured Output

What This Skill Does

Extract typed, validated data from LLM API responses instead of parsing free-text. This skill covers the three main approaches: OpenAI's response_format with JSON Schema, Anthropic's tool_use block for structured extraction, and Google's responseSchema in Gemini. You will learn when each approach works, when it breaks, and how to build retry logic around schema validation failures that every production system encounters.

When to Use This Skill

  • The user needs to extract structured data (JSON objects, arrays, enums) from an LLM response
  • The user is building a pipeline where LLM output feeds directly into code (database writes, API calls, UI rendering)
  • The user asks about response_format, json_mode, json_object, or json_schema in OpenAI
  • The user asks about using Anthropic's tool_use or tool_result blocks for data extraction (not for actual tool execution)
  • The user asks about Zod schemas with zodResponseFormat() from the openai npm package
  • The user needs to parse LLM output into Pydantic models using instructor, marvin, or manual validation
  • The user is getting malformed JSON, missing fields, or wrong types from LLM responses and needs a fix
  • The user asks about controlled generation, constrained decoding, or grammar-based sampling in local models

Do NOT use this skill when:

  • The user wants free-form text generation (summaries, essays, chat)
  • The user is asking about Zod for form validation or API input validation (use zod-validation-expert instead)
  • The user needs prompt engineering for better text quality (not structure)
  • The user wants to call real external tools/APIs (this skill covers using tool_use as a structured output hack, not actual tool orchestration)

Core Workflow

  1. Identify the target schema. Ask the user what fields they need extracted. Define every field with its type, whether it's required or optional, and valid enum values if applicable. Do not proceed without a concrete schema.

Read the full file on GitHub · 214 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 214 lines · 42 tokens per session scan A d34cbf9c83e9

Subscribe to this mod's changes

llm-structured-output is a skill published in the GitHub repository hybridlabor-api/bdb-dev-optimized-agent-skills (6 stars, last pushed 3d ago), licensed Apache-2.0. It adds 42 tokens to every session and 3,420 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.