guidance

Enforce syntactic and structural constraints on LLM generation using regex and grammars.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill solves the challenge of unpredictable LLM output by enforcing strict syntax, structure, and format constraints, ensuring that generated content is always valid and ready for programmatic use.

Core Features & Use Cases

  • Constrained Generation: Use regex and grammars to guarantee valid JSON, XML, or code output.
  • Token Healing: Automatically fix unnatural token boundaries to ensure perfect formatting.
  • Multi-Step Workflows: Build complex, stateful agentic workflows with Pythonic control flow.
  • Use Case: If you need to generate a JSON object representing a user profile, this Skill ensures the output strictly adheres to your schema, preventing parsing errors in your downstream applications.

Quick Start

Use the guidance skill to generate a valid JSON object containing a name and age field for a user profile.

Frequently Asked Questions about guidance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce JSON validation and structured output on LLM generation?

Structured output is enforced by applying regex and context-free grammars to LLM generation. This guarantees valid JSON or XML outputs by constraining syntax during inference, preventing parsing errors in downstream applications.

What is token healing and how does it fix LLM formatting issues?

Token healing fixes unnatural token boundaries during constrained generation. It automatically corrects formatting artifacts at the end of prompts, ensuring the generated text adheres perfectly to the required structural constraints without manual intervention.

Can I use constrained generation with OpenAI, Anthropic, and local Transformers models?

Constrained generation integrates with various backends including OpenAI, Anthropic, and local Transformers or llama.cpp models. This allows you to apply strict syntax constraints across different platforms while maintaining programmatic control over the output structure.

How do I build stateful multi-step reasoning workflows with LLMs?

Multi-step reasoning workflows are built using Pythonic control flow to manage state across interactions. This facilitates complex, stateful agentic workflows by chaining constrained generation steps together within a single execution pipeline.

What is the best way to prevent parsing errors when generating JSON from LLMs?

Preventing parsing errors is best achieved through constrained generation using context-free grammars. By enforcing strict schema adherence during the generation phase, the output is guaranteed to be valid JSON ready for immediate programmatic use.