guidance

Controls LLM output with regexes and grammars for validated JSON and XML generation.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill enables precise control over LLM outputs by applying regular expressions and context-free grammars to enforce structure, validation, and format in generated content.

Core Features & Use Cases

  • Regex-based constraints for numeric, textual, and pattern-specific fields.
  • Grammar-based generation for nested JSON, XML, and domain-specific formats.
  • Token healing, multi-step workflows, and reusable guidance functions to build robust prompts.
  • Use cases include generating validated JSON, extracting structured data, and enforcing strict output formats in production prompts.

Quick Start

Generate a constrained JSON payload containing a name and email field where the email matches a basic regex.

Frequently Asked Questions about guidance

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

FAQPage Schema
How do I constrain LLM output to a specific regex pattern?▼

This skill applies regex constraints to enforce structure, validation, and format in generated content, guaranteeing valid results for specific fields like emails or custom textual patterns.

How do I guarantee valid JSON generation from an LLM?▼

Grammar-based generation enforces nested JSON, XML, and domain-specific formats by constraining the LLM during decoding. This guarantees structured, valid payloads without relying on post-generation parsing or error correction.

What is context-free grammar generation for structured output?▼

Context-free grammar generation controls LLM decoding by applying grammatical rules to enforce nested structures. It guarantees valid JSON, XML, and domain-specific formats during generation rather than validating after the fact.

Does constrained generation work with local and cloud LLM backends?▼

Yes, regex constraints and grammar-based generation are applied across local and cloud backends. This ensures robust, reusable prompts and strict output formats regardless of your deployment environment.

What is token healing in prompt engineering?▼

Token healing is a technique used during constrained generation to fix boundary token issues, ensuring regex and grammar constraints apply smoothly. It supports multi-step workflows and robust, reusable guidance functions.

When should I use grammar-based constraints instead of post-processing?▼

Use grammar-based constraints for multi-step AI workflows and complex nested formats like JSON or XML to guarantee valid results at generation time, avoiding the fragility and extra overhead of post-generation validation.