dspy-ruby

dspy-ruby is a skill for Claude Code from davekilleen/Dex. It costs 81 tokens per session (3,839 once invoked), scanned A, original, MIT.

A guide for using DSPy.rb, a Ruby framework for building structured applications that use large language models.

In plain words
What is it for?
Use it to create model input and output definitions, build reusable AI components, configure providers such as OpenAI or Anthropic, and develop agent systems.
Why use it?
It helps make AI features more predictable and keeps their building blocks organised. It also covers connecting the application to different language-model providers.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Part of the compound-engineering plugin — 17 skills, 19 commands shipped together

Good fit Use it to create model input and output definitions, build reusable AI components, configure providers such as OpenAI or Anthropic, and develop agent systems.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/davekilleen/dex/dspy-ruby
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add davekilleen/Dex --skill dspy-ruby
Clone the repo
git clone --depth 1 https://github.com/davekilleen/Dex

Made for: Claude Code.

Or install compound-engineering, the plugin that ships this one along with the rest of its 17 skills, 19 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dspy-ruby

README.md
[![agentmods](https://agentmods.dev/badge/skills/davekilleen/dex/dspy-ruby/github.svg)](https://agentmods.dev/skills/davekilleen/dex/dspy-ruby)
Your own site
<a href="https://agentmods.dev/skills/davekilleen/dex/dspy-ruby"><img src="https://agentmods.dev/badge/skills/davekilleen/dex/dspy-ruby/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dspy-ruby

Your own site · 80×15
<a href="https://agentmods.dev/skills/davekilleen/dex/dspy-ruby"><img src="https://agentmods.dev/badge/skills/davekilleen/dex/dspy-ruby.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,839 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.03839
Opus 5.5 $0.00032 $0.01536
Sonnet 5.5 $0.00016 $0.00768
Haiku 4.5 $0.00008 $0.00384

Measured 1mo ago against content hash 303a4eb7783e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dspy-ruby scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 3 executable files (assets/config-template.rb, assets/module-template.rb, assets/signature-template.rb), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/plugins/compound-engineering/skills/dspy-ruby/SKILL.md · 595 lines

How it starts

The opening of the file, as written. The whole thing — 595 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DSPy.rb Expert

Overview

DSPy.rb is a Ruby framework that enables developers to program LLMs, not prompt them. Instead of manually crafting prompts, define application requirements through type-safe, composable modules that can be tested, optimized, and version-controlled like regular code.

This skill provides comprehensive guidance on:

  • Creating type-safe signatures for LLM operations
  • Building composable modules and workflows
  • Configuring multiple LLM providers
  • Implementing agents with tools
  • Testing and optimizing LLM applications
  • Production deployment patterns

Core Capabilities

1. Type-Safe Signatures

Create input/output contracts for LLM operations with runtime type checking.

When to use: Defining any LLM task, from simple classification to complex analysis.

Quick reference:

class EmailClassificationSignature < DSPy::Signature
  description "Classify customer support emails"

  input do
    const :email_subject, String
    const :email_body, String
  end

  output do
    const :category, T.enum(["Technical", "Billing", "General"])
    const :priority, T.enum(["Low", "Medium", "High"])
  end
end

Templates: See assets/signature-template.rb for comprehensive examples including:

  • Basic signatures with multiple field types
  • Vision signatures for multimodal tasks
  • Sentiment analysis signatures
  • Code generation signatures

Best practices:

  • Always provide clear, specific descriptions
  • Use enums for constrained outputs
  • Include field descriptions with desc: parameter
  • Prefer specific types over generic String when possible

Full documentation: See references/core-concepts.md sections on Signatures and Type Safety.

2. Composable Modules

Build reusable, chainable modules that encapsulate LLM operations.

When to use: Implementing any LLM-powered feature, especially complex multi-step workflows.

Quick reference:

class EmailProcessor < DSPy::Module
  def initialize
    super
    @classifier = DSPy::Predict.new(EmailClassificationSignature)
  end

  def forward(email_subject:, email_body:)
    @classifier.forward(
      email_subject: email_subject,
      email_body: email_body
    )
  end
end

Read the full file on GitHub · 595 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 595 lines · 81 tokens per session scan A 303a4eb7783e

Subscribe to this mod's changes

dspy-ruby is a skill published in the GitHub repository davekilleen/Dex (500 stars, last pushed today), licensed MIT. It adds 81 tokens to every session and 3,839 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.