guidance

Apply regex and grammar constraints to generate structured JSON, XML, and code.

3|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/ever-oli/io --skill guidance-ever-oli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/ever-oli/io/tree/main/skills/mlops/inference/guidance
Command: npx skills add https://github.com/ever-oli/io --skill guidance-ever-oli

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Guidance solves the challenge of controlling and validating LLM outputs by applying regular expressions, grammars, and structured formats to generate reliable JSON, XML, or code, reducing errors and post-processing.

Core Features & Use Cases

  • Constrained generation with regex and grammar constraints for guaranteed formats.
  • Token healing, multi-step workflows, and Pythonic guidance functions for reproducible prompts.
  • Local model support and backends configuration for privacy-sensitive or cost-sensitive deployments.
  • Use case: building a data extraction pipeline that outputs strict JSON with validation.

Quick Start

Generate a small JSON object with a name and age that adheres to the required formats.

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 generate valid JSON?

You can constrain LLM outputs for valid JSON by applying regex and grammar rules during generation. This enforces structured formats directly, guaranteeing valid JSON, XML, or code without post-processing.

Can I use constrained generation with local models and multiple backends?

Yes, constrained generation works across multiple backends including Anthropic, OpenAI, Transformers, and llama.cpp. This supports local model deployments for privacy-sensitive or cost-sensitive environments while enforcing structured output formats.

What is token healing and how does it improve structured generation?

Token healing fixes tokenization artifacts at prompt boundaries during constrained generation. It ensures smooth transitions between static prompt text and generated content, maintaining reproducible and accurate multi-step workflows.

What's the best way to build a data extraction pipeline with strict JSON validation?

The best way to build a strict JSON extraction pipeline is using Pythonic guidance functions with grammar constraints. This approach applies reusable patterns for complex prompts, guaranteeing structured output formats and reducing validation errors.

Do I need specific dependencies to enforce grammar rules for structured output?

Yes, enforcing grammar rules for structured output requires the Guidance library and its dependencies, specifically the guidance and transformers packages. Optional components like references provide deeper documentation for complex constrained generation setups.