structured-output
Stable structured JSON output for agents using strict schemas. Use when you need deterministic JSON responses, schema validation, or streaming JSON object…
от jiayaoqijia★ 81 звезда на GitHub
Установить structured-output в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Structured Output (Strict JSON)
Implement stable, schema-validated JSON outputs for agents. Use this when responses must be valid JSON, match a schema exactly, and be reliable under retries/streaming.
Core Workflow
- Define a strict schema (JSON Schema or Pydantic).
- Generate JSON-only output (no prose).
- Validate output against schema.
- If invalid, run a repair pass with a minimal error-focused prompt.
- For streaming, emit incremental JSON with a deterministic assembly buffer.
Prompt Pattern (Non-Streaming)
Use a strict system instruction and a minimal user prompt. Always require JSON only. Input can be empty; output must still match the schema.
Template:
SYSTEM:
You are a JSON generator. Output ONLY valid JSON that matches the given schema.
Do not include Markdown, comments, or trailing text.
If a field is unknown, use null (unless schema disallows it).
USER:
Return JSON that matches this schema:
<SCHEMA>
Input:
<INPUT>
Prompt Pattern (Streaming)
Use the same schema but ensure the model emits a single JSON object and nothing else. Stream tokens and buffer until a valid JSON parse succeeds.
Implementation References
- JSON Schema + retry/repair loop: see
references/json_schema_patterns.md - Pydantic models + parsing: see
references/pydantic_patterns.md - Python examples:
scripts/generate_object.py,scripts/stream_object.py
Guardrails
- Reject non-JSON output immediately; re-prompt with error-only instructions.
- Disallow extra keys unless
additionalPropertiesis explicitly true. - Keep schemas small and explicit; prefer enums for constrained values.
- Log schema + error details for debugging (do not expose stack traces to end users).
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- README.md
- SOURCE.md
- TRUST.auto.yaml
- references/json_schema_patterns.md
- references/pydantic_patterns.md
- scripts/generate_object.py
- scripts/stream_object.py
FAQ
Что делает скилл structured-output?
Stable structured JSON output for agents using strict schemas. Use when you need deterministic JSON responses, schema validation, or streaming JSON object assembly (generateObject/streamObject-style) with retry-and-repair loops.
Как установить скилл structured-output?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл structured-output запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…