dspy-ruby
Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization.
Skill by sammyjoyce
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sammyjoyce-dspy-ruby
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, ml, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
dspy-ruby- Description
- Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization. Use when implementing predictable AI features, creating LLM signatures and modules, configuring language model providers, building agent systems with tools, optimizing prompts, or testing LLM-powered functionality in Ruby applications.
- License
- MIT
- Instructions
- 734 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
- Instructions call the network
Agent Skills spec issues
- body: 734 lines (spec recommends under 500)
Files (9)
- SKILL.md
- config-template.rb · assets/
- module-template.rb · assets/
- signature-template.rb · assets/
- core-concepts.md · references/
- observability.md · references/
- optimization.md · references/
- providers.md · references/
- toolsets.md · references/
SKILL.md (first lines)
# DSPy.rb
> Build LLM apps like you build software. Type-safe, modular, testable.
DSPy.rb brings software engineering best practices to LLM development. Instead of tweaking prompts, define what you want with Ruby types and let DSPy handle the rest.
## Overview
DSPy.rb is a Ruby framework for building language model applications with programmatic prompts. It provides:
- **Type-safe signatures** — Define inputs/outputs with Sorbet types
- **Modular components** — Compose and reuse LLM logic
- **Automatic optimization** — Use data to improve prompts, not guesswork
- **Production-ready** — Built-in observability, testing, and error handling
## Core Concepts
### 1. Signatures
Define interfaces between your app and LLMs using Ruby types:
```ruby
class EmailClassifier < DSPy::Signature
description "Classify customer support emails by category and priority"
class Priority < T::Enum
enums do
Low = new('low')
Medium = new('medium')
High = new('high')
Urgent = new('urgent')
end
end
input do
const :email_content, String
const :sender, String
end
output do
const :category, String
const :priority, Priority # Type-safe enum with defined values
const :confidence, Float
end
end
```
### 2. Modules
Build complex workflows from simple building blocks:
- **Predict** — Basic LLM calls with signatures
- **ChainOfThought** — Step-by-step reasoning
- **ReAct** — Tool-using agents
- **CodeAct** — Dynamic code generation agents (install the `dspy-code_act` gem)
### 3. Tools & Toolsets
Create type-safe tools for agents with comprehensive Sorbet support:
```ruby
# Enum-based tool with automatic type conversion
class CalculatorTool < DSPy::Tools::Base
tool_name 'calculator'
tool_description 'Performs arithmetic operations with type-safe enum inputs'
class Operation < T::Enum
enums do
Add = new('add')
Subtract = new('subtract')
Multiply = new('multiply')
Divide = new('divide')
end
end
sig { params(operation: Operation, num1: Float, num2: Float).returns(T.any(Float, String)) }
def call(operation:, num1:, num2:)
case operation
when Operation::Add then num1 + num2
when Operation::Subtract then num1 - num2
when Operation::Multiply then num1 * num2
when Operation::Divide
return "Error: Division by zero" if num2 == 0
num1 / num2
end
end
end
# Multi-tool toolset with rich types
class DataToolset < DSPy::Tools::Toolset
toolset_name "data_processing"
class Format < T::Enum
enums do
JSON = new('json')
CSV = new('csv')
XML = new('xml')
end
end
tool :convert, description: "Convert data between formats"
tool :validate, description: "Validate data structure"
sig { params(data: String, from: Format, to: Format).returns(String) }
def convert(data:, from:, to:)
"Converted from #{from.serialize} to #{to.serialize}"
end
sig { params(data: String, format: Format).returns(T::Hash[String, T.any(String, Integer, T::Boolean)]) }
def validate(data:, format:)
{ valid: true, format: format.serialize, row_count: 42, message: "Data validation passed" }
end
end
```
### 4. Type System & Discriminators
DSPy.rb uses sophisticated type discrimination for complex data structures:From sammyjoyce/pi-compound-engineering, MIT.
More from sammyjoyce/pi-compound-engineering
- 0.414score
git-worktree
sammyjoyce
Manage Git worktrees for isolated parallel development.
SkillDFreshness: DClaude Code +9 - 0.414score
resolve-pr-parallel
sammyjoyce
Resolve GitHub PR review threads efficiently.
SkillDFreshness: DClaude Code +9 - 0.383score
skill-creator
sammyjoyce
Guide for creating effective skills.
SkillDFreshness: DClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Feb 10, 2026 (8 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.659score
dspy-ruby
gvkhosla
Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization.
SkillAFreshness: A★ 51Claude Code +9 - 0.240score
dspy-ruby
danfrdn
Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization.
SkillDFreshness: DClaude Code +9
More from sammyjoyce
- 0.544score
setup-pstack
sammyjoyce
Configure which models pstack uses per role and at what reasoning budget.
SkillBFreshness: B★ 1Claude Code +9 - 0.524score
how
sammyjoyce
Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which…
SkillBFreshness: B★ 1Claude Code +9 - 0.524score
poteto-mode
sammyjoyce
poteto's agent style for concise, detailed responses, deliberate subagents, unslopped prose, simple code, and verified work.
SkillBFreshness: B★ 1Claude Code +9 - 0.524score
interrogate
sammyjoyce
Use for "interrogate", "adversarial review", "multi-model review", "challenge this", "stress test this code", "find blind spots", or "tear this apart".
SkillBFreshness: B★ 1Claude Code +9 - 0.522score
automate-me
sammyjoyce
Use for "automate me", "create/update/refresh my -mode skill", "turn/capture my preferences or working style into a skill", or wanting agents to follow how…
SkillBFreshness: B★ 1Claude Code +9 - 0.516score
no-comments
sammyjoyce
Spawn Comment Sicko, fix accepted findings, and offer encodings for claimed constraints.
SkillBFreshness: B★ 1Claude Code +9
Cite this page
dspy-ruby skill. Agent Mart. https://agentmart.dev/skills/sammyjoyce-dspy-ruby (last updated 2026-10-24)