Skip to content

Constrained generation framework that forces LLM output into regex, grammar, or selection formats from Microsoft Research.

CCM score
61 of 100
skills.sh installs
1.1K
GitHub stars
14.9K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers regex and grammar constraints, selection among fixed choices, token healing, and reusable @guidance functions for multi-step workflows
  • Guarantees valid JSON, XML, dates, emails, and other formats by filtering invalid tokens during generation
  • Supports OpenAI, Anthropic, Hugging Face Transformers, and llama.cpp backends through a single Python API
  • Designed for developers who need structured LLM output without retry loops or post-hoc parsing

Install

$ npx -y skills add orchestra-research/ai-research-skills --skill guidance -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Guidance: Constrained LLM Generation

When to Use This Skill

Use Guidance when you need to:

  • Control LLM output syntax with regex or grammars
  • Guarantee valid JSON/XML/code generation
  • Reduce latency vs traditional prompting approaches
  • Enforce structured formats (dates, emails, IDs, etc.)
  • Build multi-step workflows with Pythonic control flow
  • Prevent invalid outputs through grammatical constraints

GitHub Stars: 18,000+ | From: Microsoft Research

Installation

# Base installation
pip install guidance

# With specific backends
pip install guidance[transformers]  # Hugging Face models
pip install guidance[llama_cpp]     # llama.cpp models

Quick Start

Basic Example: Structured Generation

from guidance import models, gen

# Load model (supports OpenAI, Transformers, llama.cpp)
lm = models.OpenAI("gpt-4")

# Generate with constraints
result = lm + "The capital of France is " + gen("capital", max_tokens=5)

print(result["capital"])  # "Paris"

With Anthropic Claude

from guidance import models, gen, system, user, assistant

Details

Repository
github.com/orchestra-research/ai-research-skills
Category
AI Agents & LLM Apps
First seen
Jun 3, 2026

Questions

What does the guidance skill do?

The guidance skill controls LLM output with regex and grammars, so output can be guaranteed to be valid JSON, XML or code. It also enforces structured formats such as dates, emails and IDs, and builds multi-step workflows with Pythonic control flow. It is based on Guidance, Microsoft Research's constrained generation framework.

How do I install the guidance skill?

Run npx -y skills add orchestra-research/ai-research-skills --skill guidance -y in your project to install it. After that, the agent can use Guidance to constrain model output with regex, grammars and selection choices.

Which AI agents and models does guidance work with?

The skill's examples show Guidance working with Anthropic Claude, OpenAI, local Hugging Face Transformers models and llama.cpp models. It needs the guidance Python package, installed with pip, plus transformers when using Hugging Face models.

Where does guidance rank in the AI Agents & LLM Apps category?

Guidance is listed in the AI Agents & LLM Apps category on Claude Marketplaces, alongside skills such as microsoft-foundry and azure-ai. It sets itself apart by focusing on token-level constrained generation so model outputs match a required syntax.

More from orchestra-research/ai-research-skills

All 92

Similar to Guidance

More AI Agents & LLM Apps