guidance

Generates structured JSON, XML, or code outputs using regex and grammars constraints.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

This Skill helps you control and enforce structured output from LLMs, ensuring valid JSON/XML/code generation, and supports building multi-step workflows.

Core Features & Use Cases

  • Constrained LLM Generation: Use regex or grammars to control LLM output syntax, ensuring valid JSON/XML/code generation.
  • Structured Formats: Enforce structured formats like dates, emails, IDs, etc.
  • Multi-Step Workflows: Build multi-step workflows with Pythonic control flow, preventing invalid outputs through grammatical constraints.
  • Use Case: Automate the generation of structured data like user profiles, product listings, or event records from unstructured text.

Quick Start

Use the guidance skill to generate a structured JSON object for a new 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 structured output and valid JSON generation from an LLM?

To enforce structured output and valid JSON generation from an LLM, use constrained generation with regex or grammars. This ensures the syntax remains valid, preventing formatting errors during structured data generation tasks.

What is the best way to build multi-step workflows for constrained LLM generation?

The best way to build multi-step workflows for constrained LLM generation is using Pythonic control flow with grammatical constraints. This approach prevents invalid intermediate outputs across sequential generation steps.

Can I use regex to control LLM output syntax for specific formats like emails?

Yes, you can use regex to control LLM output syntax for specific formats like emails, dates, and IDs. This constrained generation technique strictly enforces structured formats during model inference.

Do I need the transformers library to use guidance for constrained generation?

Yes, you need the transformers library along with guidance and llama.cpp dependencies to use this framework. These libraries provide the underlying environment for executing constrained generation workflows.

How do I automate generating structured product listings from unstructured text?

To automate generating structured product listings from unstructured text, apply multi-step workflows with grammatical constraints. This transforms raw text into valid, structured records through Pythonic control flow.