guidance

Enforce structured generation constraints on large language model outputs.

Updated Feb 21, 2026
One-click install
npx skills add https://github.com/Gitnapp/Skills --skill guidance-gitnapp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/Gitnapp/Skills/tree/main/mlops/inference/guidance
Command: npx skills add https://github.com/Gitnapp/Skills --skill guidance-gitnapp

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill solves unreliable LLM output formatting by enforcing constraints that make generated text, JSON, XML, and code conform to required structures.

Core Features & Use Cases

  • Constrained Generation: Apply regex, grammars, and selection rules to guarantee valid outputs and reduce formatting failures.
  • Workflow Control: Build multi-step LLM workflows with Pythonic control flow, reusable generation functions, and validated tool interactions.
  • Use Case: A developer building an AI data extraction service can use this Skill to generate validated JSON records, classify inputs, and create structured responses without repeated retry logic.

Quick Start

Use the guidance skill to create a constrained JSON generator that extracts names, emails, and other fields from user text.

Frequently Asked Questions about guidance

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

FAQPage Schema
How do I guarantee valid JSON output from an LLM every time?

Guaranteed structured LLM output is achieved by enforcing constrained generation constraints like regex validation and grammar rules, ensuring generated JSON, XML, and code conform to required structures without retry logic.

What is constrained generation in prompt engineering?

Constrained generation in prompt engineering controls invalid LLM outputs by applying selection rules, regex, and grammar-based constraints to force valid text, JSON, or code generation during AI engineering tasks.

How do I build multi-step LLM workflows with validated tool interactions?

Build multi-step LLM workflows using Pythonic control flow and reusable generation functions to validate tool interactions, classify inputs, and create structured responses for agent workflows.

Can I apply regex validation to LLM outputs during data extraction?

Regex validation applies to LLM outputs during data extraction by enforcing structured generation constraints, guaranteeing valid JSON records and extracted fields conform to required formats.

What's the best way to stop LLMs from generating invalid JSON?

The best way to stop LLMs from generating invalid JSON is enforcing grammar-based constraints and token healing, which control invalid outputs by satisfying regex validation requirements and backend integration rules.

Does structured generation work with custom LLM providers for agent workflows?

Structured generation works with supported LLM providers for agent workflows by applying backend integration constraints, enabling validated tool interactions and constrained JSON generation within custom AI data extraction services.