Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Structured Output Design

ASecurity

Design and validate model-produced structured proposals before application use. Use when specifying JSON or typed outputs from an LLM, handling refusals or malformed generations, validating semantic constraints, or migrating model output contracts. Do not use for routine API serialization or database schema design without model-generated data.

2 stars
0 votes
0 copies
0 views
Added 10/6/2026
ai-agentsrustgoapidatabase

Works with

terminalapi

Security Analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned 10/6/2026

$npx -y skills add Sathvikar01/Agent-engineering-skills --skill structured-output-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structured Output Design?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Structured Output Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/sathvikar01-structured-output-design/badge)](https://www.skillsdirectory.com/skills/sathvikar01-structured-output-design)

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

Download with Pro
Files
SKILL.md
---
name: structured-output-design
description: >-
  Design and validate model-produced structured proposals before application use. Use when specifying JSON or typed outputs from an LLM, handling refusals or malformed generations, validating semantic constraints, or migrating model output contracts. Do not use for routine API serialization or database schema design without model-generated data.
metadata:
  collection: "Agent Engineering"
  version: "2.0.0"
---

# Structured Output Design

Treat generated data as a proposal. Parsing and schema validation establish shape; application rules establish meaning; authorization establishes permission. None implies the others.

## Define the consumer contract

1. List the exact decisions the consumer must make. Remove ornamental fields and model assertions of permission or success. Distinguish model-extracted/proposed fields from trusted server-generated identity, time, state version and calculations.
2. Choose a JSON Schema dialect and the supported subset of the actual provider; verify support rather than assuming full schema coverage. Use enums for closed choices, required fields for necessary decisions, and explicit optional/missing/null semantics. Bound lengths, arrays and numeric ranges; reject extra properties where supported.
3. Use discriminated variants for materially different states: proposed action, insufficient evidence, refusal or no action. Require variant-specific fields and disallow contradictory combinations. Handle provider-level refusal, truncation and transport errors outside the success schema when required by the API.
4. Include contract version and evidence references when the consumer needs them. Do not let the model generate an execution receipt or approval token. Read [proposal example](references/proposal-contract.md) when specifying action unions and admission stages.

## Validate in separate stages

5. Bound bytes/depth before parsing. Decide how to handle duplicate keys and non-finite numbers; parsers can silently disagree. Validate shape, then cross-field rules, units, identifiers, tenant ownership, evidence provenance, freshness and business constraints. Recompute money and permissions in trusted code.
6. Normalize only explicitly allowed representational differences. Preserve raw output and validation errors for provenance under privacy controls. Canonicalize the validated representation with a documented algorithm for hashing/deduplication; changing meanings is not normalization. Never default a missing safety-critical field to a permissive value.
7. Promote only validated fields into a typed proposal. Pass it to deterministic-authority for authorization; keep model output distinct from authoritative application state. A valid JSON object can still contain a fabricated ID or prohibited action.

## Recover and evolve

8. Distinguish transport errors, provider refusal/truncation, parse failure, schema failure and semantic rejection. Fail closed on admission failure. Permit bounded reconstruction for recoverable formatting or semantic candidate errors using safe validation feedback, authorized facts and the unchanged contract; revalidate from the start. Do not execute the original output while reconstruction runs or repair missing evidence into invented facts. Construct → verify → admit: try a safe supported alternative when available; exhaust bounded admissible search before terminal failure without weakening policy. Return a typed failure/abstention when the repair budget is exhausted.
9. Version contracts and test compatibility across producer/consumer versions. Reject unknown versions before execution; migrate through explicit deterministic adapters. Preserve rejection semantics through migration. Do not silently broaden an enum to make a failing generation pass.

Deliver the schema, field trust/meaning table, staged validator, malformed/refusal examples, bounded recovery policy and migration tests. Verify valid-but-unauthorized, contradictory variants, unsupported evidence, duplicate keys, unknown version and missing critical fields. Ordinary API contract skills still own transport serialization; this skill owns uncertainty and trust at the model boundary.

Check decision ↔ facts ↔ explanation ↔ evidence ↔ state before promotion. Examples: WAIT with an immediate date; installments not totaling the required amount; SUPPORTED with an explanation asserting contradiction; evidence ID absent from observations; transition skipping an allowed state. Encode decidable relations in code. For genuinely semantic support, use calibrated evidence-based review and mark unresolved meaning unsupported. evidence-provenance owns ledger/claim reconciliation.

Attribution

Sathvikar01Sathvikar01
View sourceSee grades on GitHubMore from Sathvikar01 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

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

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698431 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →