dspy-ruby
Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization.
Skill by gvkhosla
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/gvkhosla-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
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/dspy-ruby
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 gvkhosla/compound-engineering-pi, MIT.
More from gvkhosla/compound-engineering-pi
- 0.668score
rclone
gvkhosla
Upload, sync, and manage files across cloud storage providers using rclone.
SkillAFreshness: A★ 51Claude Code +9 - 0.668score
resolve-pr-parallel
gvkhosla
Resolve all PR comments using parallel processing.
SkillAFreshness: A★ 51Claude Code +9 - 0.668score
document-review
gvkhosla
Review requirements or plan documents using parallel persona agents that surface role-specific issues.
SkillAFreshness: A★ 51Claude Code +9 - 0.664score
claude-permissions-optimizer
gvkhosla
Optimize Claude Code permissions by finding safe Bash commands from session history and auto-applying them to settings.json.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
frontend-design
gvkhosla
Build web interfaces with genuine design quality, not AI slop.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
feature-video
gvkhosla
Record a video walkthrough of a feature and add it to the PR description.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
ankane-readme-writer
gvkhosla
Creates or updates README files following Ankane-style template for Ruby gems.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
reproduce-bug
gvkhosla
Systematically reproduce and investigate a bug from a GitHub issue.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
architecture-strategist
gvkhosla
Analyzes code changes from an architectural perspective for pattern compliance and design integrity.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
deepen-plan
gvkhosla
Stress-test an existing implementation plan and selectively strengthen weak sections with targeted research.
SkillAFreshness: A★ 51Claude Code +9 - 0.660score
agent-native-reviewer
gvkhosla
Reviews code to ensure agent-native parity — any action a user can take, an agent can also take.
SkillAFreshness: A★ 51Claude Code +9 - 0.660score
api-contract-reviewer
gvkhosla
Conditional code-review persona, selected when the diff touches API routes, request/response types, serialization, versioning, or exported type signatures.
SkillAFreshness: A★ 51Claude Code +9
Signals
- Stars
- 51
- Forks
- 4
- Open issues
- 0
- Last commit (this folder)
- Feb 12, 2026 (8 months ago)
- Last release
- Oct 1, 2026 (27 days 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.243score
dspy-ruby
sammyjoyce
Build type-safe LLM applications with DSPy.rb — Ruby's programmatic prompt framework with signatures, modules, agents, and optimization.
SkillDFreshness: DClaude 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 gvkhosla
- 0.668score
resolve-pr-parallel
gvkhosla
Resolve all PR comments using parallel processing.
SkillAFreshness: A★ 51Claude Code +9 - 0.668score
document-review
gvkhosla
Review requirements or plan documents using parallel persona agents that surface role-specific issues.
SkillAFreshness: A★ 51Claude Code +9 - 0.668score
rclone
gvkhosla
Upload, sync, and manage files across cloud storage providers using rclone.
SkillAFreshness: A★ 51Claude Code +9 - 0.664score
claude-permissions-optimizer
gvkhosla
Optimize Claude Code permissions by finding safe Bash commands from session history and auto-applying them to settings.json.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
frontend-design
gvkhosla
Build web interfaces with genuine design quality, not AI slop.
SkillAFreshness: A★ 51Claude Code +9 - 0.663score
reproduce-bug
gvkhosla
Systematically reproduce and investigate a bug from a GitHub issue.
SkillAFreshness: A★ 51Claude Code +9
Cite this page
dspy-ruby skill. Agent Mart. https://agentmart.dev/skills/gvkhosla-dspy-ruby (last updated 2026-10-24)