dspy

dspy is a skill for Claude Code, Codex from NousResearch/hermes-agent. It costs 19 tokens per session (3,737 once invoked), scanned A, original, MIT.

A framework for building language-model programs from reusable components and declared input-output rules. It can automatically improve prompts using examples and measured results instead of relying only on manual rewriting.

In plain words
What is it for?
For creating modular language-model pipelines, optimizing prompts, building RAG applications and agents, and developing classifiers.
Why use it?
It helps make complex AI workflows easier to maintain and tune systematically. It is intended to improve the reliability of outputs from RAG systems, agents, and classifiers.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

About the project

Hermes Agent is an AI assistant that learns from its use by creating and improving skills, retaining knowledge, searching past conversations, and adapting to its users. It is for people who want to run an agent through a terminal or messaging platforms while connecting it to different AI models and scheduled tasks.

NousResearch/hermes-agent · 242,018 stars · on GitHub · hermes-agent.nousresearch.com

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.

agentmods
npx agentmods add skills/nousresearch/hermes-agent/dspy
Any agent
npx skills add NousResearch/hermes-agent --skill dspy
Clone the repo
git clone --depth 1 https://github.com/NousResearch/hermes-agent

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/nousresearch/hermes-agent/dspy.svg)](https://agentmods.dev/skills/nousresearch/hermes-agent/dspy)
Your own site
<a href="https://agentmods.dev/skills/nousresearch/hermes-agent/dspy"><img src="https://agentmods.dev/badge/skills/nousresearch/hermes-agent/dspy.svg" alt="Measured on agentmods" height="20"></a>
Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,737 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00019 $0.03737
Opus 5 $0.00010 $0.01869
Sonnet 5 $0.00004 $0.00747
Haiku 4.5 $0.00002 $0.00374

Measured 2d ago against content hash 67410a6b216d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

dspy 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 2d ago.

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.

Origin

Copies of this mod

8 near-identical copies found in the catalogue:

  • dspy — 100% identical, 0 lines differ
  • dspy — 100% identical, 0 lines differ
  • dspy — 100% identical, 0 lines differ
  • dspy — 100% identical, 0 lines differ
  • dspy — 100% identical, 0 lines differ
  • dspy — 98% identical, 1 lines differ
  • dspy — 98% identical, 1 lines differ
  • dspy — 98% identical, 1 lines differ
optional-skills/mlops/research/dspy/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: Declarative Language Model Programming

When to Use This Skill

Use DSPy when you need to:

  • Build complex AI systems with multiple components and workflows
  • Program LMs declaratively instead of manual prompt engineering
  • Optimize prompts automatically using data-driven methods
  • Create modular AI pipelines that are maintainable and portable
  • Improve model outputs systematically with optimizers
  • Build RAG systems, agents, or classifiers with better reliability

GitHub Stars: 22,000+ | Created By: Stanford NLP

Installation

# Stable release
pip install dspy

# Latest development version
pip install git+https://github.com/stanfordnlp/dspy.git

# With specific LM providers
pip install dspy[openai]        # OpenAI
pip install dspy[anthropic]     # Anthropic Claude
pip install dspy[all]           # All providers

Quick Start

Basic Example: Question Answering

import dspy

# Configure your language model
lm = dspy.Claude(model="claude-sonnet-4-5-20250929")
dspy.settings.configure(lm=lm)

# Define a signature (input → output)
class QA(dspy.Signature):
    """Answer questions with short factual answers."""
    question = dspy.InputField()
    answer = dspy.OutputField(desc="often between 1 and 5 words")

# Create a module
qa = dspy.Predict(QA)

# Use it
response = qa(question="What is the capital of France?")
print(response.answer)  # "Paris"

Chain of Thought Reasoning

import dspy

lm = dspy.Claude(model="claude-sonnet-4-5-20250929")
dspy.settings.configure(lm=lm)

# Use ChainOfThought for better reasoning
class MathProblem(dspy.Signature):
    """Solve math word problems."""
    problem = dspy.InputField()
    answer = dspy.OutputField(desc="numerical answer")

# ChainOfThought generates reasoning steps automatically
cot = dspy.ChainOfThought(MathProblem)

response = cot(problem="If John has 5 apples and gives 2 to Mary, how many does he have?")
print(response.rationale)  # Shows reasoning steps
print(response.answer)     # "3"

Read the full file on GitHub · 595 lines

Files

What ships with it

3 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. 2d ago First seen · 595 lines · 19 tokens per session scan A 67410a6b216d

Subscribe to this mod's changes

dspy is a skill published in the GitHub repository NousResearch/hermes-agent (242,018 stars, last pushed today), licensed MIT. It adds 19 tokens to every session and 3,737 once invoked, about $0.0001 per session on Opus 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-09-03.

Related

Other skills, from other repositories

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

sickn33/agentic-awesome-skills · 47 tokens

llm-ops

LLM Operations -- RAG, embeddings, vector databases, fine-tuning, prompt engineering avancado, custos de LLM, evals de qualidade e arquiteturas de IA para producao.

davila7/claude-code-templates · 44 tokens

fine-tune-readiness

Decide whether fine-tuning is justified versus prompting or RAG, and gate the training dataset before any LoRA/SFT/DPO run. Use when someone says 'let's fine-tune'.

zorost/AI-Engineering-Lab · 46 tokens

ai-engineering-toolkit

AI Engineering Toolkit workflow skill. Use this skill when the user needs 6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching and the operator…

diegosouzapw/awesome-omni-skills · 81 tokens

dspy-haystack-integration

Use for integrating DSPy with Haystack, optimizing Haystack prompts, improving retrieval pipelines, and extracting DSPy prompts.

OmidZamani/dspy-skills · 32 tokens

paper-daily

Discover daily arXiv papers for LLM/Agent topics, rank candidates with keyword and institution filters, and prepare a small selected paper list for llm-paper-daily style workflows.

xianshang33/llm-paper-daily · 41 tokens