guidance

Enforce constrained generation with regex or grammar for JSON, XML, or code outputs.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/Rawgrowth-Consulting/rawclaw-agent --skill guidance-rawgrowth-consulting
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/Rawgrowth-Consulting/rawclaw-agent/tree/main/optional-skills/mlops/guidance
Command: npx skills add https://github.com/Rawgrowth-Consulting/rawclaw-agent --skill guidance-rawgrowth-consulting

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Constrained generation with regex and grammars helps ensure LLM outputs adhere to strict formats, reducing downstream validation errors and enabling deterministic results in complex pipelines.

Core Features & Use Cases

  • Enforce JSON, XML, or code formats via regex constraints and CFG grammars.
  • Token healing and grammar-based generation for reliable, deterministic outputs.
  • Build multi-step workflows and Pythonic agents to orchestrate tasks end-to-end.
  • Support for local backends (Transformers, llama.cpp) to protect privacy and enable offline experimentation.

Quick Start

Provide a constrained JSON object matching a defined schema.

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

Constrain LLM outputs by applying regex constraints and context-free grammar (CFG) to generation, which guarantees valid structured JSON or XML formats and reduces downstream validation errors.

What is token healing and how does it improve constrained generation?

Token healing is a constrained generation mechanism that repairs token boundaries during inference, ensuring deterministic outputs that strictly adhere to defined regex patterns or grammar rules without formatting anomalies.

Can I build multi-step workflows and Pythonic agents for constrained generation?

Yes, you can build multi-step workflows and Pythonic agents to orchestrate end-to-end tasks, applying robust and repeatable constrained generation prompts across local or remote models.

Does this constrained generation approach support local backends like Transformers and llama.cpp?

Yes, it supports local backends including Transformers and llama.cpp, enabling offline experimentation, protecting data privacy, and providing extensible backends for compatibility.

What is the best way to enforce strict schemas and reduce validation errors in LLM pipelines?

The best way to reduce validation errors in LLM pipelines is enforcing strict schemas via regex constraints and grammar-based generation, which provides clear error handling and deterministic, repeatable structured outputs.

When should I not use grammar-based generation for my LLM outputs?

You should avoid grammar-based generation when you require free-form creative text generation, as applying strict regex or CFG grammars intentionally limits output flexibility to guarantee deterministic structural compliance.