guidance

Enforce regex and grammar constraints on LLM outputs for structured JSON, XML, and code.

6|2|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/GregsGreyCode/Logos --skill guidance-gregsgreycode
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/GregsGreyCode/Logos/tree/main/skills/mlops/inference/guidance
Command: npx skills add https://github.com/GregsGreyCode/Logos --skill guidance-gregsgreycode

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires guidance, transformers, and includes references (resource) components.

What problem does it solve?

Guidance addresses the challenge of controlling LLM outputs by applying regex and grammar constraints, enabling reliable structured results and reducing post-processing effort.

Core Features & Use Cases

  • Regex and grammar-based generation to ensure valid JSON, XML, and code-like outputs
  • Token healing, multi-step workflows, and reusable generation patterns for complex tasks
  • Local and cloud backend compatibility to fit diverse deployment needs

Quick Start

Install Guidance, choose a backend, and start generating constrained, structured outputs.

Frequently Asked Questions about guidance

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

FAQPage Schema
How do I constrain LLM outputs to ensure valid JSON generation?

You can constrain LLM outputs for valid JSON generation by applying regex and grammar constraints directly during generation. This enforces syntactically valid structured results, eliminating invalid outputs and reducing post-processing effort.

What is the best way to build multi-step LLM workflows with structured outputs?

Building multi-step LLM workflows with structured outputs is best achieved through a Pythonic interface that supports reusable generation patterns. This approach applies grammar constraints and token healing across complex sequential tasks to maintain output validity.

Does guidance work with local and cloud backends for constrained generation?

Yes, constrained generation via guidance supports both local and cloud backends. This compatibility fits diverse deployment needs while enforcing valid JSON, XML, and code-like outputs from your chosen language models.

Why do I need regex and grammar constraints for LLM structured output?

Regex and grammar constraints for LLM structured output are needed to control generation and enforce valid formats. Without these constraints, language models frequently produce invalid JSON or XML, requiring extensive post-processing to fix syntax errors.

Can I reduce post-processing effort when generating XML and code-style outputs from LLMs?

You can reduce post-processing effort when generating XML and code-style outputs by applying grammar-based generation constraints. This proactively ensures the LLM only produces valid syntax, minimizing manual correction and parsing failures.