guidance

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

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/kotakbiasa/hermes-agent --skill guidance-kotakbiasa
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/kotakbiasa/hermes-agent/tree/main/optional-skills/mlops/guidance
Command: npx skills add https://github.com/kotakbiasa/hermes-agent --skill guidance-kotakbiasa

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Guidance provides a constrained generation framework to enforce structure and correctness in LLM outputs using regexes, grammars, and workflow-driven prompts.

Core Features & Use Cases

  • Regex and grammar-based generation to produce valid JSON, XML, code, and structured data.
  • Token healing, multi-step workflows, and guidance-style orchestration for robust task execution.
  • Local and API backends support with Pythonic tooling for repeatable, auditable prompts.

Quick Start

Install Guidance and wrap prompts with system, user, and assistant contexts to generate constrained 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 valid JSON and XML formats?

Regex and grammar-based generation enforces structured outputs by constraining the LLM to predefined formats. This ensures validity for JSON, XML, code, and structured data workflows across local and API backends.

What is token healing for structured LLM generation?

Token healing is a constrained generation technique that fixes token boundary issues during multi-step workflows, ensuring LLM outputs strictly adhere to predefined regex patterns and grammars without structural errors.

Can I use grammar-based generation to enforce structured data formats across different backends?

Yes, grammar-based constrained generation supports both local and API backends, allowing you to apply regex constraints and Pythonic tooling to produce auditable, repeatable structured data outputs.

How do I build multi-step workflows for constrained LLM outputs?

You build multi-step workflows by wrapping prompts with system, user, and assistant contexts, then applying guidance-style orchestration and token healing to execute robust, structured generation tasks.

When should I use regex constraints for LLM generation?

Use regex constraints for LLM generation when you need guaranteed format validity for structured data, code, or multi-step workflows where unguided outputs would break downstream processing or validation.

Does constrained generation work with Pythonic tooling for repeatable prompts?

Yes, constrained generation integrates with Pythonic tooling to wrap prompts and apply grammars, creating repeatable, auditable workflows that reliably produce valid structured outputs.