dspy-ruby

Build type-safe LLM applications in Ruby with Sorbet signatures and automated prompt optimization.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/ybbms777/compound-engineering --skill dspy-ruby-ybbms777
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dspy-ruby
Source: https://github.com/ybbms777/compound-engineering/tree/main/skills/dspy-ruby
Command: npx skills add https://github.com/ybbms777/compound-engineering --skill dspy-ruby-ybbms777

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill solves the problem of building reliable, maintainable LLM-powered features in Ruby applications by replacing fragile prompt strings with type-safe signatures, modular components, and automated optimization.

Core Features & Use Cases

  • Type-Safe Signatures: Define LLM inputs and outputs using Sorbet types, enums, and structs for compile-time safety and reliable structured outputs.
  • Modular Agents & Tools: Compose ReAct and CodeAct agents with type-safe tools, lifecycle callbacks, and fiber-local model overrides for complex multi-step workflows.
  • Automated Optimization: Improve prompt accuracy with MIPROv2 and GEPA optimizers using real data instead of manual prompt tweaking.
  • Production Observability: Built-in event tracing, Langfuse integration, and evaluation frameworks for monitoring LLM application performance.

Quick Start

Use the dspy-ruby skill to define a Ruby signature for sentiment analysis and call it with the text "This product is amazing!" to get a structured result with sentiment and confidence score.

Frequently Asked Questions about dspy-ruby

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

FAQPage Schema
How do I build type-safe LLM applications in Ruby with structured outputs?

To build type-safe LLM applications in Ruby, you define inputs and outputs using Sorbet types, enums, and structs, replacing fragile prompt strings with modular components for reliable structured outputs.

Can I use automated prompt optimization for Ruby on Rails LLM features?

Yes, you can use automated prompt optimization in Ruby on Rails by applying MIPROv2 and GEPA optimizers, which improve prompt accuracy using real data instead of manual prompt tweaking.

Does this approach support modular agents and tool use in Ruby?

Modular agents and tool use in Ruby are supported by composing ReAct and CodeAct agents with type-safe tools, lifecycle callbacks, and fiber-local model overrides for complex multi-step workflows.

What is the best way to monitor LLM application performance in Ruby?

The best way to monitor LLM application performance in Ruby involves using built-in event tracing, Langfuse integration, and evaluation frameworks for comprehensive production observability.

Do I need Sorbet to define type-safe signatures for LLMs in Ruby?

Yes, you need Sorbet for type definitions to establish compile-time safety and reliable structured LLM outputs, applying to both standalone Ruby and Ruby on Rails projects.

How does multi-provider model routing work for Ruby LLM applications?

Multi-provider model routing works by utilizing adapter gems for LLM providers, enabling fiber-local model overrides to direct traffic across different models within modular agent workflows.