guidance

Constrain LLM outputs with regex and grammars for structured JSON, XML, or code generation.

Updated Apr 11, 2026
One-click install
npx skills add https://github.com/hhhi21g/HealthCenter --skill guidance-hhhi21g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/hhhi21g/HealthCenter/tree/main/.codex/skills/guidance
Command: npx skills add https://github.com/hhhi21g/HealthCenter --skill guidance-hhhi21g

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Guidance helps control and structure LLM outputs with regex and grammars, ensuring valid JSON/XML/code generation and structured formats.

Core Features & Use Cases

  • Regex Constraints: Control LLM output syntax with regex or grammars.
  • Structured Output: Guarantee valid JSON/XML/code generation and enforce structured formats.
  • Multi-Step Workflows: Build multi-step workflows with Pythonic control flow.
  • Use Case: Use Guidance to generate structured JSON data from unstructured text, ensuring accurate information extraction.

Quick Start

Use the guidance skill with the following example: generate_person(name="John Doe", age=30, email="[email protected]").

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?

To constrain LLM outputs for valid JSON generation, you can use regex constraints and grammar-based generation to enforce specific structured formats. This ensures the model produces syntactically correct structured data.

What is grammar-based generation for structured output?

Grammar-based generation is a prompt engineering technique that controls LLM output syntax using defined grammars or regex patterns. It guarantees valid JSON, XML, or code generation by restricting the model to specific structural patterns.

How do I extract structured data from unstructured text using LLMs?

You can extract structured data from unstructured text by applying regex constraints and multi-step workflows with Pythonic control flow. This approach ensures accurate information extraction and enforces the desired output format reliably.

Can I use regex pattern matching to control LLM syntax?

Yes, you can use regex pattern matching to control LLM syntax and enforce structured formats. This capability allows you to restrict the generated content to specific patterns, improving the accuracy and reliability of the output.