guidance

Constrain LLM outputs to valid JSON, XML, and code using regex and grammar constraints.

52|6|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/ovachiever/droid-tings --skill guidance
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/ovachiever/droid-tings/tree/main/skills/guidance
Command: npx skills add https://github.com/ovachiever/droid-tings --skill guidance

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Guidance provides constrained generation, enforcing valid formats (JSON/XML/code) using regex and grammars, enabling fast, reliable, structured outputs from LLMs and reducing post-editing toil.

Core Features & Use Cases

  • Regex/Grammar Constraints: Force outputs to match patterns (emails, dates, IDs) and grammatical rules
  • Structured Outputs: Guarantee valid JSON/XML/code, preventing invalid structures
  • Multi-step Workflows: Build Pythonic control flows to orchestrate complex generations
  • Backends Support: Works with diverse backends (OpenAI, Transformers, Claude variants)

Quick Start

Use Guidance to constrain a generation to a valid JSON object with known keys.

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 valid JSON or XML formats?

Constrain LLM outputs using regex and grammar rules to enforce valid JSON, XML, or code structures. Guidance applies pattern matching and grammatical constraints during generation, eliminating malformed outputs and post-processing overhead.

Can I use regex patterns to validate structured outputs from language models?

Yes. Guidance enforces regex constraints to match specific patterns—emails, dates, IDs—and validate structured formats. Token healing ensures outputs conform to patterns without regeneration.

How do I build multi-step LLM workflows with schema-driven control?

Use Guidance to orchestrate complex generation pipelines with Pythonic control flow. Define schemas and grammar rules to guide each step, ensuring valid intermediate and final outputs across workflow stages.

What backends does constrained generation work with?

Guidance integrates with multiple backends including OpenAI, Transformers, and Claude variants. Deploy grammar and regex constraints across different model providers without rewriting workflow logic.

Why should I use grammar-based generation instead of post-processing validation?

Grammar-based generation prevents invalid outputs at token time, reducing latency and eliminating retry loops. Constrained generation produces valid results on first attempt, faster than validating and regenerating malformed outputs.

Can I apply structured output constraints to code generation tasks?

Yes. Guidance enforces valid code syntax, function signatures, and structural rules during generation. Regex and grammar constraints ensure generated code compiles and matches required patterns without post-editing.