guidance

Constrain AI-generated content to structured JSON, XML, and code formats.

1|Updated Feb 17, 2026
One-click install
npx skills add https://github.com/brittaniebuffiecsu/zerogravityclaw --skill guidance-brittaniebuffiecsu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guidance
Source: https://github.com/brittaniebuffiecsu/zerogravityclaw/tree/main/src/hermes-core/optional-skills/mlops/guidance
Command: npx skills add https://github.com/brittaniebuffiecsu/zerogravityclaw --skill guidance-brittaniebuffiecsu

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires guidance, transformers, llama_cpp, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill provides precise control over AI-generated content, ensuring structured, valid JSON/XML/code output, and preventing errors.

Core Features & Use Cases

  • Structured Output: Generate accurate JSON/XML/code outputs based on regex constraints and grammars.
  • Regex Constraints: Apply syntax constraints using regular expressions for emails, dates, and more.
  • Grammar-Based Generation: Define complex data structures with context-free grammars.
  • Use Case: Create a user profile JSON object with constraints to ensure valid data is entered.

Quick Start

Generate a JSON object for a new user with the name "John Doe", age 30, and email "[email protected]".

Frequently Asked Questions about guidance

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

FAQPage Schema
How do I constrain AI code generation to output valid JSON?

Constrained AI generation enforces structured formats like JSON by applying regex constraints and context-free grammars during the generation process. This guarantees valid syntax for automated data processing and API responses without post-generation parsing errors.

What is grammar-based generation for structured data?

Grammar-based generation uses context-free grammars to define complex data structures for AI outputs. It provides precise control over content creation, ensuring generated text adheres to specific structured formats like XML and code.

Do I need the transformers library to validate AI output formats?

You need either the 'transformers' or 'llama_cpp' library to validate AI output formats with this approach. These dependencies provide the underlying models required to execute constrained generation and enforce syntax rules.

Can I use regex constraints to generate specific data formats like emails?

You can apply regex constraints to generate specific data formats like emails and dates. This mechanism restricts the AI's output space, ensuring the generated content matches your defined regular expression patterns exactly.

What's the best way to ensure AI-generated code adheres to specific structured formats?

The best way to ensure AI-generated code adheres to specific structured formats is using constrained generation with grammars. This method provides precise control over the output, preventing syntax errors before they occur.

Why does my AI model output invalid JSON instead of the expected structure?

AI models output invalid JSON when generation lacks structural constraints. Applying grammar-based generation or regex constraints forces the model to produce valid JSON, XML, or code by strictly defining the allowed syntax.