Skip to content
Back to skills

Structured Outputs

ASecurity

Extract reliable typed JSON from LLMs using schema-constrained decoding, runtime validation, enums, and bounded retries

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
ai-agentsrust

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --skill structured-outputs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structured Outputs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Structured Outputs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/adityaaatiwari-structured-outputs-anvil/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-structured-outputs-anvil)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: structured-outputs
description: Extract reliable typed JSON from LLMs using schema-constrained decoding, runtime validation, enums, and bounded retries
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Structured outputs

Use when converting natural language or model reasoning into strongly typed application objects or tool payloads.

## Schema design
- Use provider native JSON Schema / `strict: true` structured output modes where available rather than prompting for raw markdown JSON blocks.
- Keep schemas shallow with clear field names, explicit `description` hints, tight enums, and nullable fields instead of hallucination-prone required strings.
- Prefer `"unknown"` / `"none"` enum options and brief `reasoning` fields before classification verdicts when accuracy matters.

## Validation and repair
- Validate every parsed JSON payload at runtime using Zod or Pydantic; never trust `JSON.parse` types directly.
- Handle refusal fields explicitly, and cap schema-repair retries (`<= 2` attempts passing exact validation error paths back to the model) with circuit-breaking fallbacks.

## Verify
Run tests covering malformed JSON, enum boundary cases, refusal payloads, nullable fields, and retry cap enforcement.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.