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.
npx skills add magnus919/agent-skills --skill dspygit clone --depth 1 https://github.com/magnus919/agent-skillsWrote 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.
[](https://agentmods.dev/skills/magnus919/agent-skills/dspy)<a href="https://agentmods.dev/skills/magnus919/agent-skills/dspy"><img src="https://agentmods.dev/badge/skills/magnus919/agent-skills/dspy/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.
<a href="https://agentmods.dev/skills/magnus919/agent-skills/dspy"><img src="https://agentmods.dev/badge/skills/magnus919/agent-skills/dspy.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00072 | $0.01873 |
| Opus 5 | $0.00036 | $0.00937 |
| Sonnet 5 | $0.00014 | $0.00375 |
| Haiku 4.5 | $0.00007 | $0.00187 |
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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.
DSPy Expert Skill
DSPy is a compiler for prompt programs, not a chain or RAG framework. You write Python programs with typed signatures and DSPy optimizes the prompts automatically.
⚠️ DSPy is NOT a chain framework. It does not use
prompt | model | parser. It does not have LCEL. DSPy operates at a different layer: you define a program with Python control flow and typed signatures, then the compiler optimizes the prompts against a metric. If you reach for DSPy expecting LangChain-style composition, you are reaching for the wrong tool.
Think of it as PyTorch for LMs — you define the architecture, the compiler tunes the weights (prompts).
Core Paradigm
Read this first. It is the most important thing to understand about DSPy.
import dspy
# 1. Configure the LM
lm = dspy.LM("openai/gpt-4o-mini")
dspy.configure(lm=lm)
# 2. Define a signature (input/output schema)
class QASignature(dspy.Signature):
"""Answer questions concisely."""
question: str = dspy.InputField()
answer: str = dspy.OutputField()
# 3. Build a program using modules
qa = dspy.ChainOfThought(QASignature)
# 4. Compile against a metric
optimizer = dspy.MIPROv2(metric=dspy.answer_exact_match)
compiled_qa = optimizer.compile(qa, trainset=trainset, num_trials=25)
# 5. Use the compiled program (portable artifact)
answer = compiled_qa(question="What is DSPy?").answer
Core Principles
-
DSPy is a compiler, not a chain framework. You define the program structure with Python control flow and typed signatures. The compiler optimizes the prompts. This is fundamentally different from LangChain's explicit prompt composition.
-
Signatures define the task. Input/output field pairs with optional descriptions are the task definition. The syntax is
input1, input2 -> output1, output2. -
Modules are program components.
dspy.Predict(direct),dspy.ChainOfThought(reasoning),dspy.ReAct(tool-use), and customdspy.Modulesubclasses. Compose them with Python control flow (if/for/while).
What ships with it
15 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.
- evals/evals.json 2.7 KB
- README.md 1.7 KB
- references/agent-patterns.md 1.2 KB
- references/compilation-guide.md 2.0 KB
- references/core-modules.md 2.3 KB
- references/evaluation.md 1.8 KB
- references/example-rag-compilation.md 2.3 KB
- references/faq-and-troubleshooting.md 2.2 KB
- references/optimizer-guide.md 4.9 KB
- references/program-patterns.md 2.5 KB
- references/validation-audit.md 1.4 KB
- scripts/check-setup.py 687 B runs code
- templates/classification.py 1.1 KB runs code
- templates/multi-step.py 937 B runs code
- templates/rag-program.py 918 B runs code
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.
- 9d ago Changed · +1 lines · +12 tokens per session 3ee9a82a13ff
- 13d ago First seen · 145 lines · 60 tokens per session scan A c22f801e7f71
dspy is a skill published in the GitHub repository magnus919/agent-skills (76 stars, last pushed yesterday), licensed MIT. It adds 72 tokens to every session and 1,873 once invoked, about $0.0004 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-08-30.
Other skills, from other repositories
opik-optimizer
Optimize LLM prompts, tools, and agents in Opik using standardized optimizer workflows (prompt optimization, tool optimization, and parameter tuning), dataset/metric wiring, and result interpretation.
gemini-api-dev
Use when build applications using Google Gemini API. Handle chat completions, multimodal inputs, function calling, streaming, and grounding with Google Search. Use when building applications using google gemini api. handle chat completions, multimodal.
standalone-python-scripts
Skill "standalone-python-scripts" from iloveitaly/llm-ide-rules, covering standalone python scripts, /// script, requires-python = ">=3.13", dependencies = [] and ///.
c-ai
Query LLMs from the CLI — pipe text for summarization, chat interactively, use local or cloud models with llm or aichat.
create-pi-prompt
Como criar prompt templates para pi. Use quando o usuário quiser criar atalhos /comando que expandem em prompts completos.
prompt-engineering
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production. Use when optimizing prompts, improving LLM outputs, designing production prompt templates, or building AI-powered features.