One-click install
npx skills add https://github.com/graniet/kheish --skill guidance-graniet
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/graniet/kheish/tree/main/skills/mlops/inference/guidance
Command: npx skills add https://github.com/graniet/kheish --skill guidance-graniet

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

LLMs frequently generate malformed structured outputs such as invalid JSON, incorrectly formatted emails, or broken code when prompted for specific formats, requiring extensive post-processing, retry loops, and validation logic that slows development and introduces failure points in production workflows.

Core Features & Use Cases

  • Constrained Generation: Enforce regex and grammar rules during LLM inference to guarantee outputs match required formats like JSON, XML, emails, dates, and code syntax, eliminating invalid results.
  • Token Healing: Automatically fix tokenization boundary issues to produce natural, correctly formatted outputs without awkward spacing or broken tokens.
  • Multi-Step Workflow Support: Build complex agent workflows, chain-of-thought reasoning, and data extraction pipelines using Pythonic control flow with reusable, stateful generation functions.
  • Backend Agnostic: Works with all major LLM providers including Anthropic Claude, OpenAI, local Hugging Face Transformers models, and llama.cpp for flexible deployment.
  • Use Case Example: A development team can use this skill to build a data ingestion pipeline that extracts structured user information (name, age, email) from unstructured support tickets, with guaranteed valid output format that can be directly inserted into a database without additional validation.

Quick Start

Use the guidance skill to extract a structured user profile with name, age, and email fields from the unstructured support ticket text "User Jane Smith, 28, [email protected] contacted support about a billing issue on 2024-10-05."

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?

To guarantee valid JSON output from an LLM, apply regex and grammar constraints during token generation. This constrained generation approach eliminates malformed structured outputs and removes the need for post-processing or retry loops in production workflows.

How do I extract structured data from unstructured text using an LLM?

Extract structured data from unstructured text by building multi-step agent workflows with Pythonic control flow. You can extract user information like names, emails, and dates directly into a guaranteed valid format suitable for database insertion.

Does constrained generation work with local Hugging Face models and OpenAI?

Constrained generation is backend-agnostic and works with major LLM providers including OpenAI, Anthropic Claude, local Hugging Face Transformers models, and llama.cpp. This backend-agnostic integration allows flexible deployment across different environments without changing your workflow logic.

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

Token healing automatically fixes tokenization boundary issues during LLM inference to produce natural, correctly formatted outputs. It prevents awkward spacing or broken tokens that often occur when LLMs generate structured data like JSON or XML.

Why does my LLM generate broken code and invalid XML?

LLMs generate broken code and invalid XML because standard inference lacks format constraints during token generation. Applying grammar-based generation rules enforces syntax compliance during inference, eliminating invalid results without relying on post-generation validation logic.