guidance

Constrain LLM outputs with regex patterns and grammars for structured formats.

Updated May 3, 2026
One-click install
npx skills add https://github.com/Yangel-hide/video-production-planner-agent --skill guidance-yangel-hide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/Yangel-hide/video-production-planner-agent/tree/main/optional-skills/mlops/guidance
Command: npx skills add https://github.com/Yangel-hide/video-production-planner-agent --skill guidance-yangel-hide

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Guidance enables constrained generation by applying regex patterns and grammars to enforce structured outputs, reducing errors and ensuring consistency across tasks.

Core Features & Use Cases

  • Constrained generation with regex and grammars to guarantee valid JSON/XML/code
  • Grammar-based generation and token healing for deterministic results
  • Multi-step workflows and Pythonic tooling for end-to-end automation
  • Local and API-backed backends support for flexible deployment

Quick Start

Install Guidance, import guidance, and begin constraining LLM outputs with regex and grammars to guarantee structured results

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 and XML generation?

You can constrain LLM outputs by applying regex patterns and grammars during generation. This enforces structured formats, reduces errors, and guarantees consistent valid JSON or XML across tasks like code templates and multi-step workflows.

What is constrained generation and how does grammar-based generation work?

Constrained generation restricts LLM token selection using regex or grammars to enforce specific output structures. Grammar-based generation guides the model to produce only valid syntax, ensuring deterministic and validated results.

Can I use regex patterns to enforce structured outputs with local and API-backed LLMs?

Yes, you can apply regex patterns to enforce structured outputs across both local and API-backed LLM environments. This provides flexible deployment options for grammar-based generation and token healing.

What is token healing and when do I need it for structured LLM workflows?

Token healing corrects boundary artifacts during constrained LLM generation to ensure valid structured outputs. You need it when applying regex or grammars in multi-step workflows to guarantee deterministic and correctly formatted results.

Do I need the transformers library to apply regex patterns and grammars for LLM generation?

Yes, the transformers library is required alongside the guidance package. These dependencies provide the foundational environment needed to apply regex patterns, grammars, and Pythonic validation tooling for constrained LLM generation.