guidance

Generate structured text using Python-based Guidance syntax with regex and grammar constraints.

Updated May 14, 2026
One-click install
npx skills add https://github.com/SethyPagna/Secretary-Jarvis --skill guidance-sethypagna
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/SethyPagna/Secretary-Jarvis/tree/main/src/capabilities/optional-skills/mlops/guidance
Command: npx skills add https://github.com/SethyPagna/Secretary-Jarvis --skill guidance-sethypagna

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Guidance helps you force language models to produce valid, predictable output instead of loosely formatted text, reducing retries, parsing failures, and manual cleanup.

Core Features & Use Cases

  • Structured generation: Produce JSON, XML, CSV, and code that conforms to exact syntax requirements.
  • Constraint control: Use regex, grammars, selection rules, and token healing to keep outputs within strict bounds.
  • Workflow orchestration: Build multi-step prompts and tool-using agents with reusable Python functions.
  • Use Case: A developer can turn an LLM into a reliable data extractor that returns clean records for downstream automation without post-processing errors.

Quick Start

Ask the guidance skill to generate a valid JSON object for a user profile with constrained fields and a clear, reusable output format.

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

Structured generation forces language models to produce valid JSON, XML, or code by applying regex and grammar constraints, ensuring outputs conform to exact syntax requirements without manual cleanup.

What is token healing and when do I need it for constrained generation?

Token healing is a constrained generation technique that fixes boundary artifacts during text generation. You need it when enforcing strict syntax rules to prevent partial tokens from corrupting your structured output format.

Can I use constrained generation with local models like llama.cpp and Transformers?

Yes, constrained generation supports selectable model backends including local runtimes like llama.cpp and Transformers, as well as API providers like Anthropic and OpenAI, for consistent structured output across environments.

How do I build multi-step agent workflows with reusable prompt logic?

You build multi-step agent workflows by orchestrating tool-using agents with reusable Python functions, allowing you to chain prompts and validation-heavy extraction steps into reliable automated pipelines.

What is the best way to extract clean data records from LLMs without post-processing errors?

The best way to extract clean records is using structured generation with selection rules and grammar constraints, turning the LLM into a reliable data extractor that returns clean records for downstream automation.

Why does my LLM return malformed JSON instead of structured text?

LLMs return malformed JSON when free-form generation lacks syntax enforcement. Applying grammar constraints and structured generation rules forces the model to produce valid, predictable text that conforms to your exact schema.