llm-parse-retry

Parse LLM outputs into valid JSON with retry logic and fallback.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dragonkid/dotfiles --skill llm-parse-retry
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: llm-parse-retry
Source: https://github.com/dragonkid/dotfiles/tree/main/claude/skills/learned/llm-parse-retry
Command: npx skills add https://github.com/dragonkid/dotfiles --skill llm-parse-retry

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

LLM responses can be non-deterministic and occasionally return malformed JSON or unexpected formats. This Skill provides application-level retry logic to produce valid, structured outputs without failing immediately.

Core Features & Use Cases

  • Structured-output resilience: Retries and parses LLM outputs into validated JSON.
  • Error handling and fallback: Graceful degradation when all retries fail.
  • Use Case: Integrate with chat-based assistants to ensure reliable data extraction and downstream processing.

Quick Start

Use the llm-parse-retry to wrap an LLM call and automatically retry until a valid JSON payload is obtained or the system falls back to a default response.

Frequently Asked Questions about llm-parse-retry

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I parse non-deterministic LLM outputs into valid JSON?

To parse non-deterministic LLM outputs into valid JSON, you can use application-level retry logic that intercepts malformed responses and attempts content extraction until a validated JSON payload is obtained.

Why does my LLM return malformed JSON and how can I handle it gracefully?

LLM responses can be non-deterministic and occasionally return malformed JSON. You can handle this gracefully by implementing retry mechanisms with fallback logic that degrades smoothly instead of failing immediately when all attempts fail.

How do I use tenacity to retry parsing for structured data extraction?

You can use tenacity's retry_if_result to wrap your LLM call and automatically retry the parsing process until it yields valid structured data or triggers a default fallback response.

What is the best way to ensure reliable structured data from chat-based models?

The best way to ensure reliable structured data from chat-based models is to apply application-level retry logic that validates the extracted output and enforces structured-output resilience during downstream processing.

Does this approach work for downstream processing when LLM extraction fails?

Yes, when LLM extraction fails after all retries, the system employs graceful fallback to provide a default response, ensuring that downstream processing scenarios do not break.

When should I not use application-level retries for LLM JSON parsing?

You should not rely solely on application-level retries when your workflow cannot tolerate any latency from repeated attempts or when a default fallback response cannot adequately replace the missing structured data.